indenting
diff --git a/olt.py b/olt.py
index 12232f4..96851ee 100644
--- a/olt.py
+++ b/olt.py
@@ -931,7 +931,7 @@
def testPacketFlow(self):
(s_vlan_id, c_vlan_id) = self.vlan_pairs
-
+
incorrectTagPkt = simple_udp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=100, vlan_pcp=0)
untaggedPkt = simple_udp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=0, vlan_pcp=0)
@@ -962,98 +962,98 @@
verify_no_packet(self, upstreamDoubleTaggedPkt, olt_port)
-def installDoubleTaggingRule(self, s_vlan_id, c_vlan_id):
- # upstream flow rule
- match = ofp.match()
- match.oxm_list.append(ofp.oxm.in_port(onu_port))
- match.oxm_list.append(ofp.oxm.vlan_vid(value=ofp.OFPVID_PRESENT))
- match.oxm_list.append(ofp.oxm.vlan_pcp(value=0))
- self.cookie += 1
+ def installDoubleTaggingRule(self, s_vlan_id, c_vlan_id):
+ # upstream flow rule
+ match = ofp.match()
+ match.oxm_list.append(ofp.oxm.in_port(onu_port))
+ match.oxm_list.append(ofp.oxm.vlan_vid(value=ofp.OFPVID_PRESENT))
+ match.oxm_list.append(ofp.oxm.vlan_pcp(value=0))
+ self.cookie += 1
- # push inner vlan (c-vlan) for upstream
- request = ofp.message.flow_add(
- table_id=test_param_get("table", 0),
- cookie=self.cookie,
- match=match,
- instructions=[
- ofp.instruction.apply_actions(
- actions=[
- ofp.action.set_field(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | c_vlan_id))]),
- ofp.instruction.goto_table(1)],
- buffer_id=ofp.OFP_NO_BUFFER,
- priority=1000)
+ # push inner vlan (c-vlan) for upstream
+ request = ofp.message.flow_add(
+ table_id=test_param_get("table", 0),
+ cookie=self.cookie,
+ match=match,
+ instructions=[
+ ofp.instruction.apply_actions(
+ actions=[
+ ofp.action.set_field(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | c_vlan_id))]),
+ ofp.instruction.goto_table(1)],
+ buffer_id=ofp.OFP_NO_BUFFER,
+ priority=1000)
- self.controller.message_send(request)
- do_barrier(self.controller)
- verify_no_errors(self.controller)
+ self.controller.message_send(request)
+ do_barrier(self.controller)
+ verify_no_errors(self.controller)
- # push outer vlan (s-vlan) for upstream
- match = ofp.match()
- match.oxm_list.append(ofp.oxm.in_port(onu_port))
- match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | c_vlan_id))
- match.oxm_list.append(ofp.oxm.vlan_pcp(0))
- self.cookie += 1
+ # push outer vlan (s-vlan) for upstream
+ match = ofp.match()
+ match.oxm_list.append(ofp.oxm.in_port(onu_port))
+ match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | c_vlan_id))
+ match.oxm_list.append(ofp.oxm.vlan_pcp(0))
+ self.cookie += 1
- request = ofp.message.flow_add(
- table_id=test_param_get("table", 1),
- cookie=self.cookie,
- match=match,
- instructions=[
- ofp.instruction.apply_actions(
- actions=[
- 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)]),
- ],
- buffer_id=ofp.OFP_NO_BUFFER,
- priority=1000)
+ request = ofp.message.flow_add(
+ table_id=test_param_get("table", 1),
+ cookie=self.cookie,
+ match=match,
+ instructions=[
+ ofp.instruction.apply_actions(
+ actions=[
+ 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)]),
+ ],
+ buffer_id=ofp.OFP_NO_BUFFER,
+ priority=1000)
- self.controller.message_send(request)
- do_barrier(self.controller)
- verify_no_errors(self.controller)
- self.cookie += 1
+ self.controller.message_send(request)
+ do_barrier(self.controller)
+ verify_no_errors(self.controller)
+ self.cookie += 1
- # strip outer vlan (s-vlan) for downstream
- match = ofp.match()
- match.oxm_list.append(ofp.oxm.in_port(olt_port))
- match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | s_vlan_id))
- match.oxm_list.append(ofp.oxm.vlan_pcp(0))
- request = ofp.message.flow_add(
- table_id=test_param_get("table", 0),
- cookie=self.cookie,
- match=match,
- instructions=[
- ofp.instruction.apply_actions(
- actions=[ofp.action.pop_vlan()]),
- ofp.instruction.goto_table(1)],
- buffer_id=ofp.OFP_NO_BUFFER,
- priority=1000)
+ # strip outer vlan (s-vlan) for downstream
+ match = ofp.match()
+ match.oxm_list.append(ofp.oxm.in_port(olt_port))
+ match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | s_vlan_id))
+ match.oxm_list.append(ofp.oxm.vlan_pcp(0))
+ request = ofp.message.flow_add(
+ table_id=test_param_get("table", 0),
+ cookie=self.cookie,
+ match=match,
+ instructions=[
+ ofp.instruction.apply_actions(
+ actions=[ofp.action.pop_vlan()]),
+ ofp.instruction.goto_table(1)],
+ buffer_id=ofp.OFP_NO_BUFFER,
+ priority=1000)
- self.controller.message_send(request)
- do_barrier(self.controller)
- verify_no_errors(self.controller)
+ self.controller.message_send(request)
+ do_barrier(self.controller)
+ verify_no_errors(self.controller)
- # rewrite inner vlan (c-vlan) to default (0) for downstream
- match = ofp.match()
- match.oxm_list.append(ofp.oxm.in_port(olt_port))
- match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | c_vlan_id))
- match.oxm_list.append(ofp.oxm.vlan_pcp(0))
- self.cookie += 1
+ # rewrite inner vlan (c-vlan) to default (0) for downstream
+ match = ofp.match()
+ match.oxm_list.append(ofp.oxm.in_port(olt_port))
+ match.oxm_list.append(ofp.oxm.vlan_vid(ofp.OFPVID_PRESENT | c_vlan_id))
+ match.oxm_list.append(ofp.oxm.vlan_pcp(0))
+ self.cookie += 1
- request = ofp.message.flow_add(
- table_id=test_param_get("table", 1),
- cookie=self.cookie,
- match=match,
- instructions=[
- ofp.instruction.apply_actions(
- actions=[
- ofp.action.pop_vlan(),
- ofp.action.output(port=onu_port)])
- ],
- buffer_id=ofp.OFP_NO_BUFFER,
- priority=1000)
+ request = ofp.message.flow_add(
+ table_id=test_param_get("table", 1),
+ cookie=self.cookie,
+ match=match,
+ instructions=[
+ ofp.instruction.apply_actions(
+ actions=[
+ ofp.action.pop_vlan(),
+ ofp.action.output(port=onu_port)])
+ ],
+ buffer_id=ofp.OFP_NO_BUFFER,
+ priority=1000)
- self.controller.message_send(request)
- do_barrier(self.controller)
- verify_no_errors(self.controller)
+ self.controller.message_send(request)
+ do_barrier(self.controller)
+ verify_no_errors(self.controller)