tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

P4Runtime: gRPC Error Name resolution failure (UNAVAILABLE)

Open rafaelsilvag opened this issue 5 years ago • 0 comments

After the error below, I tried to modify the p4runtime_lib/switch.py as follows:

P4 switch s1 has been started.
Traceback (most recent call last):
  File "/p4app/main.py", line 461, in <module>
    main()
  File "/p4app/main.py", line 415, in main
    net = config_network(bw, method, n, is_fabric)
  File "/p4app/main.py", line 135, in config_network
    net.start()
  File "/scripts/p4app.py", line 100, in start
    Mininet.start(self, *args, **kwargs)
  File "build/bdist.linux-x86_64/egg/mininet/net.py", line 548, in start
  File "/scripts/p4_mininet.py", line 353, in start
    proto_dump_file='/tmp/p4app-logs/' + self.name + '-p4runtime-requests.txt')
  File "/scripts/p4runtime_lib/switch.py", line 45, in __init__
    self.client_stub = p4runtime_pb2.P4RuntimeStub(self.channel)
AttributeError: 'module' object has no attribute 'P4RuntimeStub'
--- PolKA/emulation/docker/scripts/p4runtime_lib/switch.py	2020-03-03 17:16:27.661108093 +0000
+++ ../PolKA/emulation/docker/scripts/p4runtime_lib/switch.py	2020-03-03 17:14:12.222928166 +0000
@@ -18,6 +18,7 @@
 
 import grpc
 from p4.v1 import p4runtime_pb2
+from p4.v1 import p4runtime_pb2_grpc
 from p4.tmp import p4config_pb2
 
 MSG_LOG_MAX_LEN = 1024
@@ -41,7 +42,7 @@
         if proto_dump_file is not None:
             interceptor = GrpcRequestLogger(proto_dump_file)
             self.channel = grpc.intercept_channel(self.channel, interceptor)
-        self.client_stub = p4runtime_pb2.P4RuntimeStub(self.channel)
+        self.client_stub = p4runtime_pb2_grpc.P4RuntimeStub(self.channel)
         self.requests_stream = IterableQueue()

After this modification, it has popped up an error about gRPC Name Resolution failure as follows:

*** Starting 10 switches
s1 Starting P4 switch s1.
simple_switch -i 1@s1-eth1 -i 2@s1-eth2 -i 3@s1-eth3 --nanolog ipc:///tmp/bm-0-log.ipc --device-id 0 /tmp/p4app-logs/polka.json --thrift-port 9090
P4 switch s1 has been started.
gRPC Error Name resolution failure (UNAVAILABLE) [/scripts/p4_mininet.py:356]
gRPC Error Name resolution failure (UNAVAILABLE) [/scripts/p4_mininet.py:387]
s2 Starting P4 switch s2.
simple_switch -i 1@s2-eth1 -i 2@s2-eth2 -i 3@s2-eth3 --nanolog ipc:///tmp/bm-1-log.ipc --device-id 1 /tmp/p4app-logs/polka.json --thrift-port 9091
P4 switch s2 has been started.

rafaelsilvag avatar Mar 03 '20 17:03 rafaelsilvag