2017-08-30 115 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地址 –

相關問題