Skip to content

Commit d2d1399

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 <david.morel@vates.tech>
1 parent 1cd759c commit d2d1399

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
@@ -350,9 +350,9 @@ Parameters for adding a rule:
350350
- *priority* (optional): A number between 0 and 65535 for the rule priority.
351351
- *mac* (optional): The MAC address of the VIF to create the rule for, if not
352352
specified, a network-wide rule will be created.
353-
- *iprange*: An IP or range of IPs in CIDR notation, for example `192.168.1.0/24`.
353+
- *ipRange*: An IP or range of IPs in CIDR notation, for example `192.168.1.0/24`.
354354
- *direction*: can be **from**, **to** or **from/to**
355-
- *to*: means the parameters for **port** and **iprange** are to be used as destination
355+
- *to*: means the parameters for **port** and **ipRange** are to be used as destination
356356
- *from*: means they will be use as source
357357
- *from/to*: 2 rules will be created, one per direction
358358
- *protocol*: IP, TCP, UDP, ICMP or ARP
@@ -365,7 +365,7 @@ $ xe host-call-plugin host-uuid<uuid> plugin=sdncontroller.py \
365365
args:bridge="xenbr0" \
366366
args:priority="100" \
367367
args:mac="6e:0b:9e:72:ab:c6" \
368-
args:iprange="192.168.1.0/24" \
368+
args:ipRange="192.168.1.0/24" \
369369
args:direction="from/to" \
370370
args:protocol="tcp" \
371371
args:port="22" \
@@ -377,9 +377,9 @@ $ xe host-call-plugin host-uuid<uuid> plugin=sdncontroller.py \
377377
Parameters for removing a rule:
378378
- *bridge* : The name of the bridge to delete the rule from.
379379
- *mac* (optional): The MAC address of the VIF to delete the rule for.
380-
- *iprange*: An IP or range of IPs in CIDR notation, for example `192.168.1.0/24`.
380+
- *ipRange*: An IP or range of IPs in CIDR notation, for example `192.168.1.0/24`.
381381
- *direction*: can be **from**, **to** or **from/to**
382-
- *to*: means the parameters for **port** and **iprange** are to be used as destination
382+
- *to*: means the parameters for **port** and **ipRange** are to be used as destination
383383
- *from*: means they will be use as source
384384
- *from/to*: 2 rules will be created, one per direction
385385
- *protocol*: IP, TCP, UDP, ICMP or ARP
@@ -390,7 +390,7 @@ $ xe host-call-plugin host-uuid<uuid> plugin=sdncontroller.py \
390390
fn=del-rule \
391391
args:bridge="xenbr0" \
392392
args:mac="6e:0b:9e:72:ab:c6" \
393-
args:iprange="192.168.1.0/24" \
393+
args:ipRange="192.168.1.0/24" \
394394
args:direction="from/to" \
395395
args:protocol="tcp" \
396396
args:port="22"

0 commit comments

Comments
 (0)