Service create command for SO 53/11953/4
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>
Tue, 12 Sep 2017 13:22:23 +0000 (18:52 +0530)
committersubhash kumar singh <subhash.kumar.singh@huawei.com>
Thu, 21 Sep 2017 14:13:23 +0000 (19:43 +0530)
CLI implementation for service create command.

Change-Id: Ifa834e70625c840cdf2278962679b6cbdec116f5
Issue-ID: CLI-15
Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
plugins/pom.xml
plugins/so/pom.xml [new file with mode: 0644]
plugins/so/src/main/resources/onap-cli-schema/services/service-create-schema-1.1.yaml [new file with mode: 0644]
plugins/so/src/test/resources/onap-cli-sample/services/service-create-sample-1.1.yaml [new file with mode: 0644]
validation/pom.xml

index acd2480..0ef6c30 100644 (file)
@@ -47,6 +47,7 @@
         <module>msb</module>
         <module>aai</module>
         <module>sdc</module>
+        <module>so</module>
     </modules>
      <build>
          <pluginManagement>
diff --git a/plugins/so/pom.xml b/plugins/so/pom.xml
new file mode 100644 (file)
index 0000000..2318f39
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Copyright 2017 Huawei Technologies Co., Ltd.
+
+   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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         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.cli</groupId>
+        <artifactId>cli-plugins</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>cli-plugins-so</artifactId>
+    <name>cli/plugins/so</name>
+    <packaging>jar</packaging>
+    <build>
+        <plugins>
+            <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-dependency-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/plugins/so/src/main/resources/onap-cli-schema/services/service-create-schema-1.1.yaml b/plugins/so/src/main/resources/onap-cli-schema/services/service-create-schema-1.1.yaml
new file mode 100644 (file)
index 0000000..03d5758
--- /dev/null
@@ -0,0 +1,57 @@
+open_cli_schema_version: 1.0
+name: service-create
+description: Create a service instance using MSO
+version: onap-1.1
+service:
+  name: mso
+  version: v2
+  auth: basic
+  mode: direct
+
+parameters:
+  - name: global-subscriber-id
+    description: unique id for customer
+    type: string
+    short_option: c
+    long_option: global-subscriber-id
+    is_optional: false
+  - name: subscriber-name
+    description: subscriber name
+    type: string
+    short_option: b
+    long_option: subscriber-name
+    is_optional: true
+  - name: instance-name
+    description: service instance name
+    type: string
+    short_option: i
+    long_option: instance-name
+    is_optional: false
+  - name: supress-rollback
+    description: rollback changes if instantiation fails.
+    type: bool
+    short_option: r
+    long_option: supress-rollback
+    is_optional: true
+
+results:
+  direction: portrait
+  attribute:
+    - name: instance-id
+      description: instance id for the created service.
+      type: string
+      scope: short
+
+
+http:
+  request:
+    uri: ecomp/mso/infra/serviceInstances/v2
+    method: PUT
+    body: '{"requestDetails": {"modelInfo": {"modelType": "service","modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff","modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe","modelName": "Test","modelVersion": "1.0"},"subscriberInfo": {"globalSubscriberId": "${global-subscriber-id}","subscriberName": "${subscriber-name}"},"requestInfo": {"instanceName": "${instance-name}","source": "VID","suppressRollback": "${supress-rollback}"},"requestParameters": {"subscriptionServiceType": "MOG"}}}'
+
+  success_codes:
+    - 202
+  result_mpa:
+    instance-id: $b{$.instance-id}
+  sample_response:
+    body: '{"instance-id":"234567AB"}'
diff --git a/plugins/so/src/test/resources/onap-cli-sample/services/service-create-sample-1.1.yaml b/plugins/so/src/test/resources/onap-cli-sample/services/service-create-sample-1.1.yaml
new file mode 100644 (file)
index 0000000..c52d800
--- /dev/null
@@ -0,0 +1,8 @@
+onap_cli_sample_version: 1.0
+
+name: service-create
+version: onap-1.1
+samples:
+    sample1:
+        name: Create a service instance
+        input: -h https://locahost:8080 -u InfraPortalClient -p password1$  -c customer -s subscriber -i instance -r
\ No newline at end of file
index dc42e2f..62b0db5 100644 (file)
             <artifactId>cli-plugins-aai</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.onap.cli</groupId>
+            <artifactId>cli-plugins-so</artifactId>
+            <version>${project.version}</version>
+        </dependency>
   </dependencies>
 <!--   <build>
         <plugins>