From f555b638c787f241b15ad277a8c25fb969f16254 Mon Sep 17 00:00:00 2001 From: Boris Glimcher Date: Wed, 9 Aug 2023 22:11:06 +0300 Subject: [PATCH] ci: replace static comamnds with grpc calls Signed-off-by: Boris Glimcher --- docker-compose.yml | 131 ++++++++++----------------------------------- 1 file changed, 28 insertions(+), 103 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a7212f9f..a02f30b2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -54,93 +54,6 @@ services: sed -i "s/127.0.0.1/0.0.0.0/g" /etc/frr/daemons && \ ip link add name lo0 type dummy && \ ifconfig lo0 10.0.0.2 netmask 255.255.255.255 up && \ - - ip link add br-tenant type bridge vlan_default_pvid 0 vlan_filtering 1 vlan_protocol 802.1Q && \ - ip link set br-tenant up && \ - - ip link add blue type vrf table 1000 && \ - ip link set blue up && \ - ip link add name lo1 type dummy && \ - ip link set lo1 master blue up && \ - ip address add 10.0.1.2/32 dev lo1 && \ - - ip link add green type vrf table 1001 && \ - ip link set green up && \ - ip link add name lo2 type dummy && \ - ip link set lo2 master green up && \ - ip address add 10.0.2.2/32 dev lo2 && \ - - ip link add yellow type vrf table 1002 && \ - ip link set yellow up && \ - ip link add name lo3 type dummy && \ - ip link set lo3 master yellow up && \ - ip address add 10.0.3.2/32 dev lo3 && \ - - ip link add br100 addr aa:bb:cc:00:00:02 type bridge && \ - ip link set br100 master green up && \ - ip link add vni100 type vxlan local 10.0.0.2 dstport 4789 id 100 nolearning && \ - ip link set vni100 master br100 up && \ - - ip link add br101 addr aa:bb:cc:00:00:03 type bridge && \ - ip link set br101 master yellow up && \ - ip link add vni101 type vxlan local 10.0.0.2 dstport 4789 id 101 nolearning && \ - ip link set vni101 master br101 up && \ - - ip link add vni10 type vxlan id 10 local 10.0.0.2 dstport 4789 nolearning && \ - ip link set vni10 master br-tenant up && \ - bridge vlan add dev vni10 vid 10 pvid untagged && \ - bridge link set dev vni10 neigh_suppress on learning off && \ - - ip link add vni20 type vxlan id 20 local 10.0.0.2 dstport 4789 nolearning && \ - ip link set vni20 master br-tenant up && \ - bridge vlan add dev vni20 vid 20 pvid untagged && \ - bridge link set dev vni20 neigh_suppress on learning off && \ - - ip link add vni30 type vxlan id 30 local 10.0.0.2 dstport 4789 nolearning && \ - ip link set vni30 master br-tenant up && \ - bridge vlan add dev vni30 vid 30 pvid untagged && \ - bridge link set dev vni30 neigh_suppress on learning off && \ - - ip link add vni40 type vxlan id 40 local 10.0.0.2 dstport 4789 nolearning && \ - ip link set vni40 master br-tenant up && \ - bridge vlan add dev vni40 vid 40 pvid untagged && \ - bridge link set dev vni40 neigh_suppress on learning off && \ - - bridge vlan add dev br-tenant vid 20 self && \ - ip link add link br-tenant name vlan20 type vlan id 20 && \ - ip link set vlan20 address aa:bb:cc:00:00:21 && \ - ip link set vlan20 master blue up && \ - ip address add 20.20.20.1/24 dev vlan20 && \ - - bridge vlan add dev br-tenant vid 30 self && \ - ip link add link br-tenant name vlan30 type vlan id 30 && \ - ip link set vlan30 address aa:bb:cc:00:00:31 && \ - ip link set vlan30 master blue up && \ - ip address add 30.30.30.1/24 dev vlan30 && \ - - bridge vlan add dev br-tenant vid 40 self && \ - ip link add link br-tenant name vlan40 type vlan id 40 && \ - ip link set vlan40 address aa:bb:cc:00:00:41 && \ - ip link set vlan40 master green up && \ - ip address add 40.40.40.1/24 dev vlan40 && \ - - bridge vlan add dev br-tenant vid 50 self && \ - ip link add link br-tenant name vlan50 type vlan id 50 && \ - ip link set vlan50 address aa:bb:cc:00:00:51 && \ - ip link set vlan50 master yellow up && \ - ip address add 50.50.50.1/24 dev vlan50 && \ - - ip link set eth1 up && ip addr flush dev eth1 && \ - ip link set eth1 master br-tenant up && \ - bridge vlan add dev eth1 vid 10 && \ - - bridge vlan add dev eth1 vid 20 && \ - - bridge vlan add dev eth1 vid 40 && \ - - ip addr flush dev eth2 && ip link set eth2 master br-tenant up && \ - bridge vlan add dev eth2 vid 50 && \ - /etc/init.d/frr stop && \ /usr/lib/frr/watchfrr -d -F traditional zebra bgpd staticd && \ sleep infinity' @@ -334,23 +247,35 @@ services: ip link add br-tenant type bridge vlan_default_pvid 0 vlan_filtering 1 vlan_protocol 802.1Q && \ ip link set br-tenant up && \ echo create && \ - /entrypoint.sh call --json_input --json_output localhost:50151 CreateVrf "{\"vrf\" : {\"spec\" : {\"vni\" : 100, \"loopback_ip_prefix\": {}, \"vtep_ip_prefix\": {\"addr\": {\"af\": \"IP_AF_INET\", \"v4_addr\": 167772162}, \"len\": 24} }}, \"vrf_id\" : \"blue\" }" && \ - /entrypoint.sh call --json_input --json_output localhost:50151 CreateVrf "{\"vrf\" : {\"spec\" : {\"vni\" : 101, \"loopback_ip_prefix\": {}, \"vtep_ip_prefix\": {\"addr\": {\"af\": \"IP_AF_INET\", \"v4_addr\": 167772162}, \"len\": 24} }}, \"vrf_id\" : \"green\" }" && \ - /entrypoint.sh call --json_input --json_output localhost:50151 CreateVrf "{\"vrf\" : {\"spec\" : {\"vni\" : 102, \"loopback_ip_prefix\": {}, \"vtep_ip_prefix\": {\"addr\": {\"af\": \"IP_AF_INET\", \"v4_addr\": 167772162}, \"len\": 24} }}, \"vrf_id\" : \"yellow\" }" && \ - /entrypoint.sh call --json_input --json_output localhost:50151 CreateLogicalBridge "{\"logical_bridge\" : {\"spec\" : {\"vni\" : 11, \"vlan_id\": 11 }}, \"logical_bridge_id\" : \"vxlan11\" }" && \ - /entrypoint.sh call --json_input --json_output localhost:50151 CreateLogicalBridge "{\"logical_bridge\" : {\"spec\" : {\"vni\" : 22, \"vlan_id\": 22 }}, \"logical_bridge_id\" : \"vxlan22\" }" && \ - /entrypoint.sh call --json_input --json_output localhost:50151 CreateLogicalBridge "{\"logical_bridge\" : {\"spec\" : {\"vni\" : 33, \"vlan_id\": 33 }}, \"logical_bridge_id\" : \"vxlan33\" }" && \ - /entrypoint.sh call --json_input --json_output localhost:50151 CreateBridgePort "{\"bridge_port\" : {\"spec\" : {\"mac_address\" : \"qrvMAAAB\", \"ptype\": \"ACCESS\", \"logical_bridges\": [] }}, \"bridge_port_id\" : \"eth2\" }" && \ - /entrypoint.sh call --json_input --json_output localhost:50151 CreateBridgePort "{\"bridge_port\" : {\"spec\" : {\"mac_address\" : \"qrvMAAAB\", \"ptype\": \"TRUNK\" , \"logical_bridges\": [] }}, \"bridge_port_id\" : \"eth3\" }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 CreateVrf "{\"vrf_id\" : \"blue\", \"vrf\" : {\"spec\" : {\"vni\" : 0, \"loopback_ip_prefix\": {\"addr\": {\"af\": \"IP_AF_INET\", \"v4_addr\": 167772162}, \"len\": 24}, \"vtep_ip_prefix\": {\"addr\": {\"af\": \"IP_AF_INET\", \"v4_addr\": 167772162}, \"len\": 24} }} }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 CreateVrf "{\"vrf_id\" : \"green\", \"vrf\" : {\"spec\" : {\"vni\" : 101, \"loopback_ip_prefix\": {\"addr\": {\"af\": \"IP_AF_INET\", \"v4_addr\": 167772162}, \"len\": 24}, \"vtep_ip_prefix\": {\"addr\": {\"af\": \"IP_AF_INET\", \"v4_addr\": 167772162}, \"len\": 24} }} }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 CreateVrf "{\"vrf_id\" : \"yellow\", \"vrf\" : {\"spec\" : {\"vni\" : 102, \"loopback_ip_prefix\": {\"addr\": {\"af\": \"IP_AF_INET\", \"v4_addr\": 167772162}, \"len\": 24}, \"vtep_ip_prefix\": {\"addr\": {\"af\": \"IP_AF_INET\", \"v4_addr\": 167772162}, \"len\": 24} }} }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 CreateLogicalBridge "{\"logical_bridge_id\" : \"vni10\", \"logical_bridge\" : {\"spec\" : {\"vni\" : 10, \"vlan_id\": 10 }} }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 CreateLogicalBridge "{\"logical_bridge_id\" : \"vni20\", \"logical_bridge\" : {\"spec\" : {\"vni\" : 20, \"vlan_id\": 20 }} }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 CreateLogicalBridge "{\"logical_bridge_id\" : \"vni30\", \"logical_bridge\" : {\"spec\" : {\"vni\" : 30, \"vlan_id\": 30 }} }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 CreateLogicalBridge "{\"logical_bridge_id\" : \"vni40\", \"logical_bridge\" : {\"spec\" : {\"vni\" : 40, \"vlan_id\": 40 }} }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 CreateLogicalBridge "{\"logical_bridge_id\" : \"vni50\", \"logical_bridge\" : {\"spec\" : {\"vni\" : 0, \"vlan_id\": 50 }} }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 CreateSvi "{\"svi_id\" : \"vlan20\", \"svi\" : {\"spec\" : {\"vrf\": \"//network.opiproject.org/vrfs/blue\", \"logical_bridge\": \"//network.opiproject.org/bridges/vni20\", \"mac_address\" : \"qrvMAAAh\", \"gw_ip_prefix\": [{\"addr\": {\"af\": \"IP_AF_INET\", \"v4_addr\": 336860161}, \"len\": 24}] }} }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 CreateSvi "{\"svi_id\" : \"vlan30\", \"svi\" : {\"spec\" : {\"vrf\": \"//network.opiproject.org/vrfs/blue\", \"logical_bridge\": \"//network.opiproject.org/bridges/vni30\", \"mac_address\" : \"qrvMAAAx\", \"gw_ip_prefix\": [{\"addr\": {\"af\": \"IP_AF_INET\", \"v4_addr\": 505290241}, \"len\": 24}] }} }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 CreateSvi "{\"svi_id\" : \"vlan40\", \"svi\" : {\"spec\" : {\"vrf\": \"//network.opiproject.org/vrfs/green\", \"logical_bridge\": \"//network.opiproject.org/bridges/vni40\", \"mac_address\" : \"qrvMAABB\", \"gw_ip_prefix\": [{\"addr\": {\"af\": \"IP_AF_INET\", \"v4_addr\": 673720321}, \"len\": 24}] }} }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 CreateSvi "{\"svi_id\" : \"vlan50\", \"svi\" : {\"spec\" : {\"vrf\": \"//network.opiproject.org/vrfs/yellow\", \"logical_bridge\": \"//network.opiproject.org/bridges/vni50\", \"mac_address\" : \"qrvMAABR\", \"gw_ip_prefix\": [{\"addr\": {\"af\": \"IP_AF_INET\", \"v4_addr\": 842150401}, \"len\": 24}] }} }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 CreateBridgePort "{\"bridge_port_id\" : \"eth1\", \"bridge_port\" : {\"spec\" : {\"mac_address\" : \"qrvMAAAB\", \"ptype\": \"TRUNK\", \"logical_bridges\": [\"//network.opiproject.org/bridges/vni10\", \"//network.opiproject.org/bridges/vni20\", \"//network.opiproject.org/bridges/vni40\"] }} }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 CreateBridgePort "{\"bridge_port_id\" : \"eth2\", \"bridge_port\" : {\"spec\" : {\"mac_address\" : \"qrvMAAAB\", \"ptype\": \"ACCESS\", \"logical_bridges\": [\"//network.opiproject.org/bridges/vni50\"] }} }" && \ echo get && \ - /entrypoint.sh call --json_input --json_output localhost:50151 GetVrf "{\"name\" : \"//network.opiproject.org/vrfs/blue\" }" && \ - /entrypoint.sh call --json_input --json_output localhost:50151 GetVrf "{\"name\" : \"//network.opiproject.org/vrfs/green\" }" && \ - /entrypoint.sh call --json_input --json_output localhost:50151 GetVrf "{\"name\" : \"//network.opiproject.org/vrfs/yellow\" }" && \ - /entrypoint.sh call --json_input --json_output localhost:50151 GetLogicalBridge "{\"name\" : \"//network.opiproject.org/bridges/vxlan11\" }" && \ - /entrypoint.sh call --json_input --json_output localhost:50151 GetLogicalBridge "{\"name\" : \"//network.opiproject.org/bridges/vxlan22\" }" && \ - /entrypoint.sh call --json_input --json_output localhost:50151 GetLogicalBridge "{\"name\" : \"//network.opiproject.org/bridges/vxlan33\" }" && \ - /entrypoint.sh call --json_input --json_output localhost:50151 GetBridgePort "{\"name\" : \"//network.opiproject.org/ports/eth2\" }" && \ - /entrypoint.sh call --json_input --json_output localhost:50151 GetBridgePort "{\"name\" : \"//network.opiproject.org/ports/eth3\" }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 GetVrf "{\"name\" : \"//network.opiproject.org/vrfs/blue\" }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 GetVrf "{\"name\" : \"//network.opiproject.org/vrfs/green\" }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 GetVrf "{\"name\" : \"//network.opiproject.org/vrfs/yellow\" }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 GetLogicalBridge "{\"name\" : \"//network.opiproject.org/bridges/vni10\" }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 GetLogicalBridge "{\"name\" : \"//network.opiproject.org/bridges/vni20\" }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 GetLogicalBridge "{\"name\" : \"//network.opiproject.org/bridges/vni30\" }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 GetLogicalBridge "{\"name\" : \"//network.opiproject.org/bridges/vni40\" }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 GetLogicalBridge "{\"name\" : \"//network.opiproject.org/bridges/vni50\" }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 GetSvi "{\"name\" : \"//network.opiproject.org/svis/vlan20\" }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 GetSvi "{\"name\" : \"//network.opiproject.org/svis/vlan30\" }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 GetSvi "{\"name\" : \"//network.opiproject.org/svis/vlan40\" }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 GetSvi "{\"name\" : \"//network.opiproject.org/svis/vlan50\" }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 GetBridgePort "{\"name\" : \"//network.opiproject.org/ports/eth1\" }" && \ + /entrypoint.sh call --json_input --json_output localhost:50151 GetBridgePort "{\"name\" : \"//network.opiproject.org/ports/eth2\" }" && \ echo done' host2-leaf2: