Merge "CORD-2467: Start filebeat in synchronizer containers"
diff --git a/xos/synchronizer/model_policies/model_policy_vepcserviceinstance.py b/xos/synchronizer/model_policies/model_policy_vepcserviceinstance.py
index aac6f7c..741d4f0 100644
--- a/xos/synchronizer/model_policies/model_policy_vepcserviceinstance.py
+++ b/xos/synchronizer/model_policies/model_policy_vepcserviceinstance.py
@@ -66,6 +66,12 @@
                 raise Exception('No VMME vendors')
             service_instance.vmme_vendor = vendor
             service_instance.invalidate_cache('vmme_vendor')
+        elif service_instance.leaf_model_name == 'VHSSTenant':
+            vendor = VHSSVendor.objects.first()
+            if not vendor:
+                raise Exception('No VHSS vendors')
+            service_instance.vhss_vendor = vendor
+            service_instance.invalidate_cache('vhss_vendor')
 
 
     def child_service_instance_from_name(self, name):
@@ -190,28 +196,24 @@
     def create_epc_network(self, n):
         network_name = n['name']
         site_name = self.obj.site.login_base
-        slice_name = '%s_%s' % (
-            site_name, network_name.replace('_network', ''))
-
-        slices = Slice.objects.filter(name=slice_name)
-        if not slices:
-            flavor = Flavor.objects.all()[0]
-            image = Image.objects.all()[0]
-            slice = Slice(name=slice_name, default_isolation="vm", network="noauto",
-                          site=self.obj.site, default_flavor=flavor, default_image=image)
-            slice.save()
-        else:
-            slice = slices[0]
 
         nets = Network.objects.filter(name=network_name)
         if not nets:
             template_name = n.get('template', 'public')
-            templates = NetworkTemplate.objects.filter(name=template_name)
-            if not templates:
-                raise Exception('Template %s not found' % template_name)
+            try:
+                template = NetworkTemplate.objects.filter(name=template_name)[0]
+            except:
+                raise Exception('Template %s for network %s not found' % (template_name, network_name))
+
+            slice_name = '%s_%s' % (site_name, n['owner'])
+            try:
+                slice = Slice.objects.filter(name=slice_name)[0]
+            except:
+                raise Exception('Owner slice %s for network %s not found' % (slice_name, network_name))
+
 
             net = Network(name=network_name, subnet=n['subnet'], permit_all_slices=n.get(
-                'permit_all_slices', False), template=templates[0], owner=slice)
+                'permit_all_slices', False), template=template, owner=slice)
             net.save()
         else:
             net = nets[0]
diff --git a/xos/synchronizer/vepc_config.yaml b/xos/synchronizer/vepc_config.yaml
index 5a5fa70..0c01fed 100644
--- a/xos/synchronizer/vepc_config.yaml
+++ b/xos/synchronizer/vepc_config.yaml
@@ -8,30 +8,26 @@
       - name: s1u_network
         subnet: 111.0.0.0/24
         permit_all_slices: True
-        template: s1u_template
+        template: private_template
+        owner: vspgwu
       - name: s11_network
         subnet: 112.0.0.0/24
         permit_all_slices: True
-        template: s11_template
-      - name: nbi_network
-        subnet: 113.0.0.0/24
-        permit_all_slices: True
-        template: nbi_template
-      - name: sbi_network
-        subnet: 114.0.0.0/24
-        permit_all_slices: True
-        template: sbi_template
+        template: private_template
+        owner: vspgwc
       - name: sgi_network
         subnet: 115.0.0.0/24
         permit_all_slices: True
-        template: sgi_template
+        template: private_template
+        owner: vspgwu
       - name: spgw_network
         subnet: 117.0.0.0/24
         permit_all_slices: True
-        template: spgw_template
+        template: private_template
+        owner: vspgwu
     graph:
       - name: VSPGWUTenant
-        networks: 
+        networks:
           - management
           - s1u_network
           - sgi_network
@@ -43,13 +39,13 @@
               - s1u_network
               - sgi_network
       - name: VENBServiceInstance
-        networks: 
+        networks:
           - management
           - s1u_network
           - sgi_network
           - s11_network
       - name: VSPGWCTenant
-        networks: 
+        networks:
           - management
           - s11_network
           - spgw_network
@@ -58,36 +54,51 @@
             networks:
               - s11_network
           - name: VSPGWUTenant
-            networks: 
+            networks:
               - spgw_network
   - name: mcord_5
     networks:
       - name: flat_network_s1u
         subnet: 119.0.0.0/24
         permit_all_slices: True
-        template: s11_template
+        template: flat_template
+        owner: vspgwu
       - name: flat_network_s1mme
         subnet: 118.0.0.0/24
         permit_all_slices: True
-        template: s11_template
+        template: flat_template
+        owner: vmme
       - name: s11_network
         subnet: 112.0.0.0/24
         permit_all_slices: True
-        template: s11_template
+        template: private_template
+        owner: vspgwc
       - name: sgi_network
         subnet: 115.0.0.0/24
         permit_all_slices: True
-        template: sgi_template
+        owner: vspgwu
+        template: private_template
       - name: spgw_network
         subnet: 117.0.0.0/24
         permit_all_slices: True
-        template: spgw_template
+        template: private_template
+        owner: vspgwu
+      - name: s6a_network
+        subnet: 120.0.0.0/24
+        permit_all_slices: True
+        template: private_template
+        owner: vhss
     graph:
       - name: VMMETenant
         networks:
           - management
           - flat_network_s1mme
           - s11_network
+          - s6a_network
+        links:
+          - name: VHSSTenant
+            networks:
+              - s6a_network
       - name: VSPGWCTenant
         networks:
           - management
@@ -106,6 +117,10 @@
           - flat_network_s1u
           - sgi_network
           - spgw_network
+      - name: VHSSTenant
+        networks:
+          - management
+          - s6a_network
 
 dependency_graph: "/opt/xos/synchronizers/epc-service/model-deps"
 #steps_dir: "/opt/xos/synchronizers/epc-service/steps"