Skip to content

Update simple_switch_13.py#148

Open
c1x1x00xxPentium wants to merge 2 commits intofaucetsdn:masterfrom
c1x1x00xxPentium:patch-1
Open

Update simple_switch_13.py#148
c1x1x00xxPentium wants to merge 2 commits intofaucetsdn:masterfrom
c1x1x00xxPentium:patch-1

Conversation

@c1x1x00xxPentium
Copy link

Dear Community,
I made a few changes to make it easier to understand the value of the variable 'mac_to_port' and also provide an example of how to custom OFPFlowMod.

self.logger.info(json.dumps(self.mac_to_port, sort_keys=True, indent=4))

def add_flow(self, datapath, priority, tableID=0, idle=0, hard=0, match, actions, buffer_id=None):
      ofproto = datapath.ofproto
      parser = datapath.ofproto_parser
      
      if buffer_id:
          mod = parser.OFPFlowMod(datapath=datapath, buffer_id=buffer_id,
                                  priority=priority, match=match,
                                  idle_timeout=idle, hard_timeout=hard,
                                  instructions=inst, table_id=tableID)
      else:
          mod = parser.OFPFlowMod(datapath=datapath, priority=priority,
                                  idle_timeout=idle, hard_timeout=hard,
                                  match=match, instructions=inst
                                  table_id=tableID)
      datapath.send_msg(mod)

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant