Skip to content

Commit

Permalink
vrrp conformance tests WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
rwestphal committed Jan 10, 2025
1 parent 05b3b3f commit d9ec5de
Show file tree
Hide file tree
Showing 9 changed files with 254 additions and 0 deletions.
10 changes: 10 additions & 0 deletions holo-vrrp/tests/conformance/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//
// Copyright (c) The Holo Core Contributors
//
// SPDX-License-Identifier: MIT
//
// Sponsored by NLnet as part of the Next Generation Internet initiative.
// See: https://nlnet.nl/NGI0
//

mod topologies;
20 changes: 20 additions & 0 deletions holo-vrrp/tests/conformance/topologies/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// Copyright (c) The Holo Core Contributors
//
// SPDX-License-Identifier: MIT
//
// Sponsored by NLnet as part of the Next Generation Internet initiative.
// See: https://nlnet.nl/NGI0
//

use holo_protocol::test::stub::run_test_topology;
use holo_vrrp::interface::Interface;

#[tokio::test]
async fn topology1_1() {
for rt_num in 1..=3 {
let rt_name = format!("rt{}", rt_num);
run_test_topology::<Interface>("topo1-1", &rt_name).await;
//run_test_topology::<Interface>("topo1-1", "eth-sw1", &rt_name).await;
}
}
51 changes: 51 additions & 0 deletions holo-vrrp/tests/conformance/topologies/topo1-1/rt1/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"ietf-interfaces:interfaces": {
"interface": [
{
"name": "eth-sw1",
"type": "iana-if-type:ethernetCsmacd",
"ietf-ip:ipv4": {
"address": [
{
"ip": "10.0.1.2",
"prefix-length": 24
}
],
"ietf-vrrp:vrrp": {
"vrrp-instance": [
{
"vrid": 1,
"log-state-change": true,
"preempt": {
"enabled": false
},
"priority": 20,
"advertise-interval-sec": 1,
"virtual-ipv4-addresses": {
"virtual-ipv4-address": [
{
"ipv4-address": "10.0.1.5"
}
]
}
}
]
}
}
},
{
"name": "lo",
"type": "iana-if-type:softwareLoopback",
"ietf-ip:ipv4": {
"address": [
{
"ip": "2.2.2.2",
"prefix-length": 32
}
]
}
}
]
}
}

19 changes: 19 additions & 0 deletions holo-vrrp/tests/conformance/topologies/topo1-1/rt1/events.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{"Ibus":{"InterfaceQuery":{"ifname":"eth-sw1","af":"Ipv4"}}}
{"Northbound":{"Commit":{"phase":"Prepare","old_config":"{}","new_config":"{\"ietf-interfaces:interfaces\":{\"interface\":[{\"name\":\"eth-sw1\",\"type\":\"iana-if-type:ethernetCsmacd\",\"ietf-ip:ipv4\":{\"address\":[{\"ip\":\"10.0.1.1\",\"prefix-length\":24}],\"ietf-vrrp:vrrp\":{\"vrrp-instance\":[{\"vrid\":1,\"log-state-change\":true,\"preempt\":{\"enabled\":false},\"priority\":10,\"virtual-ipv4-addresses\":{\"virtual-ipv4-address\":[{\"ipv4-address\":\"10.0.1.5\"}]}}]}}},{\"name\":\"lo\",\"type\":\"iana-if-type:softwareLoopback\",\"ietf-ip:ipv4\":{\"address\":[{\"ip\":\"1.1.1.1\",\"prefix-length\":32}]}}]}}","changes":[[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance","operation":"Create"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']"],[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance/log-state-change","operation":"Modify"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']/log-state-change"],[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance/preempt/enabled","operation":"Modify"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']/preempt/enabled"],[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance/priority","operation":"Modify"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']/priority"],[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance/virtual-ipv4-addresses/virtual-ipv4-address","operation":"Create"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']/virtual-ipv4-addresses/virtual-ipv4-address[ipv4-address='10.0.1.5']"]]}}}
{"Ibus":{"InterfaceQuery":{"ifname":"lo","af":"Ipv4"}}}
{"Ibus":{"InterfaceUpd":{"ifname":"eth-sw1","ifindex":2,"mtu":1500,"flags":"OPERATIVE | BROADCAST"}}}
{"Ibus":{"InterfaceUpd":{"ifname":"lo","ifindex":1,"mtu":65536,"flags":"LOOPBACK | OPERATIVE"}}}
{"Northbound":{"Commit":{"phase":"Apply","old_config":"{}","new_config":"{\"ietf-interfaces:interfaces\":{\"interface\":[{\"name\":\"eth-sw1\",\"type\":\"iana-if-type:ethernetCsmacd\",\"ietf-ip:ipv4\":{\"address\":[{\"ip\":\"10.0.1.1\",\"prefix-length\":24}],\"ietf-vrrp:vrrp\":{\"vrrp-instance\":[{\"vrid\":1,\"log-state-change\":true,\"preempt\":{\"enabled\":false},\"priority\":10,\"virtual-ipv4-addresses\":{\"virtual-ipv4-address\":[{\"ipv4-address\":\"10.0.1.5\"}]}}]}}},{\"name\":\"lo\",\"type\":\"iana-if-type:softwareLoopback\",\"ietf-ip:ipv4\":{\"address\":[{\"ip\":\"1.1.1.1\",\"prefix-length\":32}]}}]}}","changes":[[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance","operation":"Create"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']"],[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance/log-state-change","operation":"Modify"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']/log-state-change"],[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance/preempt/enabled","operation":"Modify"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']/preempt/enabled"],[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance/priority","operation":"Modify"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']/priority"],[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance/virtual-ipv4-addresses/virtual-ipv4-address","operation":"Create"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']/virtual-ipv4-addresses/virtual-ipv4-address[ipv4-address='10.0.1.5']"]]}}}
{"Ibus":{"MacvlanAdd":{"parent_name":"eth-sw1","name":"mvlan-vrrp-1","mac_address":[0,0,94,0,1,1]}}}
{"Ibus":{"InterfaceAddressAdd":{"ifname":"eth-sw1","addr":"10.0.1.1/24","flags":""}}}
{"Ibus":{"RouterIdUpdate":"10.0.1.1"}}
{"Ibus":{"InterfaceAddressAdd":{"ifname":"lo","addr":"1.1.1.1/32","flags":""}}}
{"Ibus":{"RouterIdUpdate":"1.1.1.1"}}
{"Ibus":{"RouteRedistributeAdd":{"protocol":"direct","prefix":"10.0.1.0/24","distance":0,"metric":0,"tag":null,"nexthops":[{"Interface":{"ifindex":2}}]}}}
{"Ibus":{"RouteRedistributeAdd":{"protocol":"direct","prefix":"1.1.1.1/32","distance":0,"metric":0,"tag":null,"nexthops":[{"Interface":{"ifindex":1}}]}}}
{"Ibus":{"InterfaceUpd":{"ifname":"mvlan-vrrp-1","ifindex":3,"mtu":1500,"flags":"OPERATIVE | BROADCAST"}}}
{"Ibus":{"InterfaceAddressAdd":{"ifname":"mvlan-vrrp-1","addr":"fe80::200:5eff:fe00:101/64","flags":""}}}
{"Ibus":{"RouteRedistributeAdd":{"protocol":"direct","prefix":"fe80::/64","distance":0,"metric":0,"tag":null,"nexthops":[{"Interface":{"ifindex":2}}]}}}
{"Protocol":{"MasterDownTimer":{"vrid":1}}}
{"Ibus":{"InterfaceIpAddRequest":{"ifname":"mvlan-vrrp-1","addr":"10.0.1.5/32"}}}
{"Ibus":{"InterfaceAddressAdd":{"ifname":"mvlan-vrrp-1","addr":"10.0.1.5/32","flags":"UNNUMBERED"}}}
51 changes: 51 additions & 0 deletions holo-vrrp/tests/conformance/topologies/topo1-1/rt2/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"ietf-interfaces:interfaces": {
"interface": [
{
"name": "eth-sw1",
"type": "iana-if-type:ethernetCsmacd",
"ietf-ip:ipv4": {
"address": [
{
"ip": "10.0.1.1",
"prefix-length": 24
}
],
"ietf-vrrp:vrrp": {
"vrrp-instance": [
{
"vrid": 1,
"log-state-change": true,
"preempt": {
"enabled": false
},
"priority": 10,
"advertise-interval-sec": 1,
"virtual-ipv4-addresses": {
"virtual-ipv4-address": [
{
"ipv4-address": "10.0.1.5"
}
]
}
}
]
}
}
},
{
"name": "lo",
"type": "iana-if-type:softwareLoopback",
"ietf-ip:ipv4": {
"address": [
{
"ip": "1.1.1.1",
"prefix-length": 32
}
]
}
}
]
}
}

25 changes: 25 additions & 0 deletions holo-vrrp/tests/conformance/topologies/topo1-1/rt2/events.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{"Ibus":{"InterfaceQuery":{"ifname":"eth-sw1","af":"Ipv4"}}}
{"Northbound":{"Commit":{"phase":"Prepare","old_config":"{}","new_config":"{\"ietf-interfaces:interfaces\":{\"interface\":[{\"name\":\"eth-sw1\",\"type\":\"iana-if-type:ethernetCsmacd\",\"ietf-ip:ipv4\":{\"address\":[{\"ip\":\"10.0.1.2\",\"prefix-length\":24}],\"ietf-vrrp:vrrp\":{\"vrrp-instance\":[{\"vrid\":1,\"log-state-change\":true,\"preempt\":{\"enabled\":false},\"priority\":20,\"virtual-ipv4-addresses\":{\"virtual-ipv4-address\":[{\"ipv4-address\":\"10.0.1.5\"}]}}]}}},{\"name\":\"lo\",\"type\":\"iana-if-type:softwareLoopback\",\"ietf-ip:ipv4\":{\"address\":[{\"ip\":\"2.2.2.2\",\"prefix-length\":32}]}}]}}","changes":[[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance","operation":"Create"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']"],[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance/log-state-change","operation":"Modify"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']/log-state-change"],[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance/preempt/enabled","operation":"Modify"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']/preempt/enabled"],[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance/priority","operation":"Modify"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']/priority"],[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance/virtual-ipv4-addresses/virtual-ipv4-address","operation":"Create"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']/virtual-ipv4-addresses/virtual-ipv4-address[ipv4-address='10.0.1.5']"]]}}}
{"Ibus":{"InterfaceQuery":{"ifname":"lo","af":"Ipv4"}}}
{"Ibus":{"InterfaceUpd":{"ifname":"eth-sw1","ifindex":2,"mtu":1500,"flags":"OPERATIVE | BROADCAST"}}}
{"Ibus":{"InterfaceUpd":{"ifname":"lo","ifindex":1,"mtu":65536,"flags":"LOOPBACK | OPERATIVE"}}}
{"Northbound":{"Commit":{"phase":"Apply","old_config":"{}","new_config":"{\"ietf-interfaces:interfaces\":{\"interface\":[{\"name\":\"eth-sw1\",\"type\":\"iana-if-type:ethernetCsmacd\",\"ietf-ip:ipv4\":{\"address\":[{\"ip\":\"10.0.1.2\",\"prefix-length\":24}],\"ietf-vrrp:vrrp\":{\"vrrp-instance\":[{\"vrid\":1,\"log-state-change\":true,\"preempt\":{\"enabled\":false},\"priority\":20,\"virtual-ipv4-addresses\":{\"virtual-ipv4-address\":[{\"ipv4-address\":\"10.0.1.5\"}]}}]}}},{\"name\":\"lo\",\"type\":\"iana-if-type:softwareLoopback\",\"ietf-ip:ipv4\":{\"address\":[{\"ip\":\"2.2.2.2\",\"prefix-length\":32}]}}]}}","changes":[[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance","operation":"Create"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']"],[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance/log-state-change","operation":"Modify"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']/log-state-change"],[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance/preempt/enabled","operation":"Modify"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']/preempt/enabled"],[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance/priority","operation":"Modify"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']/priority"],[{"path":"/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance/virtual-ipv4-addresses/virtual-ipv4-address","operation":"Create"},"/ietf-interfaces:interfaces/interface[name='eth-sw1']/ietf-ip:ipv4/ietf-vrrp:vrrp/vrrp-instance[vrid='1']/virtual-ipv4-addresses/virtual-ipv4-address[ipv4-address='10.0.1.5']"]]}}}
{"Ibus":{"MacvlanAdd":{"parent_name":"eth-sw1","name":"mvlan-vrrp-1","mac_address":[0,0,94,0,1,1]}}}
{"Ibus":{"InterfaceAddressAdd":{"ifname":"eth-sw1","addr":"10.0.1.2/24","flags":""}}}
{"Ibus":{"RouterIdUpdate":"10.0.1.2"}}
{"Ibus":{"InterfaceAddressAdd":{"ifname":"lo","addr":"2.2.2.2/32","flags":""}}}
{"Ibus":{"RouterIdUpdate":"2.2.2.2"}}
{"Ibus":{"InterfaceUpd":{"ifname":"mvlan-vrrp-1","ifindex":3,"mtu":1500,"flags":"OPERATIVE | BROADCAST"}}}
{"Ibus":{"RouteRedistributeAdd":{"protocol":"direct","prefix":"10.0.1.0/24","distance":0,"metric":0,"tag":null,"nexthops":[{"Interface":{"ifindex":2}}]}}}
{"Ibus":{"RouteRedistributeAdd":{"protocol":"direct","prefix":"2.2.2.2/32","distance":0,"metric":0,"tag":null,"nexthops":[{"Interface":{"ifindex":1}}]}}}
{"Ibus":{"InterfaceAddressAdd":{"ifname":"mvlan-vrrp-1","addr":"fe80::200:5eff:fe00:101/64","flags":""}}}
{"Ibus":{"RouteRedistributeAdd":{"protocol":"direct","prefix":"fe80::/64","distance":0,"metric":0,"tag":null,"nexthops":[{"Interface":{"ifindex":2}}]}}}
{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.1","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":10,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":51703,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}}
{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.1","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":10,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":51703,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}}
{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.1","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":10,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":51703,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}}
{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.1","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":10,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":51703,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}}
{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.1","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":10,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":51703,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}}
{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.1","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":10,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":51703,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}}
{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.1","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":10,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":51703,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}}
{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.1","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":10,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":51703,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}}
{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.1","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":10,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":51703,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}}
51 changes: 51 additions & 0 deletions holo-vrrp/tests/conformance/topologies/topo1-1/rt3/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"ietf-interfaces:interfaces": {
"interface": [
{
"name": "eth-sw1",
"type": "iana-if-type:ethernetCsmacd",
"ietf-ip:ipv4": {
"address": [
{
"ip": "10.0.1.3",
"prefix-length": 24
}
],
"ietf-vrrp:vrrp": {
"vrrp-instance": [
{
"vrid": 1,
"log-state-change": true,
"preempt": {
"enabled": false
},
"priority": 30,
"advertise-interval-sec": 1,
"virtual-ipv4-addresses": {
"virtual-ipv4-address": [
{
"ipv4-address": "10.0.1.5"
}
]
}
}
]
}
}
},
{
"name": "lo",
"type": "iana-if-type:softwareLoopback",
"ietf-ip:ipv4": {
"address": [
{
"ip": "3.3.3.3",
"prefix-length": 32
}
]
}
}
]
}
}

Loading

0 comments on commit d9ec5de

Please sign in to comment.