support for port based identification of olt device
diff --git a/olt.py b/olt.py
index 5a91ea5..664365a 100644
--- a/olt.py
+++ b/olt.py
@@ -8,6 +8,7 @@
import ofp
import time
+import copy
from oftest.testutils import *
@@ -87,10 +88,13 @@
pkt = str(parsed_pkt)
- request = ofp.message.flow_add(
+ for of_port in config["port_map"]:
+ m = copy.deepcopy(match)
+ m.oxm_list.append(ofp.oxm.in_port(of_port))
+ request = ofp.message.flow_add(
table_id=test_param_get("table", 0),
cookie=42,
- match=match,
+ match=m,
instructions=[
ofp.instruction.apply_actions(
actions=[
@@ -99,11 +103,10 @@
max_len=ofp.OFPCML_NO_BUFFER)])],
buffer_id=ofp.OFP_NO_BUFFER,
priority=1000)
-
- logging.info("Inserting flow sending matching packets to controller")
- self.controller.message_send(request)
- do_barrier(self.controller)
-
+ logging.info("Inserting flow sending matching packets to controller")
+ self.controller.message_send(request)
+ do_barrier(self.controller)
+
for of_port in config["port_map"]:
logging.info("PacketInExact test, port %d", of_port)
self.dataplane.send(of_port, pkt)
@@ -139,29 +142,6 @@
testPacketIn(self, match, pkt)
-class DHCPPacketIn(base_tests.SimpleDataPlane):
-
- """Verify packet-ins are sent for DHCP packets """
-
- def runTest(self):
- logging.info("Running DHCP Packet In test")
-
- pkt = simple_udp_packet(udp_sport=68, udp_dport=67)
-
- match = ofp.match()
- match.oxm_list.append(ofp.oxm.eth_type(0x0800))
- match.oxm_list.append(ofp.oxm.ip_proto(17))
- match.oxm_list.append(ofp.oxm.udp_src(68))
- match.oxm_list.append(ofp.oxm.udp_dst(67))
-
- testPacketIn(self, match, pkt)
-
- # Other UDP packets should not match the rule
- radiusPkt = simple_udp_packet(udp_sport=1812, udp_dport=1812)
-
- self.dataplane.send(1, str(radiusPkt))
- verify_no_packet_in(self, radiusPkt, 1)
-
class IGMPPacketIn(base_tests.SimpleDataPlane):
"""Verify packet-ins are sent for IGMP packets """
@@ -184,7 +164,7 @@
def runTest(self):
logging.info("Running Meter tests")
- dropMeterBand = ofp.meter_band.drop(rate = 500)
+ dropMeterBand = ofp.meter_band.drop(rate = 64)
meter_mod = ofp.message.meter_mod(xid = 1, command = ofp.OFPMC_ADD, meter_id = 1, meters = [ dropMeterBand ])
self.controller.message_send(meter_mod)
@@ -239,10 +219,11 @@
inPkt = simple_udp_packet(dl_vlan_enable=True, vlan_vid=vlan_id, vlan_pcp=0)
# downstream
- self.dataplane.send(olt_port, str(inPkt))
- verify_packet(self, inPkt, onu_port)
+ #self.dataplane.send(olt_port, str(inPkt))
+ #verify_packet(self, inPkt, onu_port)
# upstream
- self.dataplane.send(onu_port, str(inPkt))
+ for i in range(1,400):
+ self.dataplane.send(onu_port, str(inPkt))
verify_packet(self, inPkt, olt_port)
# clean up the test
@@ -805,7 +786,7 @@
instructions=[
ofp.instruction.apply_actions(
actions=[
- ofp.action.push_vlan(ethertype=0x88A8),
+ ofp.action.push_vlan(ethertype=0x8100),
ofp.action.set_field(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | s_vlan_id)),
ofp.action.set_field(ofp.oxm.vlan_pcp(0)),
ofp.action.output(port=olt_port)]),