go.ligato.io/vpp-agent/v3@v3.5.0/k8s/tests/topology-generate-routes.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  VSWITCH_NAME="vpp1"
     4  ETCD_CONTAINER="etcd"
     5  
     6  
     7  docker exec -it ${ETCD_CONTAINER} etcdctl put /vnf-agent/${VSWITCH_NAME}/vpp/config/v1/interface/memif1 '
     8  {
     9    "name": "memif1",
    10    "type": 2,
    11    "enabled": true,
    12    "memif": {
    13      "master": true,
    14      "id": 1,
    15      "socket_filename": "/tmp/memif.sock"
    16    },
    17    "ip_addresses" : [
    18       "8.42.0.2/24"
    19    ]
    20  }
    21  '
    22  
    23  
    24  if [ $1 -eq 0 ] ; then
    25     exit
    26  fi
    27  
    28  for i in $(eval echo {1..$1});do
    29      a=$(($i / 254 + 1))
    30      b=$(($i % 255))
    31  
    32  
    33  
    34  docker exec -it ${ETCD_CONTAINER} etcdctl put /vnf-agent/${VSWITCH_NAME}/vpp/config/v1/vrf/0/fib/6.$a.$b.0/24/8.42.0.1 "
    35  {
    36    \"description\": \"Static route $i\",
    37    \"dst_ip_addr\": \"6.$a.$b.0/24\",
    38    \"next_hop_addr\": \"8.42.0.1\",
    39    \"outgoing_interface\": \"memif1\"
    40  
    41  }
    42  "
    43  
    44  
    45  done
    46