Create radvd configuration and start it <--> VM's which is being started has IPv6 network which is global

This commit is contained in:
ahmadbilalkhalid 2019-12-26 12:24:19 +05:00
parent f79097cae9
commit ec3cf49799

View file

@ -8,6 +8,7 @@ import os
import subprocess as sp
import tempfile
import time
import ipaddress
from functools import wraps
from string import Template
@ -90,6 +91,8 @@ class VMM:
tap_id=tap,
ip=network_ipv6)
all_networks = self.etcd_client.get_prefix('/v1/network/', value_in_json=True)
if ipaddress.ip_network(network_ipv6).is_global:
update_radvd_conf(all_networks)
command += " -netdev tap,id=vmnet{net_id},ifname={tap},script=no,downscript=no" \
@ -361,7 +364,7 @@ def update_radvd_conf(all_networks):
networks = {
net.value['ipv6']: net.value['id']
for net in all_networks
if net.value.get('ipv6')
if net.value.get('ipv6') and ipaddress.ip_network(net.value.get('ipv6')).is_global
}
radvd_template = open(os.path.join(network_script_base,
'radvd-template.conf'), 'r').read()