- actions[instruction['order']] = ('out', out_port)
-
- elif 'strip-vlan-action' in instruction:
- actions[instruction['order']] = ('vlan', None)
-
- elif 'set-field' in instruction:
- if not ('vlan-match' in instruction['set-field'] and
- 'vlan-id' in instruction['set-field']['vlan-match'] and
- 'vlan-id' in instruction['set-field']['vlan-match']['vlan-id']):
- raise OpenflowConnUnexpectedResponse("unexpected openflow response, one or more elements "
- "are missing. Wrong version?")
-
- actions[instruction['order']] = ('vlan',
- instruction['set-field']['vlan-match']['vlan-id']['vlan-id'])
+ actions[instruction["order"]] = ("out", out_port)
+ elif "strip-vlan-action" in instruction:
+ actions[instruction["order"]] = ("vlan", None)
+ elif "set-field" in instruction:
+ if not (
+ "vlan-match" in instruction["set-field"]
+ and "vlan-id" in instruction["set-field"]["vlan-match"]
+ and "vlan-id"
+ in instruction["set-field"]["vlan-match"]["vlan-id"]
+ ):
+ raise OpenflowConnUnexpectedResponse(
+ "unexpected openflow response, one or more elements "
+ "are missing. Wrong version?"
+ )
+
+ actions[instruction["order"]] = (
+ "vlan",
+ instruction["set-field"]["vlan-match"]["vlan-id"][
+ "vlan-id"
+ ],
+ )