2017-08-30 114 views
0

我有平台和B平台,我想打电话平台上的RPC方法从平台B.注意我读过这个问题已经: In VOLTTRON, how to use VIP to get agents talk across remote platform instances? 我喜欢这种感觉可能已过时,因为它没有提及已知的hosts文件和新volttron-CTL任何身份验证添加接口。同时我还必须包括与serverkey的评论提到,大量的网址,秘密密钥参数?我也看了SimpleForwarder代码: https://github.com/VOLTTRON/volttron/blob/5cc71e9982338e242bf801da372aa66ed14abbd9/examples/SimpleForwarder/simpleforwarder/simpleforwarder.py 在这个例子中,VIP连接的网址是: “目的地VIP”:“IPC://@/tmp/v4home/run/vip.socket”, 但这与堆栈溢出问题中提供的答案不匹配。 http://volttron.readthedocs.io/en/4.1/core_services/messagebus/VIP/VIP-Authentication.html 本节的文档中提供了有关如何通过VIP认证,但需要什么样的步骤,这调用代理的RPC其他平台上的一些信息?有人能澄清什么是更新的方式做到这一点(为4.1 volttron),希望一步一步?在远程平台调用的方法@RPC

回答

2

调用上的远程代理的RPC调用非常相似,在其他平台上进行发布/订阅。对于工作的例子,你可以咨询DataMover剂调用远程历史学家的RPC方法。

首先,它得到serverkey为目标,如果它在已知的hosts文件:

hosts = KnownHostsStore() 
serverkey = hosts.serverkey(destination_vip) 

如果不是,它会从代理配置文件中得到它。

然后,它的historian_setup方法使用vip agent utils中的building_agent方法,通过传递地址,serverkey,public和secret密钥来创建到另一个平台的链接,因此您不必构造URL。

self._target_platform = build_agent(address=self.destination_vip, 
           serverkey=self.destination_serverkey, 
           publickey=self.core.publickey, 
           secretkey=self.core.secretkey, 
           enable_store=False) 

然后当它一发布呼吁:

self._target_platform.vip.rpc.call(
       self.destination_historian_identity, 'insert', 
       to_send).get(timeout=10) 

步骤执行这一过程是:

  1. 开始PlatformA与TargetAgent运行。
  2. 检索serverkey为PlatformA与:vctl auth serverkey
  3. 开始PlatformB
  4. 添加PlatformA已知上PlatformB主机:vctl add-known-host --host tcp://tcp://xxx.xxx.xxx.xxx:YYYY --serverkey SERVERKEY_FOR_A 或 配置SendingAgent与serverkey PlatformB从步骤2,目的地VIP地址PlatformA(TCP:/ /xxx.xxx.xxx.xxx:YYYY)

  5. 上PlatformB

    安装SendingAgent
  6. 检索要SendingAgent用公钥:vctl auth publickey
  7. 添加SendingAgent的凭据PlatformA有:vctl auth add

SendingAgent现在应该能够呼吁TargetAgent RPC方法

+0

你需要PlatformA运行的代理,你需要身份验证设置发件人在第7步PlatformA只是在监听它的VIP地址 –

相关问题