Hi Justin,
I did try the following
flow_mod['in_port']
flow_mod['dst']
flow_mod['actions']
TypeError: string indices must be integers, not str
It seems to me that it is treated as a string rather than an integer.
Any thoughts,
Regards,
Karthik.
On 12 October 2014 17:58, Justin Karneges jus...@affinix.com wrote:
Maybe you mean flow_mod['in_port'] ?
On Sat, Oct 11, 2014, at 08:23 PM, Karthik Sharma wrote:
Hi Justin,
Thanks for the reply.That did work!
I have a follow on question.
I am tying to send the following structure.
msg = {'in_port':in_port,'dst':dst,'actions':actions}
self.push_messages(msg)
However on the recieving side,I can decode the msg using format(msg) but I
can acess the members in the dictionary.
print('flow_mod recieved from ryu-primary {}'.format(flow_mod[in_port]))
- flow_mod recieved from ryu-primary {'dst':
u'00:00:00:00:00:04', 'actions': [OFPActionOutput(max_len=65509,port=2)],
'in_port': 1}
self.add_flow(datapath, flow_mod[in_port], flow_mod[dst],
flow_mod[actions])
--- doesn't work? -- gives error NameError: global name
'in_port' is not defined
Regards,
Karthik.
On 12 October 2014 12:31, Justin Karneges jus...@affinix.com wrote:
Hi Karthik,
You need to subscribe to a topic, not merely connect. You can subscribe to
an empty string to receive all messages. E.g.:
sub_socket.setsockopt(zmq.SUBSCRIBE, '')
On Sat, Oct 11, 2014, at 04:16 PM, Karthik Sharma wrote:
I want to establish publish subscribe communication between to
machines.The two machines that I have are
`ryu-primary` and `ryu-secondary`
The steps I follow in each of the machines are as follows.In the
initializer for `ryu-primary` (IP address is 192.168.241.131)
self.context = zmq.Context()
self.sub_socket = self.context.socket(zmq.SUB)
self.pub_socket = self.context.socket(zmq.PUB)
self.pub_port = 5566
self.sub_port = 5566
def establish_zmq_connection(self):
# Socket to talk to server
print Connection to ryu-secondary...
self.sub_socket.connect (tcp://192.168.241.132:%s %
self.sub_port)
def listen_zmq_connection(self):
print('Listen to zmq connection')
self.pub_socket.bind(tcp://*:%s % self.pub_port)
def recieve_messages(self):
while True:
try:
string = self.sub_socket.recv(flags=zmq.NOBLOCK)
print('flow mod messages recieved {}'.format(string))
return string
except zmq.ZMQError:
break
def push_messages(self,msg):
self.pub_socket.send(%s % (msg))
From ryu-secondary (IP address - 192.168.241.132)
In the initializer
self.context = zmq.Context()
self.sub_socket = self.context.socket(zmq.SUB)
self.pub_socket = self.context.socket(zmq.PUB)
self.pub_port = 5566
self.sub_port = 5566
def establish_zmq_connection(self):
# Socket to talk to server
print Connection to ryu-secondary...
self.sub_socket.connect (tcp://192.168.241.131:%s %
self.sub_port)
def listen_zmq_connection(self):
print('Listen to zmq connection')
self.pub_socket.bind(tcp://*:%s % self.pub_port)
def recieve_messages(self):
while True:
try:
string = self.sub_socket.recv(flags=zmq.NOBLOCK)
print('flow mod messages recieved
{}'.format(string))
return string
except zmq.ZMQError:
break
def push_messages(self,msg):
print('pushing message to publish socket')
self.pub_socket.send(%s % (msg))
These are the functions that I have.
I am calling
establish_zmq_connections()
push_messages()
from `ryu-secondary`,
But I am not recieving those messages when I am calling
listen_zmq_connection()
recieve_messages()
from `ryu-primary`.
Can someone point out to me what I am doing wrong?
*___*
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev