SOURCE ../default/create_mso_db-default.sql

USE `mso_requests`;
DROP USER 'mso';
CREATE USER 'mso';
GRANT ALL on mso_requests.* to 'mso' identified by 'mso123' with GRANT OPTION;
FLUSH PRIVILEGES;

USE `mso_catalog`;
DROP USER 'catalog';
CREATE USER 'catalog';
GRANT ALL on mso_catalog.* to 'catalog' identified by 'catalog123' with GRANT OPTION;
FLUSH PRIVILEGES;

SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;

INSERT INTO `heat_environment` (`ARTIFACT_UUID`, `NAME`, `VERSION`, `DESCRIPTION`, `BODY`, `ARTIFACT_CHECKSUM`, `CREATION_TIMESTAMP`) VALUES ('EnvArtifact-UUID6','base_vcpe_vbrgemu.env','1.0','base_vcpe_vbrgemu ENV file','parameters:\n  vcpe_image_name: PUT THE IMAGE NAME HERE (Ubuntu 1604 or vbrg-base-ubuntu-16-04 SUGGESTED)\n  vcpe_flavor_name: PUT THE FLAVOR NAME HERE (MEDIUM FLAVOR SUGGESTED)\n  compile_state: PUT THE COMPILE STATE (done, auto or build)\n  public_net_id: PUT THE PUBLIC NETWORK ID HERE\n  vbrgemu_bng_private_net_id: zdfw1bngin01_private\n  vbrgemu_bng_private_subnet_id: zdfw1bngin01_sub_private\n  vbrgemu_bng_private_net_cidr: 10.3.0.0/24\n  vbrgemu_private_ip_0: 10.3.0.4\n  sdnc_ip: 10.0.7.1\n  vbrgemu_name_0: zdcpe1cpe01brgemu01\n  vnf_id: vCPE_Infrastructure_BGREMU_demo_app\n  vf_module_id: vCPE_Customer_BRGEMU\n  repo_url_blob: https://nexus.onap.org/content/sites/raw\n  repo_url_artifacts: https://nexus.onap.org/content/groups/staging\n  demo_artifacts_version: 1.2.0\n  install_script_version: 1.2.0-SNAPSHOT\n  key_name: vbrgemu_key\n  pub_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKXDgoo3+WOqcUG8/5uUbk81+yczgwC4Y8ywTmuQqbNxlY1oQ0YxdMUqUnhitSXs5S/yRuAVOYHwGg2mCs20oAINrP+mxBI544AMIb9itPjCtgqtE2EWo6MmnFGbHB4Sx3XioE7F4VPsh7japsIwzOjbrQe+Mua1TGQ5d4nfEOQaaglXLLPFfuc7WbhbJbK6Q7rHqZfRcOwAMXgDoBqlyqKeiKwnumddo2RyNT8ljYmvB6buz7KnMinzo7qB0uktVT05FH9Rg0CTWH5norlG5qXgP2aukL0gk1ph8iAt7uYLf1ktp+LJI2gaF6L0/qli9EmVCSLr1uJ38Q8CBflhkh\n  cloud_env: PUT THE CLOUD PROVIDED HERE (openstack or rackspace)\n  vpp_source_repo_url: https://gerrit.fd.io/r/vpp\n  vpp_source_repo_branch: stable/1704\n  hc2vpp_source_repo_url: https://gerrit.fd.io/r/hc2vpp\n  hc2vpp_source_repo_branch: stable/1704\n  vpp_patch_url: https://git.onap.org/demo/plain/vnfs/vCPE/vpp-option-82-for-vbrg/src/patches/VPP-Add-Option82-Nat-Filter-For-vBRG.patch\n ','MANUAL RECORD','2018-04-28 13:04:07');

INSERT INTO `heat_template` (`ARTIFACT_UUID`, `NAME`, `VERSION`, `DESCRIPTION`, `BODY`, `TIMEOUT_MINUTES`, `ARTIFACT_CHECKSUM`, `CREATION_TIMESTAMP`) VALUES ('Artifact-UUID6','base_vcpe_vbrgemu.yaml','1.0','Base VBRGEMU Heat','heat_template_version: 2013-05-23\n\ndescription: Heat template to deploy vCPE vBRG Emulator (vBRGEMU)\n\nparameters:\n  vcpe_image_name:\n    type: string\n    label: Image name or ID\n    description: Image to be used for compute instance\n  vcpe_flavor_name:\n    type: string\n    label: Flavor\n    description: Type of instance (flavor) to be used\n  public_net_id:\n    type: string\n    label: Public network name or ID\n    description: Public network that enables remote connection to VNF\n  vbrgemu_bng_private_net_id:\n    type: string\n    label: vBNG private network name or ID\n    description: Private network that connects vBRGEMU to vBNG\n  vbrgemu_bng_private_subnet_id:\n    type: string\n    label: vBNG private sub-network name or ID\n    description: vBNG private sub-network name or ID\n  vbrgemu_bng_private_net_cidr:\n    type: string\n    label: vBNG IN private network CIDR\n    description: The CIDR of the input side of vBNG private network\n  vbrgemu_private_ip_0:\n    type: string\n    label: vGW private IP address\n    description: Private IP address towards the BRGEMU-BNG network\n  vbrgemu_name_0:\n    type: string\n    label: vGW  name\n    description: Name of the vGW\n  vnf_id:\n    type: string\n    label: VNF ID\n    description: The VNF ID is provided by ONAP\n  vf_module_id:\n    type: string\n    label: vCPE module ID\n    description: The vCPE Module ID is provided by ONAP\n  key_name:\n    type: string\n    label: Key pair name\n    description: Public/Private key pair name\n  pub_key:\n    type: string\n    label: Public key\n    description: Public key to be installed on the compute instance\n  repo_url_blob:\n    type: string\n    label: Repository URL\n    description: URL of the repository that hosts the demo packages\n  repo_url_artifacts:\n    type: string\n    label: Repository URL\n    description: URL of the repository that hosts the demo packages\n  install_script_version:\n    type: string\n    label: Installation script version number\n    description: Version number of the scripts that install the vFW demo app\n  demo_artifacts_version:\n    type: string\n    label: Artifacts version used in demo vnfs\n    description: Artifacts (jar, tar.gz) version used in demo vnfs\n  cloud_env:\n    type: string\n    label: Cloud environment\n    description: Cloud environment (e.g., openstack, rackspace)\n  vpp_source_repo_url:\n    type: string\n    label: VPP Source Git Repo\n    description: URL for VPP source codes\n  vpp_source_repo_branch:\n    type: string\n    label: VPP Source Git Branch\n    description: Git Branch for the VPP source codes\n  hc2vpp_source_repo_url:\n    type: string\n    label: Honeycomb Source Git Repo\n    description: URL for Honeycomb source codes\n  hc2vpp_source_repo_branch:\n    type: string\n    label: Honeycomb Source Git Branch\n    description: Git Branch for the Honeycomb source codes\n  vpp_patch_url:\n    type: string\n    label: VPP Patch URL\n    description: URL for VPP patch for vBRG Emulator\n  sdnc_ip:\n    type: string\n    label: SDNC ip address\n    description: SDNC ip address used to set NAT\n  compile_state:\n    type: string\n    label: Compile State\n    description: State to compile code or not\n\nresources:\n\n  random-str:\n    type: OS::Heat::RandomString\n    properties:\n      length: 4\n\n  my_keypair:\n    type: OS::Nova::KeyPair\n    properties:\n      name:\n        str_replace:\n          template: base_rand\n          params:\n            base: { get_param: key_name }\n            rand: { get_resource: random-str }\n      public_key: { get_param: pub_key }\n      save_private_key: false\n\n  vbrgemu_private_0_port:\n    type: OS::Neutron::Port\n    properties:\n      network: { get_param: vbrgemu_bng_private_net_id }\n      fixed_ips: [{"subnet": { get_param: vbrgemu_bng_private_subnet_id }, "ip_address": { get_param: vbrgemu_private_ip_0 }}]\n\n  vbrgemu_0:\n    type: OS::Nova::Server\n    properties:\n      image: { get_param: vcpe_image_name }\n      flavor: { get_param: vcpe_flavor_name }\n      name: { get_param: vbrgemu_name_0 }\n      key_name: { get_resource: my_keypair }\n      networks:\n        - network: { get_param: public_net_id }\n        - port: { get_resource: vbrgemu_private_0_port }\n      metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}\n      user_data_format: RAW\n      user_data:\n        str_replace:\n          params:\n            __brgemu_bng_private_net_cidr__: { get_param: vbrgemu_bng_private_net_cidr }\n            __repo_url_blob__ : { get_param: repo_url_blob }\n            __repo_url_artifacts__ : { get_param: repo_url_artifacts }\n            __demo_artifacts_version__ : { get_param: demo_artifacts_version }\n            __install_script_version__ : { get_param: install_script_version }\n            __cloud_env__ : { get_param: cloud_env }\n            __vpp_source_repo_url__ : { get_param: vpp_source_repo_url }\n            __vpp_source_repo_branch__ : { get_param: vpp_source_repo_branch }\n            __hc2vpp_source_repo_url__ : { get_param: hc2vpp_source_repo_url }\n            __hc2vpp_source_repo_branch__ : { get_param: hc2vpp_source_repo_branch }\n            __vpp_patch_url__ : { get_param: vpp_patch_url }\n            __sdnc_ip__ : { get_param: sdnc_ip }\n            __compile_state__ : { get_param: compile_state }\n          template: |\n            #!/bin/bash\n\n            mkdir /opt/config\n            echo "__brgemu_bng_private_net_cidr__" > /opt/config/brgemu_bng_private_net_cidr.txt\n            echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt\n            echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt\n            echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt\n            echo "__install_script_version__" > /opt/config/install_script_version.txt\n            echo "__cloud_env__" > /opt/config/cloud_env.txt\n            echo "__vpp_source_repo_url__" > /opt/config/vpp_source_repo_url.txt\n            echo "__vpp_source_repo_branch__" > /opt/config/vpp_source_repo_branch.txt\n            echo "__hc2vpp_source_repo_url__" > /opt/config/hc2vpp_source_repo_url.txt\n            echo "__hc2vpp_source_repo_branch__" > /opt/config/hc2vpp_source_repo_branch.txt\n            echo "__vpp_patch_url__" > /opt/config/vpp_patch_url.txt\n            echo "__sdnc_ip__" > /opt/config/sdnc_ip.txt\n            echo "__compile_state__" > /opt/config/compile_state.txt\n\n            curl -k __repo_url_blob__/org.onap.demo/vnfs/vcpe/__install_script_version__/v_brgemu_install.sh -o /opt/v_brgemu_install.sh\n            cd /opt\n            chmod +x v_brgemu_install.sh\n            ./v_brgemu_install.sh\n ', 300, 'MANUAL RECORD', '2018-04-28 13:04:07');

INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','vpp_patch_url','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','hc2vpp_source_repo_branch','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','hc2vpp_source_repo_url','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','vpp_source_repo_branch','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','vpp_source_repo_url','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','cloud_env','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','pub_key','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','key_name','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','install_script_version','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','demo_artifacts_version','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','repo_url_artifacts','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','repo_url_blob','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','vf_module_id','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','vnf_id','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','vbrgemu_name_0','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','sdnc_ip','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','vbrgemu_private_ip_0','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','vbrgemu_bng_private_net_cidr','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','vbrgemu_bng_private_subnet_id','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','vbrgemu_bng_private_net_id','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','public_net_id','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','compile_state','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','vcpe_flavor_name','','string',NULL);
INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID6','vcpe_image_name','','string',NULL);

INSERT INTO `service` (`MODEL_UUID`, `MODEL_NAME`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `DESCRIPTION`, `CREATION_TIMESTAMP`, `TOSCA_CSAR_ARTIFACT_UUID`) VALUES ('a94f8ff8-442d-11e8-8a14-0320c6d83cc0','vbrgemu-service','fba765a0-442d-11e8-b89d-57dec24c6cba','1.0','VBRGEMU service','2018-04-28 13:04:07',NULL);

INSERT INTO `vf_module` (`MODEL_UUID`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `MODEL_NAME`, `DESCRIPTION`, `IS_BASE`, `HEAT_TEMPLATE_ARTIFACT_UUID`, `VOL_HEAT_TEMPLATE_ARTIFACT_UUID`, `CREATION_TIMESTAMP`, `VNF_RESOURCE_MODEL_UUID`) VALUES ('1e34774e-715e-4fd5-bd08-7b654622f33f.VF_RI1_VFW::module-1::module-1.group','585822c7-4027-4f84-ba50-e9248606f134','1.0','VF_RI1_VFW::module-1',NULL,1,'Artifact-UUID6',NULL,'2018-04-28 13:04:07','685822c7-4027-4f84-ba50-e9248606f132');

INSERT INTO `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`, `LABEL`, `INITIAL_COUNT`, `MIN_INSTANCES`, `MAX_INSTANCES`, `AVAILABILITY_ZONE_COUNT`, `HEAT_ENVIRONMENT_ARTIFACT_UUID`, `VOL_ENVIRONMENT_ARTIFACT_UUID`, `CREATION_TIMESTAMP`, `VF_MODULE_MODEL_UUID`) VALUES ('5aa23938-a9fe-11e7-8b4b-0242ac120002',NULL,1,0,NULL,NULL,'EnvArtifact-UUID6',NULL,'2018-04-28 18:52:03','1e34774e-715e-4fd5-bd08-7b654622f33f.VF_RI1_VFW::module-1::module-1.group');

INSERT INTO `vnf_res_custom_to_vf_module_custom` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`, `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`, `CREATION_TIMESTAMP`) VALUES ('5a9bd247-a9fe-11e7-8b4b-0242ac120002','5aa23938-a9fe-11e7-8b4b-0242ac120002','2018-04-28 18:52:03');

INSERT INTO `vnf_resource` (`ORCHESTRATION_MODE`, `DESCRIPTION`, `CREATION_TIMESTAMP`, `MODEL_UUID`, `AIC_VERSION_MIN`, `AIC_VERSION_MAX`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `MODEL_NAME`, `TOSCA_NODE_TYPE`, `HEAT_TEMPLATE_ARTIFACT_UUID`) VALUES ('HEAT','VBRGEMU service1707MIGRATED','2018-04-28 13:04:07','685822c7-4027-4f84-ba50-e9248606f132',NULL,NULL,'585822c7-4027-4f84-ba50-e9248606f113','1.0','VFWResource',NULL,NULL);

INSERT INTO `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`, `MODEL_INSTANCE_NAME`, `MIN_INSTANCES`, `MAX_INSTANCES`, `AVAILABILITY_ZONE_MAX_COUNT`, `NF_TYPE`, `NF_ROLE`, `NF_FUNCTION`, `NF_NAMING_CODE`, `CREATION_TIMESTAMP`, `VNF_RESOURCE_MODEL_UUID`) VALUES ('5a9bd247-a9fe-11e7-8b4b-0242ac120002','VBRGEMUResource-1',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2018-04-28 18:52:03','685822c7-4027-4f84-ba50-e9248606f132');

SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
