move preload to the sdnc interface

Issue-ID: TEST-173
Change-Id: Ie5cf74ebb20af3b9994ff6dfbec3a51f49cddef8
Signed-off-by: DR695H <dr695h@att.com>
diff --git a/red.xml b/red.xml
index 8124e7a..fe5eba7 100644
--- a/red.xml
+++ b/red.xml
@@ -18,6 +18,7 @@
     <referencedLibrary type="PYTHON" name="ONAPLibrary.Protobuf" path="testsuite/robot/library"/>
     <referencedLibrary type="PYTHON" name="ONAPLibrary.Utilities" path="testsuite/robot/library"/>
     <referencedLibrary type="PYTHON" name="ONAPLibrary.OOF" path="testsuite/robot/library"/>
+    <referencedLibrary type="PYTHON" name="ONAPLibrary.SDNC" path="testsuite/robot/library"/>
     <pythonpath>
         <path location="robot/library"/>
     </pythonpath>
diff --git a/robot/assets/templates/vcpeutils/template.network.json b/robot/assets/templates/sdnc/template.network.jinja
similarity index 73%
rename from robot/assets/templates/vcpeutils/template.network.json
rename to robot/assets/templates/sdnc/template.network.jinja
index 2acb9e3..02ea14f 100644
--- a/robot/assets/templates/vcpeutils/template.network.json
+++ b/robot/assets/templates/sdnc/template.network.jinja
@@ -11,25 +11,25 @@
     },
     "VNF-API:network-topology-information": {
       "VNF-API:network-topology-identifier": {
-        "VNF-API:network-role": "${network_role}",
+        "VNF-API:network-role": "{{network_role}}",
         "VNF-API:network-technology": "neutron",
-        "VNF-API:service-type": "${service_type}",
-        "VNF-API:network-name": "${network_name}",
-        "VNF-API:network-type": "${network_type}"
+        "VNF-API:service-type": "{{service_type}}",
+        "VNF-API:network-name": "{{network_name}}",
+        "VNF-API:network-type": "{{network_type}}"
       },
       "VNF-API:provider-network-information": {
         "VNF-API:is-external-network": "true",
-        "VNF-API:physical-network-name": "${network_name}",
+        "VNF-API:physical-network-name": "{{network_name}}",
         "VNF-API:is-provider-network": "true",
         "VNF-API:is-shared-network": "true"
       },
       "VNF-API:subnets": [
         {
-          "VNF-API:start-address": "${subnet_start_ip}",
+          "VNF-API:start-address": "{{subnet_start_ip}}",
           "VNF-API:cidr-mask": "24",
           "VNF-API:ip-version": "4",
           "VNF-API:dhcp-enabled": "N",
-          "VNF-API:gateway-address": "${subnet_gateway}"
+          "VNF-API:gateway-address": "{{subnet_gateway}}"
         }
 	]
     },
diff --git a/robot/assets/templates/vcpeutils/template.vcpe_gwgra_vfmodule.json b/robot/assets/templates/sdnc/template.vcpe_gwgra_vfmodule.jinja
similarity index 86%
rename from robot/assets/templates/vcpeutils/template.vcpe_gwgra_vfmodule.json
rename to robot/assets/templates/sdnc/template.vcpe_gwgra_vfmodule.jinja
index 48883b9..f1fec64 100644
--- a/robot/assets/templates/vcpeutils/template.vcpe_gwgra_vfmodule.json
+++ b/robot/assets/templates/sdnc/template.vcpe_gwgra_vfmodule.jinja
@@ -27,15 +27,15 @@
                                         },
 					{
 					    "name": "public_net_id", 
-					    "value": "${public_net_id}"
+					    "value": "{{public_net_id}}"
 					}, 
 					{
 					    "name": "mux_gw_private_net_id", 
-					    "value": "${mux_gw_net}"
+					    "value": "{{mux_gw_net}}"
 					}, 
 					{
 					    "name": "mux_gw_private_subnet_id", 
-					    "value": "${mux_gw_subnet}"
+					    "value": "{{mux_gw_subnet}}"
 					}, 
 					{
 					    "name": "mux_gw_private_net_cidr", 
@@ -43,11 +43,11 @@
 					}, 
 					{
 					    "name": "cpe_public_net_id", 
-					    "value": "${cpe_public_net}"
+					    "value": "{{cpe_public_net}}"
 					}, 
 					{
 					    "name": "cpe_public_subnet_id", 
-					    "value": "${cpe_public_subnet}"
+					    "value": "{{cpe_public_subnet}}"
 					}, 
 					{
 					    "name": "cpe_public_net_cidr", 
@@ -67,7 +67,7 @@
 					}, 
 					{
 					    "name": "vgw_name_0", 
-					    "value": "zdcpe1cpe01gw01_${suffix}"
+					    "value": "zdcpe1cpe01gw01_{{suffix}}"
 					}, 
 					{
 					    "name": "mux_ip_addr", 
@@ -79,11 +79,11 @@
 					}, 
 					{
 					    "name": "onap_private_net_id", 
-					    "value": "${oam_onap_net}"
+					    "value": "{{oam_onap_net}}"
 					}, 
 					{
 					    "name": "onap_private_subnet_id", 
-					    "value": "${oam_onap_subnet}"
+					    "value": "{{oam_onap_subnet}}"
 					}, 
 					{
 					    "name": "onap_private_net_cidr", 
@@ -111,7 +111,7 @@
 					}, 
 					{
 					    "name": "pub_key", 
-					    "value": "${pub_key}"
+					    "value": "{{pub_key}}"
 					}, 
 					{
 					    "name": "cloud_env", 
@@ -120,13 +120,13 @@
 				] },
 				"vf-module-assignments": {},
 				"vf-module-topology-identifier": {
-					"vf-module-name": "VGW2BRG-${brg_mac}"
+					"vf-module-name": "VGW2BRG-{{brg_mac}}"
 				}
 			},
 			"vnf-resource-assignments": {},
 			"vnf-topology-identifier-structure": {
 				"nf-type": "vgw",
-                                "vnf-id": "VGW2BRG-${brg_mac}" 
+                                "vnf-id": "VGW2BRG-{{brg_mac}}" 
 			}
 		}
 	}
diff --git a/robot/assets/templates/vcpeutils/template.vcpe_infra_vfmodule.json b/robot/assets/templates/sdnc/template.vcpe_infra_vfmodule.jinja
similarity index 76%
rename from robot/assets/templates/vcpeutils/template.vcpe_infra_vfmodule.json
rename to robot/assets/templates/sdnc/template.vcpe_infra_vfmodule.jinja
index 1f30e94..8babc7f 100644
--- a/robot/assets/templates/vcpeutils/template.vcpe_infra_vfmodule.json
+++ b/robot/assets/templates/sdnc/template.vcpe_infra_vfmodule.jinja
@@ -16,11 +16,11 @@
      },
      "VNF-API:vnf-topology-information": {
              "vnf-topology-identifier": {
-               "service-type": "${service_type}",
-               "vnf-type": "${vnf_type}",
-               "generic-vnf-name": "${generic_vnf_name}",
-               "generic-vnf-type": "${generic_vnf_type}",
-               "vnf-name": "${vnf_name}"
+               "service-type": "{{service_type}}",
+               "vnf-type": "{{vnf_type}}",
+               "generic-vnf-name": "{{generic_vnf_name}}",
+               "generic-vnf-type": "{{generic_vnf_type}}",
+               "vnf-name": "{{vnf_name}}"
        },
        "VNF-API:vnf-parameters": [
 	{
@@ -33,31 +33,31 @@
 	},
 	{
 	"vnf-parameter-name": "public_net_id",
-	"vnf-parameter-value": "${public_net_id}"
+	"vnf-parameter-value": "{{public_net_id}}"
 	},
 	{
 	"vnf-parameter-name": "cpe_signal_net_id",
-	"vnf-parameter-value": "${cpe_signal_net}"
+	"vnf-parameter-value": "{{cpe_signal_net}}"
 	},
 	{
 	"vnf-parameter-name": "cpe_signal_subnet_id",
-	"vnf-parameter-value": "${cpe_signal_subnet}" 
+	"vnf-parameter-value": "{{cpe_signal_subnet}}" 
 	},
 	{
 	"vnf-parameter-name": "cpe_public_net_id",
-	"vnf-parameter-value": "${cpe_public_net}"
+	"vnf-parameter-value": "{{cpe_public_net}}"
 	},
 	{
 	"vnf-parameter-name": "cpe_public_subnet_id",
-	"vnf-parameter-value": "${cpe_public_subnet}"
+	"vnf-parameter-value": "{{cpe_public_subnet}}"
 	},
 	{
 	"vnf-parameter-name": "onap_private_net_id",
-	"vnf-parameter-value": "${oam_onap_net}"
+	"vnf-parameter-value": "{{oam_onap_net}}"
 	},
 	{
 	"vnf-parameter-name": "onap_private_subnet_id",
-	"vnf-parameter-value": "${oam_onap_subnet}"
+	"vnf-parameter-value": "{{oam_onap_subnet}}"
 	},
 	{
 	"vnf-parameter-name": "onap_private_net_cidr",
@@ -105,35 +105,35 @@
 	},
 	{
 	"vnf-parameter-name": "mr_ip_addr",
-	"vnf-parameter-value": "${mr_ip_addr}"
+	"vnf-parameter-value": "{{mr_ip_addr}}"
 	},
 	{
 	"vnf-parameter-name": "mr_ip_port",
-	"vnf-parameter-value": "${mr_ip_port}"
+	"vnf-parameter-value": "{{mr_ip_port}}"
 	},
 	{
 	"vnf-parameter-name": "vaaa_name_0",
-	"vnf-parameter-value": "zdcpe1cpe01aaa01_${suffix}"
+	"vnf-parameter-value": "zdcpe1cpe01aaa01_{{suffix}}"
 	},
 	{
 	"vnf-parameter-name": "vdns_name_0",
-	"vnf-parameter-value": "zdcpe1cpe01dns01_${suffix}"
+	"vnf-parameter-value": "zdcpe1cpe01dns01_{{suffix}}"
 	},
 	{
 	"vnf-parameter-name": "vdhcp_name_0",
-	"vnf-parameter-value": "zdcpe1cpe01dhcp01_${suffix}"
+	"vnf-parameter-value": "zdcpe1cpe01dhcp01_{{suffix}}"
 	},
 	{
 	"vnf-parameter-name": "vweb_name_0",
-	"vnf-parameter-value": "zdcpe1cpe01web01_${suffix}"
+	"vnf-parameter-value": "zdcpe1cpe01web01_{{suffix}}"
 	},
 	{
 	"vnf-parameter-name": "vnf_id",
-	"vnf-parameter-value": "vCPE_Infrastructure_demo_app_${suffix}"
+	"vnf-parameter-value": "vCPE_Infrastructure_demo_app_{{suffix}}"
 	},
 	{
 	"vnf-parameter-name": "vf_module_id",
-	"vnf-parameter-value": "vCPE_Intrastructure_${suffix}"
+	"vnf-parameter-value": "vCPE_Intrastructure_{{suffix}}"
 	},
 	{
 	"vnf-parameter-name": "dcae_collector_ip",
@@ -165,7 +165,7 @@
 	},
 	{
 	"vnf-parameter-name": "pub_key",
-	"vnf-parameter-value": "${pub_key}"
+	"vnf-parameter-value": "{{pub_key}}"
 	},
 	{
 	"vnf-parameter-name": "cloud_env",
diff --git a/robot/assets/templates/vcpeutils/template.vcpe_vgw_vfmodule.json b/robot/assets/templates/sdnc/template.vcpe_vgw_vfmodule.jinja
similarity index 87%
rename from robot/assets/templates/vcpeutils/template.vcpe_vgw_vfmodule.json
rename to robot/assets/templates/sdnc/template.vcpe_vgw_vfmodule.jinja
index bd288b4..daf0d49 100644
--- a/robot/assets/templates/vcpeutils/template.vcpe_vgw_vfmodule.json
+++ b/robot/assets/templates/sdnc/template.vcpe_vgw_vfmodule.jinja
@@ -27,15 +27,15 @@
                 }, 
                 {
                     "vnf-parameter-name": "public_net_id", 
-                    "vnf-parameter-value": "${public_net_id}"
+                    "vnf-parameter-value": "{{public_net_id}}"
                 }, 
                 {
                     "vnf-parameter-name": "mux_gw_private_net_id", 
-                    "vnf-parameter-value": "${mux_gw_net}"
+                    "vnf-parameter-value": "{{mux_gw_net}}"
                 }, 
                 {
                     "vnf-parameter-name": "mux_gw_private_subnet_id", 
-                    "vnf-parameter-value": "${mux_gw_subnet}"
+                    "vnf-parameter-value": "{{mux_gw_subnet}}"
                 }, 
                 {
                     "vnf-parameter-name": "mux_gw_private_net_cidr", 
@@ -43,11 +43,11 @@
                 }, 
                 {
                     "vnf-parameter-name": "cpe_public_net_id", 
-                    "vnf-parameter-value": "${cpe_public_net}"
+                    "vnf-parameter-value": "{{cpe_public_net}}"
                 }, 
                 {
                     "vnf-parameter-name": "cpe_public_subnet_id", 
-                    "vnf-parameter-value": "${cpe_public_subnet}"
+                    "vnf-parameter-value": "{{cpe_public_subnet}}"
                 }, 
                 {
                     "vnf-parameter-name": "cpe_public_net_cidr", 
@@ -67,7 +67,7 @@
                 }, 
                 {
                     "vnf-parameter-name": "vgw_name_0", 
-                    "vnf-parameter-value": "zdcpe1cpe01gw01_${suffix}"
+                    "vnf-parameter-value": "zdcpe1cpe01gw01_{{suffix}}"
                 }, 
                 {
                     "vnf-parameter-name": "mux_ip_addr", 
@@ -79,11 +79,11 @@
                 }, 
                 {
                     "vnf-parameter-name": "onap_private_net_id", 
-                    "vnf-parameter-value": "${oam_onap_net}"
+                    "vnf-parameter-value": "{{oam_onap_net}}"
                 }, 
                 {
                     "vnf-parameter-name": "onap_private_subnet_id", 
-                    "vnf-parameter-value": "${oam_onap_subnet}"
+                    "vnf-parameter-value": "{{oam_onap_subnet}}"
                 }, 
                 {
                     "vnf-parameter-name": "onap_private_net_cidr", 
@@ -111,7 +111,7 @@
                 }, 
                 {
                     "vnf-parameter-name": "pub_key", 
-                    "vnf-parameter-value": "${pub_key}"
+                    "vnf-parameter-value": "{{pub_key}}"
                 }, 
                 {
                     "vnf-parameter-name": "cloud_env", 
@@ -122,7 +122,7 @@
                 "generic-vnf-name": "GENERIC-VGW-VNF-NAME0", 
                 "generic-vnf-type": "GENERIC-VGW-VNF-TYPE", 
                 "service-type": "VGW-SERVICE-TYPE", 
-                "vnf-name": "VGW2BRG-${brg_mac}", 
+                "vnf-name": "VGW2BRG-{{brg_mac}}", 
                 "vnf-type": "VGW-VNF-TYPE"
             }
         }
diff --git a/robot/assets/templates/vcpeutils/README.TXT b/robot/assets/templates/vcpeutils/README.TXT
deleted file mode 100644
index 8a0482d..0000000
--- a/robot/assets/templates/vcpeutils/README.TXT
+++ /dev/null
@@ -1,15 +0,0 @@
-#   Test templates using robot
-#        template.vfw_vfmodule.json
-#
-#   Remaining templates still to be tested with robot
-#        simple_neutron_heat.yaml
-#        template.network.json
-#        template_sniro_data.json
-#        template_sniro_request.json
-#        template.vcpe_bng_vfmodule.json
-#        template.vcpe_brgemu_vfmodule.json
-#        template.vcpe_gmux_vfmodule.json
-#        template.vcpe_gwgra_vfmodule.json
-#        template.vcpe_infra_vfmodule.json
-#        template.vcpe_vgw_vfmodule.json
-
diff --git a/robot/assets/templates/vcpeutils/template_sniro_data.sniro b/robot/assets/templates/vcpeutils/template_sniro_data.jinja
similarity index 100%
rename from robot/assets/templates/vcpeutils/template_sniro_data.sniro
rename to robot/assets/templates/vcpeutils/template_sniro_data.jinja
diff --git a/robot/resources/sdngc_interface.robot b/robot/resources/sdngc_interface.robot
index f36e08e..b48172f 100644
--- a/robot/resources/sdngc_interface.robot
+++ b/robot/resources/sdngc_interface.robot
@@ -3,18 +3,22 @@
 Library 	      RequestsLibrary
 Library	          ONAPLibrary.Utilities
 Library 	    SeleniumLibrary
+Library        OperatingSystem
 Library         Collections
 Library      String
 Library           ONAPLibrary.ServiceMapping
 Library           ONAPLibrary.Templating
+Library           ONAPLibrary.SDNC
 Resource          global_properties.robot
 Resource        browser_setup.robot
 
 
 *** Variables ***
 ${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH}  /operations/VNF-API:preload-vnf-topology-operation
+${PRELOAD_NETWORK_TOPOLOGY_OPERATION_PATH}  /operations/VNF-API:preload-network-topology-operation
+${PRELOAD_GR_TOPOLOGY_OPERATION_PATH}     /operations/GENERIC-RESOURCE-API:preload-vf-module-topology-operation
 ${PRELOAD_VNF_CONFIG_PATH}  /config/VNF-API:preload-vnfs/vnf-preload-list
-${PRELOAD_VNF_TOPOLOGY_OPERATION_BODY}  sdnc
+${PRELOAD_TOPOLOGY_OPERATION_BODY}  sdnc
 ${SDNGC_INDEX_PATH}    /restconf
 ${SDNCGC_HEALTHCHECK_OPERATION_PATH}  /operations/SLI-API:healthcheck
 ${SDNGC_REST_ENDPOINT}    ${GLOBAL_SDNGC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDNC_IP_ADDR}:${GLOBAL_SDNGC_REST_PORT}
@@ -22,6 +26,7 @@
 ${SDNGC_ADMIN_SIGNUP_URL}    ${SDNGC_ADMIN_ENDPOINT}/signup
 ${SDNGC_ADMIN_LOGIN_URL}    ${SDNGC_ADMIN_ENDPOINT}/login
 ${SDNGC_ADMIN_VNF_PROFILE_URL}    ${SDNGC_ADMIN_ENDPOINT}/mobility/getVnfProfile
+${VNF_KEYPAIR_SSH_KEY}    robot/assets/keys/onap_dev_public.txt
 
 *** Keywords ***
 Run SDNGC Health Check
@@ -34,51 +39,74 @@
     [Documentation]    Runs an SDNGC get request
     [Arguments]    ${data_path}
     ${auth}=  Create List  ${GLOBAL_SDNGC_USERNAME}    ${GLOBAL_SDNGC_PASSWORD}
-    Log    Creating session ${SDNGC_REST_ENDPOINT}
-    ${session}=    Create Session 	sdngc 	${SDNGC_REST_ENDPOINT}    auth=${auth}
-    ${uuid}=    Generate UUID4
-    ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
-    ${resp}= 	Get Request 	sdngc 	${data_path}     headers=${headers}
-    Log    Received response from sdngc ${resp.text}
+    ${resp}= 	Run Get Request 	${SDNGC_REST_ENDPOINT}    ${data_path}     auth=${auth}
     [Return]    ${resp}
 
 Run SDNGC Put Request
     [Documentation]    Runs an SDNGC put request
     [Arguments]    ${data_path}    ${data}
     ${auth}=  Create List  ${GLOBAL_SDNGC_USERNAME}    ${GLOBAL_SDNGC_PASSWORD}
-    Log    Creating session ${SDNGC_REST_ENDPOINT}
-    ${session}=    Create Session 	sdngc 	${SDNGC_REST_ENDPOINT}    auth=${auth}
-    ${uuid}=    Generate UUID4
-    ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
-    ${resp}= 	Put Request 	sdngc 	${data_path}     data=${data}    headers=${headers}
-    Log    Received response from sdngc ${resp.text}
+    ${resp}= 	Run Put Request 	${SDNGC_REST_ENDPOINT} 	${data_path}     data=${data}    auth=${auth}
     [Return]    ${resp}
 
 Run SDNGC Post Request
     [Documentation]    Runs an SDNGC post request
     [Arguments]    ${data_path}    ${data}
     ${auth}=  Create List  ${GLOBAL_SDNGC_USERNAME}    ${GLOBAL_SDNGC_PASSWORD}
-    Log    Creating session ${SDNGC_REST_ENDPOINT}
-    ${session}=    Create Session 	sdngc 	${SDNGC_REST_ENDPOINT}    auth=${auth}
-    ${uuid}=    Generate UUID4
-    ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
-    ${resp}= 	Post Request 	sdngc 	${data_path}     data=${data}    headers=${headers}
-    Log    Received response from sdngc ${resp.text}
+    ${resp}= 	Run Post Request 	${SDNGC_REST_ENDPOINT} 	${data_path}     data=${data}    auth=${auth}
     [Return]    ${resp}
 
-Run SDNGC Delete Request
-    [Documentation]    Runs an SDNGC delete request
-    [Arguments]    ${data_path}
-    ${auth}=  Create List  ${GLOBAL_SDNGC_USERNAME}    ${GLOBAL_SDNGC_PASSWORD}
-    Log    Creating session ${SDNGC_REST_ENDPOINT}
-    ${session}=    Create Session 	sdngc 	${SDNGC_REST_ENDPOINT}    auth=${auth}
-    ${uuid}=    Generate UUID4
-    ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
-    ${resp}= 	Delete Request 	sdngc 	${data_path}        headers=${headers}
-    Log    Received response from sdngc ${resp.text}
-    [Return]    ${resp}
+Preload Vcpe Networks
+    Preload Network    cpe_public    10.2.0.2	 10.2.0.1
+    Preload Network    cpe_signal    10.4.0.2    10.4.0.1
+    Preload Network    brg_bng    10.3.0.2    10.3.0.1
+    Preload Network    bng_mux    10.1.0.10    10.1.0.1
+    Preload Network    mux_gw    10.5.0.10    10.5.0.1
 
+Preload Network
+    [Arguments]    ${network_role}     ${subnet_start_ip}    ${subnet_gateway}
+    ${name_suffix}=    Generate Timestamp
+    ${network_name}=     Catenate    SEPARATOR=_    net	    ${network_role}	    ${name_suffix}
+    ${subnet_name}=     Catenate    SEPARATOR=_    net	    ${network_role}	    subnet    ${name_suffix}
+    ${parameters}=     Create Dictionary    network_role=${network_role}    service_type=vCPE    network_type=Generic NeutronNet    network_name=${network_name}    subnet_start_ip=${subnet_start_ip}    subnet_gateway=${subnet_gateway}
+    Create Environment    sdnc    ${GLOBAL_TEMPLATE_FOLDER}
+    ${data}=   Apply Template    sdnc   ${PRELOAD_TOPOLOGY_OPERATION_BODY}/template.network.jinja   ${parameters}
+	${post_resp}=    Run SDNGC Post Request     ${SDNGC_INDEX_PATH}${PRELOAD_NETWORK_TOPOLOGY_OPERATION_PATH}     ${data}
+    [Return]    ${network_name}   ${subnet_name}
 
+Preload Vcpe vGW
+    [Arguments]    ${brg_mac}    ${cpe_network_name}   ${cpe_subnet_name}    ${mux_gw_net}    ${mux_gw_subnet}
+    ${name_suffix}=    Generate Timestamp
+    ${ssh_key}=    OperatingSystem.Get File     ${VNF_KEYPAIR_SSH_KEY}
+    ${parameters}=     Create Dictionary    pub_key=${ssh_key}    brg_mac=${brg_mac}    cpe_public_net=${cpe_network_name}     cpe_public_subnet=${cpe_subnet_name}    mux_gw_net=${mux_gw_net}	mux_gw_subnet=${mux_gw_subnet}    suffix=${name_suffix}    oam_onap_net=oam_network_2No2        oam_onap_subnet=oam_network_2No2        public_net_id=${GLOBAL_INJECTED_PUBLIC_NET_ID}
+    Create Environment    sdnc    ${GLOBAL_TEMPLATE_FOLDER}
+    ${data}=   Apply Template    sdnc   ${PRELOAD_TOPOLOGY_OPERATION_BODY}/template.vcpe_vgw_vfmodule.jinja   ${parameters}
+	${post_resp}=    Run SDNGC Post Request     ${SDNGC_INDEX_PATH}${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH}   ${data}
+
+Preload Vcpe vGW Gra
+    [Arguments]    ${brg_mac}	${cpe_public_network_name}   ${cpe_public_subnet_name}    ${mux_gw_net}    ${mux_gw_subnet}
+    ${name_suffix}=    Generate Timestamp
+    ${ssh_key}=    OperatingSystem.Get File     ${VNF_KEYPAIR_SSH_KEY}
+    ${parameters}=     Create Dictionary    pub_key=${ssh_key}    brg_mac=${brg_mac}    cpe_public_net=${cpe_public_network_name}     cpe_public_subnet=${cpe_public_subnet_name}    mux_gw_net=${mux_gw_net}	mux_gw_subnet=${mux_gw_subnet}    suffix=${name_suffix}    oam_onap_net=oam_network_2No2        oam_onap_subnet=oam_network_2No2        public_net_id=${GLOBAL_INJECTED_PUBLIC_NET_ID}
+    Create Environment    sdnc    ${GLOBAL_TEMPLATE_FOLDER}
+    ${data}=   Apply Template    sdnc   ${PRELOAD_TOPOLOGY_OPERATION_BODY}/template.vcpe_gwgra_vfmodule.jinja   ${parameters}
+	${post_resp}=    Run SDNGC Post Request     ${SDNGC_INDEX_PATH}${PRELOAD_GR_TOPOLOGY_OPERATION_PATH}   ${data}
+
+Preload Generic VfModule
+    [Arguments]    ${service_instance_id}	${vnf_model}   ${model_customization_name}    ${short_model_customization_name}	    ${cpe_public_network_name}=None   ${cpe_public_subnet_name}=None   ${cpe_signal_network_name}=None   ${cpe_signal_subnet_name}=None
+    ${name_suffix}=    Generate Timestamp
+    ${ssh_key}=    OperatingSystem.Get File     ${VNF_KEYPAIR_SSH_KEY}
+    ${vfmodule_name}=     Catenate    SEPARATOR=_    vf	    ${short_model_customization_name}	    ${name_suffix}
+    #TODO this became a mess, need to fix
+    ${parameters}=     Create Dictionary    pub_key=${ssh_key}    suffix=${name_suffix}    mr_ip_addr=${GLOBAL_INJECTED_MR_IP_ADDR}    mr_ip_port=${GLOBAL_MR_SERVER_PORT}
+    Set To Dictionary    ${parameters}    oam_onap_net=oam_network_2No2        oam_onap_subnet=oam_network_2No2    cpe_public_net=${cpe_public_network_name}     cpe_public_subnet=${cpe_public_subnet_name}    
+    Set To Dictionary    ${parameters}    cpe_signal_subnet=${cpe_signal_subnet_name}    cpe_signal_net=${cpe_signal_network_name}    public_net_id=${GLOBAL_INJECTED_PUBLIC_NET_ID}
+    # vnf_type and generic_vnf_type are identical
+    Set To Dictionary    ${parameters}    vnf_type=${model_customization_name}    generic_vnf_type=${model_customization_name}    generic_vnf_name=${model_customization_name}    vnf_name=${vfmodule_name}    
+    Set To Dictionary    ${parameters}    service_type=${service_instance_id}    sdnc_oam_ip=${GLOBAL_INJECTED_SDNC_IP_ADDR}
+	${post_resp}=    Preload Vfmodule    ${SDNGC_REST_ENDPOINT}    ${SDNGC_INDEX_PATH}${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH}    ${GLOBAL_TEMPLATE_FOLDER}    ${PRELOAD_TOPOLOGY_OPERATION_BODY}/template.vcpe_infra_vfmodule.jinja    ${parameters}
+    [Return]    ${post_resp}
+	    
 Preload Vnf
     [Arguments]    ${service_type_uuid}    ${generic_vnf_name}    ${generic_vnf_type}     ${vf_module_name}    ${vf_modules}    ${service}   ${uuid}
     ${base_vf_module_type}=    Catenate
@@ -104,7 +132,6 @@
     \       Preload One Vnf Topology    ${service_type_uuid}    ${generic_vnf_name}    ${generic_vnf_type}     ${vf_name}    ${vf_module_type}    ${service}    ${filename}   ${uuid}
     [Return]    ${base_vf_module_type}   ${closedloop_vf_module}
 
-
 Update Module Name
     [Arguments]    ${dict}    ${vf_module_name}
     Return From Keyword If    'prefix' not in ${dict}    ${vf_module_name}
@@ -136,11 +163,10 @@
     ${parameters}=    Get Template Parameters    ${generic_vnf_name}    ${filename}   ${uuid}
     Set To Dictionary   ${parameters}   generic_vnf_name=${generic_vnf_name}     generic_vnf_type=${generic_vnf_type}  service_type=${service_type_uuid}    vf_module_name=${vf_module_name}    vf_module_type=${vf_module_type}
     Create Environment    sdnc    ${GLOBAL_TEMPLATE_FOLDER}
-    ${data}=   Apply Template    sdnc   ${PRELOAD_VNF_TOPOLOGY_OPERATION_BODY}/preload.jinja    ${parameters}
+    ${data}=   Apply Template    sdnc   ${PRELOAD_TOPOLOGY_OPERATION_BODY}/preload.jinja    ${parameters}
 	${put_resp}=    Run SDNGC Post Request     ${SDNGC_INDEX_PATH}${PRELOAD_VNF_TOPOLOGY_OPERATION_PATH}     ${data}
     Should Be Equal As Strings 	${put_resp.json()['output']['response-code']} 	200
     ${get_resp}=  Run SDNGC Get Request  ${SDNGC_INDEX_PATH}${PRELOAD_VNF_CONFIG_PATH}/${vf_module_name}/${vf_module_type}
-    Should Be Equal As Strings 	${get_resp.status_code} 	200
 
 Get Template Parameters
     [Arguments]   ${generic_vnf_name}    ${template}    ${uuid}