aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/pnfsimulator/deployment
diff options
context:
space:
mode:
Diffstat (limited to 'test/mocks/pnfsimulator/deployment')
-rw-r--r--test/mocks/pnfsimulator/deployment/assembly.xml35
-rw-r--r--test/mocks/pnfsimulator/deployment/pom.xml52
-rw-r--r--test/mocks/pnfsimulator/deployment/src/MANIFEST.json17
-rw-r--r--test/mocks/pnfsimulator/deployment/src/simulators_heat_template.env10
-rw-r--r--test/mocks/pnfsimulator/deployment/src/simulators_heat_template.yaml147
5 files changed, 261 insertions, 0 deletions
diff --git a/test/mocks/pnfsimulator/deployment/assembly.xml b/test/mocks/pnfsimulator/deployment/assembly.xml
new file mode 100644
index 000000000..a0609efd3
--- /dev/null
+++ b/test/mocks/pnfsimulator/deployment/assembly.xml
@@ -0,0 +1,35 @@
+<!--
+ ============LICENSE_START=======================================================
+ Simulator
+ ================================================================================
+ Copyright (C) 2019 Nokia. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <id>resources</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <fileSets>
+
+ <fileSet>
+ <directory>src</directory>
+ <outputDirectory>.</outputDirectory>
+ </fileSet>
+ </fileSets>
+</assembly> \ No newline at end of file
diff --git a/test/mocks/pnfsimulator/deployment/pom.xml b/test/mocks/pnfsimulator/deployment/pom.xml
new file mode 100644
index 000000000..25fe08b49
--- /dev/null
+++ b/test/mocks/pnfsimulator/deployment/pom.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ Simulator
+ ================================================================================
+ Copyright (C) 2019 Nokia. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.onap.simulator</groupId>
+ <artifactId>simulator-parent</artifactId>
+ <version>5.0.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>onboarding-package</artifactId>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptor>assembly.xml</descriptor>
+ <finalName>pnf-pnp-simulators</finalName>
+ <outputDirectory>.</outputDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/test/mocks/pnfsimulator/deployment/src/MANIFEST.json b/test/mocks/pnfsimulator/deployment/src/MANIFEST.json
new file mode 100644
index 000000000..fecdda996
--- /dev/null
+++ b/test/mocks/pnfsimulator/deployment/src/MANIFEST.json
@@ -0,0 +1,17 @@
+{
+ "name": "",
+ "description": "",
+ "data": [
+ {
+ "file": "simulators_heat_template.yaml",
+ "type": "HEAT",
+ "isBase": "true",
+ "data": [
+ {
+ "file": "simulators_heat_template.env",
+ "type": "HEAT_ENV"
+ }
+ ]
+ }
+ ]
+}
diff --git a/test/mocks/pnfsimulator/deployment/src/simulators_heat_template.env b/test/mocks/pnfsimulator/deployment/src/simulators_heat_template.env
new file mode 100644
index 000000000..cf2db52bf
--- /dev/null
+++ b/test/mocks/pnfsimulator/deployment/src/simulators_heat_template.env
@@ -0,0 +1,10 @@
+parameters:
+ image_name: ubuntu-14-04-cloud-amd64
+ flavor_name: m1.medium
+ public_net_id: 41eae12a-27f7-4ace-9fda-3cd55c7c0651
+ private_net_id: 41eae12a-27f7-4ace-9fda-3cd55c7c0651
+ private_subnet_id: 41eae12a-27f7-4ace-9fda-3cd55c7c0651
+ proxy: http://10.10.10.10:8080
+ vnf_id: simulators_vnf
+ vf_module_id: simulators_vsp
+ key_name: onap-dev \ No newline at end of file
diff --git a/test/mocks/pnfsimulator/deployment/src/simulators_heat_template.yaml b/test/mocks/pnfsimulator/deployment/src/simulators_heat_template.yaml
new file mode 100644
index 000000000..253fcc735
--- /dev/null
+++ b/test/mocks/pnfsimulator/deployment/src/simulators_heat_template.yaml
@@ -0,0 +1,147 @@
+description: Heat template that deploys PnP PNF simulators
+heat_template_version: '2013-05-23'
+parameters:
+ flavor_name: {description: Type of instance (flavor) to be used, label: Flavor,
+ type: string}
+ image_name: {description: Image to be used for compute instance, label: Image name
+ or ID, type: string}
+ key_name: {description: Public/Private key pair name, label: Key pair name, type: string}
+ public_net_id: {description: Public network that enables remote connection to VNF,
+ label: Public network name or ID, type: string}
+ private_net_id: {type: string, description: Private network id, label: Private network name or ID}
+ private_subnet_id: {type: string, description: Private subnet id, label: Private subnetwork name or ID}
+ proxy: {type: string, description: Proxy, label: Proxy, default: ""}
+ vnf_id: {type: string, label: VNF ID, description: The VNF ID is provided by ONAP}
+ vf_module_id: {type: string, label: vBase module ID, description: The vBase Module ID is provided by ONAP}
+resources:
+ PNF_PnP_simulator:
+ type: OS::Nova::Server
+ properties:
+ key_name: { get_param: key_name }
+ image: { get_param: image_name }
+ flavor: { get_param: flavor_name }
+ networks:
+ - port: { get_resource: PNF_PnP_simulator_port0 }
+ user_data_format: RAW
+ user_data:
+ str_replace:
+ template: |
+ #!/bin/bash
+
+ set_versions () {
+ DOCKER_VERSION=17.03
+ DOCKER_COMPOSE_VERSION=1.22.0
+ }
+
+ set_proxy () {
+ HTTP_PROXY=$proxy
+ HTTPS_PROXY=$proxy
+ http_proxy=$proxy
+ https_proxy=$proxy
+ export HTTP_PROXY=$proxy
+ export HTTPS_PROXY=$proxy
+ export http_proxy=$proxy
+ export https_proxy=$proxy
+ }
+
+ enable_root_ssh () {
+ sed -i 's/PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
+ sed -i 's/PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config
+ service sshd restart
+ echo -e "arthur\narthur" | passwd root
+ }
+
+ update_os () {
+ rm -rf /var/lib/apt/lists/*
+ apt-get clean
+ apt-get update
+ }
+
+ set_apt_get_proxy () {
+ cat > /etc/apt/apt.conf.d/proxy.conf << EOF
+ Acquire {
+ HTTP::proxy "$proxy";
+ HTTPS::proxy "$proxy";
+ }
+ EOF
+ }
+
+ docker_remove () {
+ dnf -y remove docker \
+ docker-client \
+ docker-client-latest \
+ docker-common \
+ docker-latest \
+ docker-latest-logrotate \
+ docker-logrotate \
+ docker-selinux \
+ docker-engine-selinux \
+ docker-engine
+ }
+
+ docker_install_and_configure () {
+ curl "https://releases.rancher.com/install-docker/$DOCKER_VERSION.sh" | sh
+ mkdir -p /etc/systemd/system/docker.service.d/
+ cat > /etc/systemd/system/docker.service.d/docker.conf << EOF
+ [Service]
+ ExecStart=
+ ExecStart=/usr/bin/dockerd -H fd:// --insecure-registry=nexus3.onap.org:10003
+ Environment="HTTP_PROXY=$proxy"
+ Environment="HTTPS_PROXY=$proxy"
+ EOF
+ systemctl daemon-reload
+ systemctl restart docker
+ apt-mark hold docker-ce
+ docker login -u docker -p docker nexus3.onap.org:10003
+ }
+ docker_compose_install () {
+ curl -L https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
+ chmod +x /usr/local/bin/docker-compose
+ }
+ pnf_sim_file_checkout () {
+ cd /root; git clone https://gerrit.onap.org/r/integration
+ }
+
+ start_pnf_simulator () {
+ docker login -u docker -p docker nexus3.onap.org:10003
+ cd ~/integration/test/mocks/pnfsimulator/pnfsimulator
+ docker-compose up -d
+ }
+
+ start_netconf_simulator () {
+ docker login -u docker -p docker nexus3.onap.org:10003
+ cd ~/integration/test/mocks/pnfsimulator/netconfsimulator
+ docker-compose up -d
+ }
+
+ set_versions
+ set_proxy
+ enable_root_ssh
+ set_apt_get_proxy
+ docker_install_and_configure
+ docker_compose_install
+ pnf_sim_file_checkout
+ start_pnf_simulator
+ start_netconf_simulator
+ params:
+ $proxy: { get_param: proxy }
+ PNF_PnP_simulator_port0:
+ type: OS::Neutron::Port
+ properties:
+ network_id: { get_param: private_net_id }
+ security_groups:
+ - default
+ fixed_ips:
+ - subnet_id: { get_param: private_subnet_id }
+ PNF_PnP_simulator_public:
+ type: OS::Neutron::FloatingIP
+ properties:
+ floating_network_id: { get_param: public_net_id }
+ port_id: { get_resource: PNF_PnP_simulator_port0 }
+outputs:
+ PNF_PnP_simulator_private_ip:
+ description: IP address of PNF_PnP_simulator in private network
+ value: { get_attr: [ PNF_PnP_simulator, first_address ] }
+ PNF_PnP_simulator_public_ip:
+ description: Floating IP address of PNF_PnP_simulator in public network
+ value: { get_attr: [ PNF_PnP_simulator_public, floating_ip_address ] }