#!/bin/bash
# Client (hv2) setup script - runs on 20.0.86.26
# This is the gateway chassis

CLIENT_CHASSIS="hv2"   #"ovn-gw-1"
PHYS_NIC="ens6f0np0"   # physical nic connected the other node

systemctl start openvswitch
ovs-vsctl set open . external_ids:system-id=$CLIENT_CHASSIS \
    external_ids:ovn-remote=tcp:20.0.86.25:6642 \
    external_ids:ovn-encap-type=geneve \
    external_ids:ovn-encap-ip=20.0.86.26
systemctl restart ovn-controller


# Setup bridge mappings for public network
ovs-vsctl add-br br-public
ovs-vsctl --may-exist add-br br-int
ip addr add 20.0.86.26/24 dev br-public
ip link set br-public up
ovs-vsctl add-port br-public $PHYS_NIC -- set interface $PHYS_NIC type=system

# Setup bridge mappings for public network
ovs-vsctl set open . external-ids:ovn-bridge-mappings=public:br-public
ovs-vsctl set open . external-ids:ovn-chassis-mac-mappings="public:aa:bb:cc:dd:02:01"


