Skip to content

Commit 24ad916

Browse files
committed
Rework traffic-rules
Previous implementation did not take how VLANs are configured into account, this lead to a pretty hefty change. VLANs use a fake bridge, which is then included in a parent bridge. While packets remain within this bridge, they are not tagged, so the vlanid cannot be used to match packets in the OVS datapath. The only workaround is to create rules for each port. However, this means that rules for untagged traffic, as previously implemented, will also apply to VLAN ports. Therefore, we must apply rules to each matching port in all cases, and create a rule on the uplink ports that matches accordingly. Changes summary: - Refactored to improve clarity and error handling - Added update_args_from_ovs() to dynamically gather bridge, VLAN, and port info from OVS. - Changed ip_range to ipRange that XO plugin is using - Replaced single rule building with per-port rule, as well as matching on VLAN for uplink ports - Updated tests to match the refactor - Added tests for update_args_from_ovs() - Mocked OVS command calls in tests for more accurate validation. Signed-off-by: David Morel <[email protected]>
1 parent f9a0d07 commit 24ad916

File tree

5 files changed

+1071
-688
lines changed

5 files changed

+1071
-688
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,9 @@ Parameters for adding a rule:
348348
- *priority* (optional): A number between 0 and 65535 for the rule priority.
349349
- *mac* (optional): The MAC address of the VIF to create the rule for, if not
350350
specified, a network-wide rule will be created.
351-
- *iprange*: An IP or range of IPs in CIDR notation, for example `192.168.1.0/24`.
351+
- *ipRange*: An IP or range of IPs in CIDR notation, for example `192.168.1.0/24`.
352352
- *direction*: can be **from**, **to** or **from/to**
353-
- *to*: means the parameters for **port** and **iprange** are to be used as destination
353+
- *to*: means the parameters for **port** and **ipRange** are to be used as destination
354354
- *from*: means they will be use as source
355355
- *from/to*: 2 rules will be created, one per direction
356356
- *protocol*: IP, TCP, UDP, ICMP or ARP
@@ -363,7 +363,7 @@ $ xe host-call-plugin host-uuid<uuid> plugin=sdncontroller.py \
363363
args:bridge="xenbr0" \
364364
args:priority="100" \
365365
args:mac="6e:0b:9e:72:ab:c6" \
366-
args:iprange="192.168.1.0/24" \
366+
args:ipRange="192.168.1.0/24" \
367367
args:direction="from/to" \
368368
args:protocol="tcp" \
369369
args:port="22" \
@@ -375,9 +375,9 @@ $ xe host-call-plugin host-uuid<uuid> plugin=sdncontroller.py \
375375
Parameters for removing a rule:
376376
- *bridge* : The name of the bridge to delete the rule from.
377377
- *mac* (optional): The MAC address of the VIF to delete the rule for.
378-
- *iprange*: An IP or range of IPs in CIDR notation, for example `192.168.1.0/24`.
378+
- *ipRange*: An IP or range of IPs in CIDR notation, for example `192.168.1.0/24`.
379379
- *direction*: can be **from**, **to** or **from/to**
380-
- *to*: means the parameters for **port** and **iprange** are to be used as destination
380+
- *to*: means the parameters for **port** and **ipRange** are to be used as destination
381381
- *from*: means they will be use as source
382382
- *from/to*: 2 rules will be created, one per direction
383383
- *protocol*: IP, TCP, UDP, ICMP or ARP
@@ -388,7 +388,7 @@ $ xe host-call-plugin host-uuid<uuid> plugin=sdncontroller.py \
388388
fn=del-rule \
389389
args:bridge="xenbr0" \
390390
args:mac="6e:0b:9e:72:ab:c6" \
391-
args:iprange="192.168.1.0/24" \
391+
args:ipRange="192.168.1.0/24" \
392392
args:direction="from/to" \
393393
args:protocol="tcp" \
394394
args:port="22"

0 commit comments

Comments
 (0)