Update VTN config generation to use VTN Service
diff --git a/xos/synchronizers/onos/steps/sync_onosapp.py b/xos/synchronizers/onos/steps/sync_onosapp.py
index add749d..1233ad7 100644
--- a/xos/synchronizers/onos/steps/sync_onosapp.py
+++ b/xos/synchronizers/onos/steps/sync_onosapp.py
@@ -17,6 +17,7 @@
from services.onos.models import ONOSService, ONOSApp
from xos.logger import Logger, logging
from services.vrouter.models import VRouterService
+from services.vtn.models import VTNService
# hpclibrary will be in steps/..
parentdir = os.path.join(os.path.dirname(__file__),"..")
@@ -145,16 +146,25 @@
# This function currently assumes a single Deployment and Site
def get_vtn_config(self, o, attrs):
- # The "attrs" argument contains a list of all service and tenant attributes
- # If an attribute is present, use it in the configuration
- # Otherwise save the attriute with a reasonable (for a CORD devel pod) default value
- # The admin will see all possible configuration values and the assigned defaults
- privateGatewayMac = self.attribute_default(o, attrs, "privateGatewayMac", "00:00:00:00:00:01")
- localManagementIp = self.attribute_default(o, attrs, "localManagementIp", "172.27.0.1/24")
- ovsdbPort = self.attribute_default(o, attrs, "ovsdbPort", "6641")
- sshPort = self.attribute_default(o, attrs, "sshPort", "22")
- sshUser = self.attribute_default(o, attrs, "sshUser", "root")
- sshKeyFile = self.attribute_default(o, attrs, "sshKeyFile", "/root/node_key")
+ privateGatewayMac = None
+ localManagementIp = None
+ ovsdbPort = None
+ sshPort = None
+ sshUser = None
+ sshKeyFile = None
+ mgmtSubnetBits = None
+
+ # VTN-specific configuration from the VTN Service
+ vtns = VTNService.get_service_objects().all()
+ if vtns:
+ vtn = vtns[0]
+ privateGatewayMac = vtn.privateGatewayMac
+ localManagementIp = vtn.localManagementIp
+ ovsdbPort = vtn.ovsdbPort
+ sshPort = vtn.sshPort
+ sshUser = vtn.sshUser
+ sshKeyFile = vtn.sshKeyFile
+ mgmtSubnetBits = vtn.mgmtSubnetBits
# OpenStack endpoints and credentials
keystone_server = "http://keystone:5000/v2.0/"
@@ -194,11 +204,6 @@
}
# Generate apps->org.onosproject.cordvtn->cordvtn->nodes
-
- # We need to generate a CIDR address for the physical node's
- # address on the management network
- mgmtSubnetBits = self.attribute_default(o, attrs, "mgmtSubnetBits", "24")
-
nodes = Node.objects.all()
for node in nodes:
nodeip = socket.gethostbyname(node.name)