From cdb27a2df1429e90aa7f6ac385a82f4bdbbf3b07 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Thu, 9 Jan 2025 19:57:16 -0300 Subject: [PATCH] vrrp conformance tests WIP --- .../01-input-protocol.jsonl | 1 + .../master-down-timer1/01-output-ibus.jsonl | 1 + .../01-output-northbound-state.json | 20 ++++++++ .../01-output-protocol.jsonl | 2 + holo-vrrp/tests/conformance/mod.rs | 31 ++++++++++++ holo-vrrp/tests/conformance/topologies/mod.rs | 20 ++++++++ .../topologies/topo1-1/rt1/config.json | 48 +++++++++++++++++++ .../topologies/topo1-1/rt1/events.jsonl | 24 ++++++++++ .../topologies/topo1-1/rt1/output/ibus.jsonl | 2 + .../topo1-1/rt1/output/northbound-state.json | 20 ++++++++ .../topologies/topo1-1/rt2/config.json | 48 +++++++++++++++++++ .../topologies/topo1-1/rt2/events.jsonl | 24 ++++++++++ .../topologies/topo1-1/rt2/output/ibus.jsonl | 2 + .../topo1-1/rt2/output/northbound-state.json | 20 ++++++++ .../topologies/topo1-1/rt3/config.json | 48 +++++++++++++++++++ .../topologies/topo1-1/rt3/events.jsonl | 17 +++++++ .../topologies/topo1-1/rt3/output/ibus.jsonl | 3 ++ .../topo1-1/rt3/output/northbound-state.json | 20 ++++++++ .../topo1-1/rt3/output/protocol.jsonl | 2 + holo-vrrp/tests/mod.rs | 1 + 20 files changed, 354 insertions(+) create mode 100644 holo-vrrp/tests/conformance/master-down-timer1/01-input-protocol.jsonl create mode 100644 holo-vrrp/tests/conformance/master-down-timer1/01-output-ibus.jsonl create mode 100644 holo-vrrp/tests/conformance/master-down-timer1/01-output-northbound-state.json create mode 100644 holo-vrrp/tests/conformance/master-down-timer1/01-output-protocol.jsonl create mode 100644 holo-vrrp/tests/conformance/mod.rs create mode 100644 holo-vrrp/tests/conformance/topologies/mod.rs create mode 100644 holo-vrrp/tests/conformance/topologies/topo1-1/rt1/config.json create mode 100644 holo-vrrp/tests/conformance/topologies/topo1-1/rt1/events.jsonl create mode 100644 holo-vrrp/tests/conformance/topologies/topo1-1/rt1/output/ibus.jsonl create mode 100644 holo-vrrp/tests/conformance/topologies/topo1-1/rt1/output/northbound-state.json create mode 100644 holo-vrrp/tests/conformance/topologies/topo1-1/rt2/config.json create mode 100644 holo-vrrp/tests/conformance/topologies/topo1-1/rt2/events.jsonl create mode 100644 holo-vrrp/tests/conformance/topologies/topo1-1/rt2/output/ibus.jsonl create mode 100644 holo-vrrp/tests/conformance/topologies/topo1-1/rt2/output/northbound-state.json create mode 100644 holo-vrrp/tests/conformance/topologies/topo1-1/rt3/config.json create mode 100644 holo-vrrp/tests/conformance/topologies/topo1-1/rt3/events.jsonl create mode 100644 holo-vrrp/tests/conformance/topologies/topo1-1/rt3/output/ibus.jsonl create mode 100644 holo-vrrp/tests/conformance/topologies/topo1-1/rt3/output/northbound-state.json create mode 100644 holo-vrrp/tests/conformance/topologies/topo1-1/rt3/output/protocol.jsonl diff --git a/holo-vrrp/tests/conformance/master-down-timer1/01-input-protocol.jsonl b/holo-vrrp/tests/conformance/master-down-timer1/01-input-protocol.jsonl new file mode 100644 index 00000000..688679fc --- /dev/null +++ b/holo-vrrp/tests/conformance/master-down-timer1/01-input-protocol.jsonl @@ -0,0 +1 @@ +{"MasterDownTimer":{"vrid":1}} diff --git a/holo-vrrp/tests/conformance/master-down-timer1/01-output-ibus.jsonl b/holo-vrrp/tests/conformance/master-down-timer1/01-output-ibus.jsonl new file mode 100644 index 00000000..b7f08ca4 --- /dev/null +++ b/holo-vrrp/tests/conformance/master-down-timer1/01-output-ibus.jsonl @@ -0,0 +1 @@ +{"InterfaceIpAddRequest":{"ifname":"mvlan-vrrp-1","addr":"10.0.1.5/32"}} \ No newline at end of file diff --git a/holo-vrrp/tests/conformance/master-down-timer1/01-output-northbound-state.json b/holo-vrrp/tests/conformance/master-down-timer1/01-output-northbound-state.json new file mode 100644 index 00000000..d26186a3 --- /dev/null +++ b/holo-vrrp/tests/conformance/master-down-timer1/01-output-northbound-state.json @@ -0,0 +1,20 @@ +{ + "ietf-interfaces:interfaces": { + "interface": [ + { + "name": "eth-sw1", + "ietf-ip:ipv4": { + "ietf-vrrp:vrrp": { + "vrrp-instance": [ + { + "vrid": 1, + "state": "master", + "new-master-reason": "no-response" + } + ] + } + } + } + ] + } +} diff --git a/holo-vrrp/tests/conformance/master-down-timer1/01-output-protocol.jsonl b/holo-vrrp/tests/conformance/master-down-timer1/01-output-protocol.jsonl new file mode 100644 index 00000000..6a7143a4 --- /dev/null +++ b/holo-vrrp/tests/conformance/master-down-timer1/01-output-protocol.jsonl @@ -0,0 +1,2 @@ +{"NetTxPacket":{"Vrrp":{"packet":{"ip":{"version":4,"ihl":5,"tos":192,"total_length":40,"identification":7,"flags":0,"offset":0,"ttl":255,"protocol":112,"checksum":0,"src_address":"10.0.1.1","dst_address":"224.0.0.18","options":null,"padding":null},"vrrp":{"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}}}}} +{"NetTxPacket":{"Arp":{"vrid":1,"ifindex":3,"eth_hdr":{"dst_mac":[255,255,255,255,255,255],"src_mac":[0,0,0,0,0,0],"ethertype":2054},"arp_hdr":{"hw_type":1,"proto_type":2048,"hw_length":6,"proto_length":4,"operation":1,"sender_hw_address":[0,0,0,0,0,0],"sender_proto_address":"10.0.1.5","target_hw_address":[255,255,255,255,255,255],"target_proto_address":"10.0.1.5"}}}} \ No newline at end of file diff --git a/holo-vrrp/tests/conformance/mod.rs b/holo-vrrp/tests/conformance/mod.rs new file mode 100644 index 00000000..4d990170 --- /dev/null +++ b/holo-vrrp/tests/conformance/mod.rs @@ -0,0 +1,31 @@ +// +// 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; + +use holo_protocol::test::stub::run_test; +use holo_vrrp::interface::Interface; + +// Test description: +// +// The interface in "backup" state should transition to the "master" mode once +// the Master_Down_Timer has expired. +// +// Input: +// * Protocol: Master_Down_Timer has expired +// Output: +// * Protocol: +// - Send VRRP advertisement +// - Send gratuitous ARP +// * Northbound: interface state transitioned to the "master" state +// * Southbound: install the 10.0.1.5/32 address to the mvlan-vrrp-1 interface +#[tokio::test] +async fn master_down_timer1() { + run_test::("master-down-timer1", "topo1-1", "rt1").await; +} diff --git a/holo-vrrp/tests/conformance/topologies/mod.rs b/holo-vrrp/tests/conformance/topologies/mod.rs new file mode 100644 index 00000000..c499156e --- /dev/null +++ b/holo-vrrp/tests/conformance/topologies/mod.rs @@ -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::("topo1-1", &rt_name).await; + //run_test_topology::("topo1-1", "eth-sw1", &rt_name).await; + } +} diff --git a/holo-vrrp/tests/conformance/topologies/topo1-1/rt1/config.json b/holo-vrrp/tests/conformance/topologies/topo1-1/rt1/config.json new file mode 100644 index 00000000..ee9288f7 --- /dev/null +++ b/holo-vrrp/tests/conformance/topologies/topo1-1/rt1/config.json @@ -0,0 +1,48 @@ +{ + "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, + "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 + } + ] + } + } + ] + } +} + diff --git a/holo-vrrp/tests/conformance/topologies/topo1-1/rt1/events.jsonl b/holo-vrrp/tests/conformance/topologies/topo1-1/rt1/events.jsonl new file mode 100644 index 00000000..3ffa83c4 --- /dev/null +++ b/holo-vrrp/tests/conformance/topologies/topo1-1/rt1/events.jsonl @@ -0,0 +1,24 @@ +{"Ibus":{"InterfaceQuery":{"ifname":"eth-sw1","af":"Ipv4"}}} +{"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"}}} +{"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":"1.1.1.1/32","distance":0,"metric":0,"tag":null,"nexthops":[{"Interface":{"ifindex":1}}]}}} +{"Ibus":{"RouteRedistributeAdd":{"protocol":"direct","prefix":"10.0.1.0/24","distance":0,"metric":0,"tag":null,"nexthops":[{"Interface":{"ifindex":2}}]}}} +{"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":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} diff --git a/holo-vrrp/tests/conformance/topologies/topo1-1/rt1/output/ibus.jsonl b/holo-vrrp/tests/conformance/topologies/topo1-1/rt1/output/ibus.jsonl new file mode 100644 index 00000000..9c3e8587 --- /dev/null +++ b/holo-vrrp/tests/conformance/topologies/topo1-1/rt1/output/ibus.jsonl @@ -0,0 +1,2 @@ +{"InterfaceQuery":{"ifname":"eth-sw1","af":"Ipv4"}} +{"MacvlanAdd":{"parent_name":"eth-sw1","name":"mvlan-vrrp-1","mac_address":[0,0,94,0,1,1]}} \ No newline at end of file diff --git a/holo-vrrp/tests/conformance/topologies/topo1-1/rt1/output/northbound-state.json b/holo-vrrp/tests/conformance/topologies/topo1-1/rt1/output/northbound-state.json new file mode 100644 index 00000000..29ce70b5 --- /dev/null +++ b/holo-vrrp/tests/conformance/topologies/topo1-1/rt1/output/northbound-state.json @@ -0,0 +1,20 @@ +{ + "ietf-interfaces:interfaces": { + "interface": [ + { + "name": "eth-sw1", + "ietf-ip:ipv4": { + "ietf-vrrp:vrrp": { + "vrrp-instance": [ + { + "vrid": 1, + "state": "backup", + "new-master-reason": "not-master" + } + ] + } + } + } + ] + } +} diff --git a/holo-vrrp/tests/conformance/topologies/topo1-1/rt2/config.json b/holo-vrrp/tests/conformance/topologies/topo1-1/rt2/config.json new file mode 100644 index 00000000..f1254ddc --- /dev/null +++ b/holo-vrrp/tests/conformance/topologies/topo1-1/rt2/config.json @@ -0,0 +1,48 @@ +{ + "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, + "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 + } + ] + } + } + ] + } +} + diff --git a/holo-vrrp/tests/conformance/topologies/topo1-1/rt2/events.jsonl b/holo-vrrp/tests/conformance/topologies/topo1-1/rt2/events.jsonl new file mode 100644 index 00000000..34c92419 --- /dev/null +++ b/holo-vrrp/tests/conformance/topologies/topo1-1/rt2/events.jsonl @@ -0,0 +1,24 @@ +{"Ibus":{"InterfaceQuery":{"ifname":"eth-sw1","af":"Ipv4"}}} +{"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"}}} +{"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":{"RouteRedistributeAdd":{"protocol":"direct","prefix":"10.0.1.0/24","distance":0,"metric":0,"tag":null,"nexthops":[{"Interface":{"ifindex":2}}]}}} +{"Ibus":{"InterfaceUpd":{"ifname":"mvlan-vrrp-1","ifindex":3,"mtu":1500,"flags":"OPERATIVE | BROADCAST"}}} +{"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.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"Protocol":{"VrrpNetRxPacket":{"src":"10.0.1.3","packet":{"Ok":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} diff --git a/holo-vrrp/tests/conformance/topologies/topo1-1/rt2/output/ibus.jsonl b/holo-vrrp/tests/conformance/topologies/topo1-1/rt2/output/ibus.jsonl new file mode 100644 index 00000000..9c3e8587 --- /dev/null +++ b/holo-vrrp/tests/conformance/topologies/topo1-1/rt2/output/ibus.jsonl @@ -0,0 +1,2 @@ +{"InterfaceQuery":{"ifname":"eth-sw1","af":"Ipv4"}} +{"MacvlanAdd":{"parent_name":"eth-sw1","name":"mvlan-vrrp-1","mac_address":[0,0,94,0,1,1]}} \ No newline at end of file diff --git a/holo-vrrp/tests/conformance/topologies/topo1-1/rt2/output/northbound-state.json b/holo-vrrp/tests/conformance/topologies/topo1-1/rt2/output/northbound-state.json new file mode 100644 index 00000000..29ce70b5 --- /dev/null +++ b/holo-vrrp/tests/conformance/topologies/topo1-1/rt2/output/northbound-state.json @@ -0,0 +1,20 @@ +{ + "ietf-interfaces:interfaces": { + "interface": [ + { + "name": "eth-sw1", + "ietf-ip:ipv4": { + "ietf-vrrp:vrrp": { + "vrrp-instance": [ + { + "vrid": 1, + "state": "backup", + "new-master-reason": "not-master" + } + ] + } + } + } + ] + } +} diff --git a/holo-vrrp/tests/conformance/topologies/topo1-1/rt3/config.json b/holo-vrrp/tests/conformance/topologies/topo1-1/rt3/config.json new file mode 100644 index 00000000..7619cf33 --- /dev/null +++ b/holo-vrrp/tests/conformance/topologies/topo1-1/rt3/config.json @@ -0,0 +1,48 @@ +{ + "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, + "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 + } + ] + } + } + ] + } +} + diff --git a/holo-vrrp/tests/conformance/topologies/topo1-1/rt3/events.jsonl b/holo-vrrp/tests/conformance/topologies/topo1-1/rt3/events.jsonl new file mode 100644 index 00000000..7a379198 --- /dev/null +++ b/holo-vrrp/tests/conformance/topologies/topo1-1/rt3/events.jsonl @@ -0,0 +1,17 @@ +{"Ibus":{"InterfaceQuery":{"ifname":"eth-sw1","af":"Ipv4"}}} +{"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"}}} +{"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.3/24","flags":""}}} +{"Ibus":{"RouterIdUpdate":"10.0.1.3"}} +{"Ibus":{"InterfaceAddressAdd":{"ifname":"lo","addr":"3.3.3.3/32","flags":""}}} +{"Ibus":{"RouterIdUpdate":"3.3.3.3"}} +{"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":"3.3.3.3/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"}}} diff --git a/holo-vrrp/tests/conformance/topologies/topo1-1/rt3/output/ibus.jsonl b/holo-vrrp/tests/conformance/topologies/topo1-1/rt3/output/ibus.jsonl new file mode 100644 index 00000000..f75cce86 --- /dev/null +++ b/holo-vrrp/tests/conformance/topologies/topo1-1/rt3/output/ibus.jsonl @@ -0,0 +1,3 @@ +{"InterfaceQuery":{"ifname":"eth-sw1","af":"Ipv4"}} +{"MacvlanAdd":{"parent_name":"eth-sw1","name":"mvlan-vrrp-1","mac_address":[0,0,94,0,1,1]}} +{"InterfaceIpAddRequest":{"ifname":"mvlan-vrrp-1","addr":"10.0.1.5/32"}} \ No newline at end of file diff --git a/holo-vrrp/tests/conformance/topologies/topo1-1/rt3/output/northbound-state.json b/holo-vrrp/tests/conformance/topologies/topo1-1/rt3/output/northbound-state.json new file mode 100644 index 00000000..d26186a3 --- /dev/null +++ b/holo-vrrp/tests/conformance/topologies/topo1-1/rt3/output/northbound-state.json @@ -0,0 +1,20 @@ +{ + "ietf-interfaces:interfaces": { + "interface": [ + { + "name": "eth-sw1", + "ietf-ip:ipv4": { + "ietf-vrrp:vrrp": { + "vrrp-instance": [ + { + "vrid": 1, + "state": "master", + "new-master-reason": "no-response" + } + ] + } + } + } + ] + } +} diff --git a/holo-vrrp/tests/conformance/topologies/topo1-1/rt3/output/protocol.jsonl b/holo-vrrp/tests/conformance/topologies/topo1-1/rt3/output/protocol.jsonl new file mode 100644 index 00000000..51977369 --- /dev/null +++ b/holo-vrrp/tests/conformance/topologies/topo1-1/rt3/output/protocol.jsonl @@ -0,0 +1,2 @@ +{"NetTxPacket":{"Vrrp":{"packet":{"ip":{"version":4,"ihl":5,"tos":192,"total_length":40,"identification":7,"flags":0,"offset":0,"ttl":255,"protocol":112,"checksum":0,"src_address":"10.0.1.3","dst_address":"224.0.0.18","options":null,"padding":null},"vrrp":{"version":2,"hdr_type":1,"vrid":1,"priority":30,"count_ip":1,"auth_type":0,"adver_int":1,"checksum":46583,"ip_addresses":["10.0.1.5"],"auth_data":0,"auth_data2":0}}}}} +{"NetTxPacket":{"Arp":{"vrid":1,"ifindex":3,"eth_hdr":{"dst_mac":[255,255,255,255,255,255],"src_mac":[0,0,0,0,0,0],"ethertype":2054},"arp_hdr":{"hw_type":1,"proto_type":2048,"hw_length":6,"proto_length":4,"operation":1,"sender_hw_address":[0,0,0,0,0,0],"sender_proto_address":"10.0.1.5","target_hw_address":[255,255,255,255,255,255],"target_proto_address":"10.0.1.5"}}}} \ No newline at end of file diff --git a/holo-vrrp/tests/mod.rs b/holo-vrrp/tests/mod.rs index 62352e6c..1871720c 100644 --- a/holo-vrrp/tests/mod.rs +++ b/holo-vrrp/tests/mod.rs @@ -7,4 +7,5 @@ // See: https://nlnet.nl/NGI0 // +mod conformance; mod packet;