-function check_install_iptables_persistent(){
- echo -e "\nChecking required packages: iptables-persistent"
- if ! dpkg -l iptables-persistent &>/dev/null; then
- echo -e " Not installed.\nInstalling iptables-persistent requires root privileges"
- echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections
- echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections
- sudo apt-get -yq install iptables-persistent
- fi
+function osmclient_snap_install_refresh() {
+ channel_preference="stable candidate beta edge"
+ for channel in $channel_preference; do
+ echo "Trying to install osmclient from channel $OSMCLIENT_VERSION/$channel"
+ sudo snap $1 osmclient --channel $OSMCLIENT_VERSION/$channel 2> /dev/null && echo osmclient snap installed && break
+ done
+}
+function install_osmclient() {
+ snap info osmclient | grep -E ^installed: && refresh_osmclient_snap || install_osm_client_snap
+}
+
+function add_local_k8scluster() {
+ osm --all-projects vim-create \
+ --name _system-osm-vim \
+ --account_type dummy \
+ --auth_url http://dummy \
+ --user osm --password osm --tenant osm \
+ --description "dummy" \
+ --config '{management_network_name: mgmt}'
+ tmpfile=$(mktemp --tmpdir=${HOME})
+ cp ${KUBECONFIG} ${tmpfile}
+ osm --all-projects k8scluster-add \
+ --creds ${tmpfile} \
+ --vim _system-osm-vim \
+ --k8s-nets '{"net1": null}' \
+ --version '1.19' \
+ --description "OSM Internal Cluster" \
+ _system-osm-k8s
+ rm -f ${tmpfile}