OCI 컨테이너에서 grpcurl로 PLCnext Control 로컬 gRPC 상호작용
이것은 PLCnext Control 장치에서 PLCnext Runtime의 gRPC 서버와 상호작용하기 위해 gRPC를 사용하는 시리즈의 최신 편입니다.
시리즈의 이전 포스트들은 다음과 같습니다:
- grpcurl을 사용한 원격 gRPC
- grpcurl을 사용한 보안 원격 gRPC
- Reflection을 사용한 원격 gRPC
위에 나열된 기사들은 원격 클라이언트 장치에서 PLCnext Control 장치의 gRPC 서버에 접근하는 방법을 보여줍니다. 이 포스트는 로컬 gRPC 클라이언트, 즉 PLCnext Control 장치에서 실행되며 동일한 장치의 gRPC 서버에 접근하는 gRPC 클라이언트의 예시를 제공합니다.
PLCnext Control 장치에서 로컬 gRPC 클라이언트의 다른 예시는 여기에서 찾을 수 있습니다:
- C#으로 PLCnext Control gRPC 서버용 클라이언트 생성 방법
- gRPC를 사용해 Python 스크립트를 PLCnext Engineer 프로젝트와 인터페이스하는 방법
PLCnext Control 장치에는 표준으로 gRPC 클라이언트 소프트웨어가 설치되어 있지 않으므로, 이 기사에서는 Podman과 dockerhub의 적절한 이미지를 사용해 gRPC 클라이언트(이 경우 grpcurl)를 OCI 컨테이너에서 실행하는 방법을 보여줍니다.
사전 요구 사항
-
인터넷 액세스가 가능한 적절한 PLCnext Control 장치. 예: 펌웨어 버전 2025.0 이상인 AXC F 3152, 펌웨어 버전 2026.0 이상인 AXC F 1252. 현재 이 기사에서 사용된 OCI 이미지는 AXC F 2152 같은 armv7 타겟에서는 사용할 수 없습니다.
-
브라우저에서 장치의 웹 기반 관리(WBM) 사이트를 열고, System Services 페이지에서 GRPC LOCAL SERVER 기능이 활성화되어 있는지 확인합니다.
절차:
-
admin 사용자 계정으로 PLCnext Control 장치에서 보안 셸 세션을 엽니다.
-
셸 세션에서 다음 명령을 실행합니다:
podman pull docker.io/fullstorydev/grpcurl:latest-alpine
이 명령은 grpcurl 명령줄 도구가 포함된 OCI 이미지를 PLCnext Control 장치에 다운로드합니다.
-
로컬 PLCnext Control 장치에서 사용 가능한 gRPC 서비스를 나열합니다:
podman run -it --rm -v /run/plcnext/:/run/plcnext/ --userns=keep-id docker.io/fullstorydev/grpcurl:latest-alpine --plaintext unix:///run/plcnext/grpc.sock list
응답:
Arp.Device.Interface.Services.Grpc.IDeviceControlService Arp.Device.Interface.Services.Grpc.IDeviceInfoService Arp.Device.Interface.Services.Grpc.IDeviceSettingsService Arp.Device.Interface.Services.Grpc.IDeviceStatusService Arp.Io.Axioline.Services.Grpc.IAcyclicCommunicationService Arp.Io.Axioline.Services.Grpc.IAxioMasterService Arp.Plc.Gds.Services.Grpc.IDataAccessService Arp.Plc.Gds.Services.Grpc.IForceService Arp.Plc.Gds.Services.Grpc.ISubscriptionService Arp.Services.DataLogger.Services.Grpc.IDataLoggerService2 Arp.Services.NotificationLogger.Services.Grpc.INotificationLoggerService Arp.System.Commons.Services.Io.Grpc.IDirectoryService Arp.System.Commons.Services.Io.Grpc.IFileService Arp.System.Commons.Services.Io.Grpc.IFileSystemInfoService Arp.System.Lm.Services.Grpc.ILicenseStatusService Arp.System.Nm.Services.Grpc.INotificationManagerService Arp.System.Security.Services.Grpc.IAuthenticationService Arp.System.Um.Services.Grpc.IAuthorizationInfoService Arp.System.Um.Services.Grpc.IPasswordAuthenticationService grpc.reflection.v1.ServerReflection grpc.reflection.v1alpha.ServerReflection
-
(선택 사항) 이후 grpcurl 명령을 단순화하기 위한 별칭 생성:
alias grpcurl="podman run -it --rm -v /run/plcnext/:/run/plcnext/ --userns=keep-id docker.io/fullstorydev/grpcurl:latest-alpine"
-
PLCnext Control 장치에서 보드 온도 조회:
grpcurl -format json -d '{"identifier":"Status.Board.Temperature.Centigrade"}' --plaintext unix:///run/plcnext/grpc.sock Arp.Device.Interface.Services.Grpc.IDeviceStatusService.GetItem
응답:
{ "_ReturnValue": { "TypeCode": "CT_Int8", "Int8Value": 46 } }
참고:
Makers Blog는 Phoenix Contact에서 테스트하거나 검토하지 않은 커뮤니티 구성원의 애플리케이션과 사용자 스토리를 보여줍니다. 자신의 책임 하에 사용하세요.