From: Venkata Harish K Kajur Date: Tue, 19 Sep 2017 06:18:52 +0000 (-0400) Subject: Add ability to apply configurations to vnf X-Git-Tag: v1.1.0~35 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=34f82fce815c23f0ae3df3643ee262af396c236c;p=aai%2Faai-common.git Add ability to apply configurations to vnf Issue-ID: AAI-326 Change-Id: Id5480d020f66a6b8d83310d85eb0678f6b504e7a Signed-off-by: Venkata Harish K Kajur --- diff --git a/aai-core/src/main/resources/dbedgerules/DbEdgeRules_v11.json b/aai-core/src/main/resources/dbedgerules/DbEdgeRules_v11.json index 8653420f..d98c6a0b 100644 --- a/aai-core/src/main/resources/dbedgerules/DbEdgeRules_v11.json +++ b/aai-core/src/main/resources/dbedgerules/DbEdgeRules_v11.json @@ -1,5 +1,49 @@ { "rules": [ + { + "from": "configuration", + "to": "logical-link", + "label": "has", + "direction": "OUT", + "multiplicity": "One2Many", + "contains-other-v": "NONE", + "delete-other-v": "${direction}", + "SVC-INFRA": "NONE", + "prevent-delete": "NONE" + }, + { + "from": "configuration", + "to": "metadatum", + "label": "owns", + "direction": "OUT", + "multiplicity": "One2Many", + "contains-other-v": "${direction}", + "delete-other-v": "NONE", + "SVC-INFRA": "NONE", + "prevent-delete": "NONE" + }, + { + "from": "configuration", + "to": "allotted-resource", + "label": "uses", + "direction": "OUT", + "multiplicity": "One2One", + "contains-other-v": "NONE", + "delete-other-v": "${direction}", + "SVC-INFRA": "NONE", + "prevent-delete": "NONE" + }, + { + "from": "service-instance", + "to": "configuration", + "label": "has", + "direction": "OUT", + "multiplicity": "One2Many", + "contains-other-v": "NONE", + "delete-other-v": "NONE", + "SVC-INFRA": "NONE", + "prevent-delete": "NONE" + }, { "from": "availability-zone", "to": "complex", @@ -1026,7 +1070,7 @@ { "from": "platform", "to": "generic-vnf", - "label": "Uses", + "label": "uses", "direction": "OUT", "multiplicity": "Many2Many", "contains-other-v": "NONE", @@ -1661,7 +1705,18 @@ "SVC-INFRA": "NONE", "prevent-delete": "NONE" }, - { + { + "from": "generic-vnf", + "to": "configuration", + "label": "uses", + "direction": "OUT", + "multiplicity": "One2Many", + "contains-other-v": "NONE", + "delete-other-v": "${direction}", + "SVC-INFRA": "NONE", + "prevent-delete": "NONE" + }, + { "from": "vf-module", "to": "volume-group", "label": "uses", diff --git a/aai-core/src/test/java/org/openecomp/aai/util/CNNameTest.java b/aai-core/src/test/java/org/openecomp/aai/logging/CNNameTest.java similarity index 98% rename from aai-core/src/test/java/org/openecomp/aai/util/CNNameTest.java rename to aai-core/src/test/java/org/openecomp/aai/logging/CNNameTest.java index f5b67233..b4705030 100644 --- a/aai-core/src/test/java/org/openecomp/aai/util/CNNameTest.java +++ b/aai-core/src/test/java/org/openecomp/aai/logging/CNNameTest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.aai.util; +package org.openecomp.aai.logging; import ch.qos.logback.access.spi.IAccessEvent; import org.junit.Before; @@ -26,6 +26,7 @@ import org.junit.Test; import org.mockito.Mockito; import org.openecomp.aai.logging.CNName; import org.openecomp.aai.serialization.queryformats.QueryFormatTestHelper; +import org.openecomp.aai.util.AAIConstants; import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.agent.PowerMockAgent; diff --git a/aai-core/src/test/java/org/openecomp/aai/util/CustomLogPatternLayoutTest.java b/aai-core/src/test/java/org/openecomp/aai/logging/CustomLogPatternLayoutTest.java similarity index 98% rename from aai-core/src/test/java/org/openecomp/aai/util/CustomLogPatternLayoutTest.java rename to aai-core/src/test/java/org/openecomp/aai/logging/CustomLogPatternLayoutTest.java index 31a7b5e4..3e79646b 100644 --- a/aai-core/src/test/java/org/openecomp/aai/util/CustomLogPatternLayoutTest.java +++ b/aai-core/src/test/java/org/openecomp/aai/logging/CustomLogPatternLayoutTest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.aai.util; +package org.openecomp.aai.logging; import org.junit.Test; import org.openecomp.aai.logging.CNName; diff --git a/aai-core/src/test/java/org/openecomp/aai/logging/DME2RestFlagTest.java b/aai-core/src/test/java/org/openecomp/aai/logging/DME2RestFlagTest.java new file mode 100644 index 00000000..b20f1328 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/logging/DME2RestFlagTest.java @@ -0,0 +1,82 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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========================================================= + */ + +package org.openecomp.aai.logging; +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; +import ch.qos.logback.access.spi.IAccessEvent; +import org.junit.*; + + +public class DME2RestFlagTest { + + IAccessEvent mockAccEvent; + DME2RestFlag _DME2RestFlag; + + String[] temp = new String[4]; + + + @Before + public void setUp() throws Exception { + + mockAccEvent = mock(IAccessEvent.class); + _DME2RestFlag= spy(DME2RestFlag.class); + + } + private DME2RestFlag getTestObj(final boolean instanceStarted){ + return new DME2RestFlag(){ + @Override + public + boolean isStarted(){ + return instanceStarted; + } + }; + } + + @Test + public void convertTestAllValid(){ + temp[0]= "temp1"; + temp[1] = "-"; + when(mockAccEvent.getRequestParameter("envContext")).thenReturn(temp); + when(mockAccEvent.getRequestParameter("routeOffer")).thenReturn(temp); + when(mockAccEvent.getRequestParameter("version")).thenReturn(temp); + _DME2RestFlag = getTestObj(true); + assertEquals(_DME2RestFlag.convert(mockAccEvent),"DME2"); + } + + @Test + public void convertMissingRouteTest(){ + temp[0]= ""; + temp[1] = "-"; + when(mockAccEvent.getRequestParameter("envContext")).thenReturn(temp); + when(mockAccEvent.getRequestParameter("routeOffer")).thenReturn(temp); + when(mockAccEvent.getRequestParameter("version")).thenReturn(temp); + _DME2RestFlag = getTestObj(true); + assertEquals(_DME2RestFlag.convert(mockAccEvent),"REST"); + } + + @Test + public void convertIsStartedFalseTest(){ + _DME2RestFlag = getTestObj(false); + assertEquals(_DME2RestFlag.convert(mockAccEvent),"INACTIVE_HEADER_CONV"); + } + + +} diff --git a/aai-schema/src/main/resources/aai_schema/aai_schema_v11.xsd b/aai-schema/src/main/resources/aai_schema/aai_schema_v11.xsd index 291bc6b3..2d22cbb3 100644 --- a/aai-schema/src/main/resources/aai_schema/aai_schema_v11.xsd +++ b/aai-schema/src/main/resources/aai_schema/aai_schema_v11.xsd @@ -7201,6 +7201,115 @@ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" + + + + + @org.openecomp.aai.annotations.Metadata(description="Port Mirror Configuration.",indexedProps="configuration-id,model-invariant-id,model-version-id",uniqueProps="configuration-id",container="configurations",namespace="network") + + + + + + + @org.openecomp.aai.annotations.Metadata(description="Indicates the entity that will manage this feature. Could be an organization or the name of the application as well.") + + + + + + + @org.openecomp.aai.annotations.Metadata(isKey=true,description="UUID assigned to configuration.") + + + + + + + @org.openecomp.aai.annotations.Metadata(description="Name of the configuration.") + + + + + + + @org.openecomp.aai.annotations.Metadata(description="port-mirroring-configuration.") + + + + + + + @org.openecomp.aai.annotations.Metadata(description="vprobe, pprobe.") + + + + + + + @org.openecomp.aai.annotations.Metadata(description="the ASDC model id for this resource or service model.",visibility="deployment",requires="model-version-id",dbAlias="model-invariant-id-local") + + + + + + + @org.openecomp.aai.annotations.Metadata(description="the ASDC model version for this resource or service model.",visibility="deployment",requires="model-invariant-id",dbAlias="model-version-id-local") + + + + + + + @org.openecomp.aai.annotations.Metadata(description="Orchestration status of the configuration.") + + + + + + + @org.openecomp.aai.annotations.Metadata(description="Indicator for whether the resource is considered operational.") + + + + + + + @org.openecomp.aai.annotations.Metadata(description="URL to endpoint where AAI can get more details from SDN-GC.") + + + + + + + @org.openecomp.aai.annotations.Metadata(description="id of the configuration used to customize the resource") + + + + + + + @org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.") + + + + + + + + + + + + + @org.openecomp.aai.annotations.Metadata(description="Collection of configurations") + + + + + + + diff --git a/aai-schema/src/main/resources/aai_swagger_html/aai_swagger_v11.html b/aai-schema/src/main/resources/aai_swagger_html/aai_swagger_v11.html index f30983e9..dc95e4bf 100644 --- a/aai-schema/src/main/resources/aai_swagger_html/aai_swagger_v11.html +++ b/aai-schema/src/main/resources/aai_swagger_html/aai_swagger_v11.html @@ -146074,6 +146074,7 @@ This document is best viewed with Firefox or Chrome. Nodes can be found by appen
  • TO tunnel-xconnect (comprises allotted-resource, One2One)
  • TO vpn-binding (Many2Many)
  • TO allotted-resource (One2One)
  • +
  • FROM configuration
  • FROM service-instance (is composed of allotted-resource)
  • FROM service-instance
  • FROM allotted-resource
  • @@ -147651,6 +147652,266 @@ This document is best viewed with Firefox or Chrome. Nodes can be found by appen +
    +
    +

    configuration: + object + + + +

    +
    +
    +
    +

    Port Mirror Configuration.

    + +
      +
    • TO logical-link (One2Many)
    • +
    • TO metadatum (comprises configuration, One2Many)
    • +
    • TO allotted-resource (One2One)
    • +
    • FROM service-instance
    • +
    • FROM generic-vnf
    + +
    + +
    +
    +
    + management-option: + string + + +
    +
    +

    Indicates the entity that will manage this feature. Could be an organization or the name of the application as well.

    +
    + +
    +
    +
    + configuration-id: + string + + + +
    +
    +

    UUID assigned to configuration.

    +
    + +
    +
    +
    + configuration-name: + string + + +
    +
    +

    Name of the configuration.

    +
    + +
    +
    +
    + configuration-type: + string + + + +
    +
    +

    port-mirroring-configuration.

    +
    + +
    +
    +
    + configuration-sub-type: + string + + + +
    +
    +

    vprobe, pprobe.

    +
    + +
    +
    +
    + model-invariant-id: + string + + +
    +
    +

    the ASDC model id for this resource or service model.

    +
    + +
    +
    +
    + model-version-id: + string + + +
    +
    +

    the ASDC model version for this resource or service model.

    +
    + +
    +
    +
    + orchestration-status: + string + + + +
    +
    +

    Orchestration status of the configuration.

    +
    + +
    +
    +
    + operational-status: + string + + + +
    +
    +

    Indicator for whether the resource is considered operational.

    +
    + +
    +
    +
    + configuration-selflink: + string + + + +
    +
    +

    URL to endpoint where AAI can get more details from SDN-GC.

    +
    + +
    +
    +
    + model-customization-id: + string + + + +
    +
    +

    id of the configuration used to customize the resource

    +
    + +
    +
    +
    + resource-version: + string + + +
    +
    +

    Used for optimistic concurrency. Must be empty on create, valid on update and delete.

    +
    + +
    +
    +
    + relationship-list: + object + + +
    +
    + +
    + +
    + relationship-list + + + +
    + +
    +
    +
    +
    + metadata: + object + + +
    +
    + +
    + +
    + metadata + + + +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    configurations: + object + + + +

    +
    +
    +
    +

    Collection of configurations

    + +
    + +
    +
    +
    + configuration: + object[] + + +
    +
    + +
    + +
    + configuration + + + +
    + +
    +
    +
    +
    +
    +
    +

    connector: @@ -150310,6 +150571,7 @@ This document is best viewed with Firefox or Chrome. Nodes can be found by appen
  • TO network-profile (Many2Many)
  • TO pnf (Many2Many)
  • TO ipsec-configuration (Many2One)
  • +
  • TO configuration (One2Many)
  • TO vf-module (comprises generic-vnf, One2Many)
  • TO volume-group (One2Many)
  • TO vnfc (One2Many)
  • @@ -154469,6 +154731,7 @@ This document is best viewed with Firefox or Chrome. Nodes can be found by appen
  • TO pserver (Many2Many)
  • TO cloud-region (Many2Many)
  • TO vpn-binding (Many2Many)
  • +
  • FROM configuration
  • FROM l-interface
  • FROM lag-interface
  • FROM p-interface
  • @@ -154843,6 +155106,7 @@ This document is best viewed with Firefox or Chrome. Nodes can be found by appen

    Key/value pairs

      +
    • FROM configuration (is composed of metadatum)
    • FROM image (is composed of metadatum)
    • FROM model-ver (is composed of metadatum)
    • FROM service-instance (is composed of metadatum)
    • @@ -157953,6 +158217,18 @@ This document is best viewed with Firefox or Chrome. Nodes can be found by appen
    +
    + mac-addresss: + string + + +
    +
    +

    MAC Address of the p-interface.

    +
    + +
    +
    resource-version: string @@ -161569,6 +161845,7 @@ This document is best viewed with Firefox or Chrome. Nodes can be found by appen

    Instance of a service

      +
    • TO configuration (One2Many)
    • TO zone (Many2One)
    • TO cvlan-tag (Many2Many)
    • TO pnf (One2Many)
    • diff --git a/aai-schema/src/main/resources/aai_swagger_yaml/aai_swagger_v11.yaml b/aai-schema/src/main/resources/aai_swagger_yaml/aai_swagger_v11.yaml index ca381c03..3f250f64 100644 --- a/aai-schema/src/main/resources/aai_swagger_yaml/aai_swagger_v11.yaml +++ b/aai-schema/src/main/resources/aai_swagger_yaml/aai_swagger_v11.yaml @@ -42283,6 +42283,7 @@ definitions: description: | Key/value pairs ###### Related Nodes + - FROM configuration (is composed of metadatum) - FROM image (is composed of metadatum) - FROM model-ver (is composed of metadatum) - FROM service-instance (is composed of metadatum) @@ -43253,6 +43254,7 @@ definitions: - TO tunnel-xconnect (comprises allotted-resource, One2One) - TO vpn-binding (Many2Many) - TO allotted-resource (One2One) + - FROM configuration - FROM service-instance (is composed of allotted-resource) - FROM service-instance - FROM allotted-resource @@ -43312,6 +43314,7 @@ definitions: description: | Instance of a service ###### Related Nodes + - TO configuration (One2Many) - TO zone (Many2One) - TO cvlan-tag (Many2Many) - TO pnf (One2Many) @@ -44138,6 +44141,7 @@ definitions: - TO pserver (Many2Many) - TO cloud-region (Many2Many) - TO vpn-binding (Many2Many) + - FROM configuration - FROM l-interface - FROM lag-interface - FROM p-interface @@ -45231,6 +45235,7 @@ definitions: - TO network-profile (Many2Many) - TO pnf (Many2Many) - TO ipsec-configuration (Many2One) + - TO configuration (One2Many) - TO vf-module (comprises generic-vnf, One2Many) - TO volume-group (One2Many) - TO vnfc (One2Many) @@ -46294,6 +46299,74 @@ definitions: type: string key-value: type: string + configurations: + description: | + Collection of configurations + properties: + configuration: + type: array + items: + $ref: "#/definitions/configuration" + configuration: + description: | + Port Mirror Configuration. + ###### Related Nodes + - TO logical-link (One2Many) + - TO metadatum (comprises configuration, One2Many) + - TO allotted-resource (One2One) + - FROM service-instance + - FROM generic-vnf + required: + - configuration-id + - configuration-type + - configuration-sub-type + - orchestration-status + - operational-status + - configuration-selflink + - model-customization-id + properties: + management-option: + type: string + description: Indicates the entity that will manage this feature. Could be an organization or the name of the application as well. + configuration-id: + type: string + description: UUID assigned to configuration. + configuration-name: + type: string + description: Name of the configuration. + configuration-type: + type: string + description: port-mirroring-configuration. + configuration-sub-type: + type: string + description: vprobe, pprobe. + model-invariant-id: + type: string + description: the ASDC model id for this resource or service model. + model-version-id: + type: string + description: the ASDC model version for this resource or service model. + orchestration-status: + type: string + description: Orchestration status of the configuration. + operational-status: + type: string + description: Indicator for whether the resource is considered operational. + configuration-selflink: + type: string + description: URL to endpoint where AAI can get more details from SDN-GC. + model-customization-id: + type: string + description: id of the configuration used to customize the resource + resource-version: + type: string + description: Used for optimistic concurrency. Must be empty on create, valid on update and delete. + relationship-list: + type: object + $ref: "#/definitions/relationship-list" + metadata: + type: object + $ref: "#/definitions/metadata" notification-event: properties: cambria.partition: diff --git a/aai-schema/src/main/resources/oxm/aai_oxm_v11.xml b/aai-schema/src/main/resources/oxm/aai_oxm_v11.xml index b9bf2970..e0b11589 100644 --- a/aai-schema/src/main/resources/oxm/aai_oxm_v11.xml +++ b/aai-schema/src/main/resources/oxm/aai_oxm_v11.xml @@ -2395,7 +2395,7 @@ - + @@ -2405,7 +2405,7 @@ - + @@ -2429,7 +2429,7 @@ - + @@ -2469,7 +2469,7 @@ - + @@ -2479,7 +2479,7 @@ - + @@ -2503,7 +2503,7 @@ - + @@ -2868,6 +2868,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +