X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=src%2Femuvim%2Fdcemulator%2Fnet.py;h=36fc92185fc592c4abbad4d34bfbfb0030e5b3d9;hb=898a2af8cc32f6814fa3a0971ef71f4936f42171;hp=3ded28ec70009b1a2e9648ccb7b23bc90322b4f7;hpb=23c480906da46931b6f4350f3fb434a89f49227a;p=osm%2Fvim-emu.git diff --git a/src/emuvim/dcemulator/net.py b/src/emuvim/dcemulator/net.py index 3ded28e..36fc921 100755 --- a/src/emuvim/dcemulator/net.py +++ b/src/emuvim/dcemulator/net.py @@ -306,10 +306,11 @@ class DCNetwork(Dockernet): # TODO this only sets port in to out, no match, so this will give trouble when multiple services are deployed... # TODO need multiple matches to do this (VLAN tags) if isinstance( current_node, OVSSwitch ): + cookie = kwargs.get('cookie') match_input = kwargs.get('match') - self._set_flow_entry_dpctl(current_node, switch_inport_nr, switch_outport_nr, match_input, cmd) + self._set_flow_entry_dpctl(current_node, switch_inport_nr, switch_outport_nr, match_input, cmd, cookie) if kwargs.get('bidirectional'): - self._set_flow_entry_dpctl(current_node, switch_outport_nr, switch_inport_nr, match_input, cmd) + self._set_flow_entry_dpctl(current_node, switch_outport_nr, switch_inport_nr, match_input, cmd, cookie) ''' match = 'in_port=%s' % switch_inport_nr #add additional match entries from the argument @@ -340,18 +341,19 @@ class DCNetwork(Dockernet): return "path added between {0} and {1}".format(vnf_src_name, vnf_dst_name) #return "destination node: {0} not reached".format(vnf_dst_name) - def _set_flow_entry_dpctl(self, node, switch_inport_nr, switch_outport_nr, match_input, cmd): + def _set_flow_entry_dpctl(self, node, switch_inport_nr, switch_outport_nr, match_input, cmd, cookie): match = 'in_port=%s' % switch_inport_nr # add additional match entries from the argument #match_input = kwargs.get('match') # logging.info('match input:{0}'.format(match_input)) + s = ',' + if cookie: + cookie = 'cookie=%s' % cookie + match = s.join([cookie, match]) if match_input: - s = ',' match = s.join([match, match_input]) - if cmd == 'add-flow': action = 'action=%s' % switch_outport_nr - s = ',' ofcmd = s.join([match, action]) elif cmd == 'del-flows': ofcmd = match