Beispiel #1
0
 def decode_entry(self, json):
     e = TableEntry()
     for (k, v) in json.iteritems():
         if k == "match":
             e.match = self.decode_match(v)
         elif k == "actions":
             e.actions = [self.decode_action(a) for a in v]
         else:
             setattr(e, k, v)
     return e
Beispiel #2
0
def GenerateACL():
    acl_rules = open(r'..\Data\acl3_4k_rules.txt')
    table = FlowTable()
    i = 3874
    while True:
        r = acl_rules.readline().split()
        if not r: break
        table.add_entry(
            TableEntry(priority=i,
                       cookie=0x1,
                       match=ofp_match(dl_src=EthAddr("00:00:00:00:00:01"),
                                       nw_src=r[0],
                                       nw_dst=r[1]),
                       actions=[ofp_action_output(port=5)]))
        #table.add_entry(TableEntry(priority=i, cookie=0x1, match=ofp_match(dl_src=EthAddr("00:00:00:00:00:01"),nw_src="53.45.14.183/32",nw_dst="18.184.25.126/32"), actions=[ofp_action_output(port=5)]))
        i = i - 1
    return table
Beispiel #3
0
 def installFlow(self, **kw):
   """ install flow in the local table and the associated switch """
   self.flow_table.install(TableEntry(**kw))
Beispiel #4
0
 def installFlow(self, **kw):
     """ install flow in the local table and the associated switch """
     #FELIPE TOMM - TCC
     print "OPENFLOW/TOPOLOGY.PY - OpenFlowSwitch - INSTALLFLOW"
     self.flow_table.install(TableEntry(**kw))