Update Aufgabe1.3

This commit is contained in:
2022-05-24 19:46:09 +00:00
parent f982395ae6
commit ee61f32e26

View File

@@ -53,6 +53,18 @@ class L3Switch(app_manager.RyuApp):
#match = parser.OFPMatch(ipv4_src="10.0.4.1", ipv4_dst="10.0.1.1", 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) self.add_flow(datapath, 0, match, actions)
# Routing Switch 1 to 2
if datapath.id == 1:
actions = [parser.OFPActionDecNwTtl(), #decrease TTL count
parser.OFPActionSetField(eth_src=self.MAC_ADDR[0]), # set own mac as source
parser.OFPActionSetField(eth_dst=self.MAC_ADDR[1]), # set dst switch
parser.OFPActionOutput(4)]
match = parser.OFPMatch(ipv4_dst=("10.0.4.1", "255.255.255.252"), eth_type=0x0800)
self.add_flow(datapath, 0, match, actions)
def add_flow(self, datapath, priority, match, actions, buffer_id=None): def add_flow(self, datapath, priority, match, actions, buffer_id=None):
ofproto = datapath.ofproto ofproto = datapath.ofproto
parser = datapath.ofproto_parser parser = datapath.ofproto_parser