Add lpm match
This commit is contained in:
@@ -40,14 +40,17 @@ class L3Switch(app_manager.RyuApp):
|
||||
ofproto.OFPCML_NO_BUFFER)]
|
||||
self.add_flow(datapath, 0, match, actions)
|
||||
|
||||
self.logger.info("Add new action for: ")
|
||||
self.logger.info(datapath.id)
|
||||
# Routing Switch 2 to 1
|
||||
if datapath.id == 2:
|
||||
actions = [parser.OFPActionDecNwTtl(), #decrease TTL count
|
||||
parser.OFPActionSetField(eth_src=self.MAC_ADDR[1]), # set own mac as source
|
||||
parser.OFPActionSetField(eth_dst=self.MAC_ADDR[0]), # set dst switch
|
||||
parser.OFPActionOutput(1)]
|
||||
|
||||
match = parser.OFPMatch(ipv4_src="10.0.4.0/30", ipv4_dst="0.0.0.0", eth_type=0x0800)
|
||||
|
||||
match = parser.OFPMatch(ipv4_src=("10.0.4.1", "255.255.255.252"), ipv4_dst=("10.0.1.1", "255.255.255.240"), eth_type=0x0800)
|
||||
#match = parser.OFPMatch(ipv4_src="10.0.4.1", ipv4_dst="10.0.1.1", eth_type=0x0800)
|
||||
self.add_flow(datapath, 0, match, actions)
|
||||
|
||||
def add_flow(self, datapath, priority, match, actions, buffer_id=None):
|
||||
@@ -182,7 +185,7 @@ class L3Switch(app_manager.RyuApp):
|
||||
pkt = packet.Packet()
|
||||
pkt.add_protocol(ethernet.ethernet(ethertype=pkt_ethernet.ethertype,
|
||||
dst=pkt_ethernet.src,
|
||||
src=dpid))
|
||||
src=self.MAC_ADDR[dpid]))
|
||||
pkt.add_protocol(ipv4.ipv4(dst=pkt_ipv4.src,
|
||||
src=pkt_ipv4.dst,
|
||||
proto=pkt_ipv4.proto))
|
||||
@@ -298,7 +301,7 @@ class L3Switch(app_manager.RyuApp):
|
||||
|
||||
|
||||
self.logger.info("packet in dpid: %s, src: %s, dest: %s, in_port: %s", dpid, src, dst, in_port)
|
||||
|
||||
self.logger.info(pkt)
|
||||
#learn mac to port mapping
|
||||
if src not in self.mac_to_port[dpid]:
|
||||
self.mac_to_port[dpid][src] = in_port
|
||||
|
Reference in New Issue
Block a user