Merge "Implement merging all ncmp datastore endpoints into one"
authorToine Siebelink <toine.siebelink@est.tech>
Fri, 2 Sep 2022 12:00:13 +0000 (12:00 +0000)
committerGerrit Code Review <gerrit@onap.org>
Fri, 2 Sep 2022 12:00:13 +0000 (12:00 +0000)
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/CmHandleQueries.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/CmHandleQueriesImpl.java [new file with mode: 0644]
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandlerQueryServiceSpec.groovy
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/CmHandleQueriesImplSpec.groovy [moved from cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/CmHandleQueriesSpec.groovy with 98% similarity]
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/SyncUtilsSpec.groovy
docs/_static/css/ribbon.css
docs/conf.py
docs/requirements-docs.txt
docs/spelling_words.txt [new file with mode: 0644]
docs/tox.ini

index 569e91e..daabbb5 100644 (file)
 
 package org.onap.cps.ncmp.api.inventory;
 
-import static org.onap.cps.ncmp.api.impl.utils.YangDataConverter.convertYangModelCmHandleToNcmpServiceCmHandle;
-import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS;
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.stream.Collectors;
-import lombok.RequiredArgsConstructor;
-import org.onap.cps.ncmp.api.impl.utils.YangDataConverter;
 import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle;
-import org.onap.cps.spi.CpsDataPersistenceService;
 import org.onap.cps.spi.FetchDescendantsOption;
 import org.onap.cps.spi.model.DataNode;
-import org.springframework.stereotype.Component;
-
-@RequiredArgsConstructor
-@Component
-public class CmHandleQueries {
-
-    private static final String NCMP_DATASPACE_NAME = "NCMP-Admin";
-    private static final String NCMP_DMI_REGISTRY_ANCHOR = "ncmp-dmi-registry";
-
-    private final CpsDataPersistenceService cpsDataPersistenceService;
-    private static final Map<String, NcmpServiceCmHandle> NO_QUERY_TO_EXECUTE = null;
-    private static final String ANCESTOR_CM_HANDLES = "/ancestor::cm-handles";
 
+public interface CmHandleQueries {
 
     /**
      * Query CmHandles based on PublicProperties.
@@ -58,52 +35,17 @@ public class CmHandleQueries {
      * @param publicPropertyQueryPairs public properties for query
      * @return CmHandles which have these public properties
      */
-    public Map<String, NcmpServiceCmHandle> queryCmHandlePublicProperties(
-            final Map<String, String> publicPropertyQueryPairs) {
-        if (publicPropertyQueryPairs.isEmpty()) {
-            return Collections.emptyMap();
-        }
-        Map<String, NcmpServiceCmHandle> cmHandleIdToNcmpServiceCmHandles = null;
-        for (final Map.Entry<String, String> publicPropertyQueryPair : publicPropertyQueryPairs.entrySet()) {
-            final String cpsPath = "//public-properties[@name=\"" + publicPropertyQueryPair.getKey()
-                    + "\" and @value=\"" + publicPropertyQueryPair.getValue() + "\"]";
-
-            final Collection<DataNode> dataNodes = queryCmHandleDataNodesByCpsPath(cpsPath, INCLUDE_ALL_DESCENDANTS);
-            if (cmHandleIdToNcmpServiceCmHandles == null) {
-                cmHandleIdToNcmpServiceCmHandles = collectDataNodesToNcmpServiceCmHandles(dataNodes);
-            } else {
-                final Collection<String> cmHandleIdsToRetain = dataNodes.parallelStream()
-                        .map(dataNode -> dataNode.getLeaves().get("id").toString()).collect(Collectors.toSet());
-                cmHandleIdToNcmpServiceCmHandles.keySet().retainAll(cmHandleIdsToRetain);
-            }
-            if (cmHandleIdToNcmpServiceCmHandles.isEmpty()) {
-                break;
-            }
-        }
-        return cmHandleIdToNcmpServiceCmHandles;
-    }
+    Map<String, NcmpServiceCmHandle> queryCmHandlePublicProperties(Map<String, String> publicPropertyQueryPairs);
 
     /**
      * Combine Maps of CmHandles.
      *
-     * @param firstQuery first CmHandles Map
+     * @param firstQuery  first CmHandles Map
      * @param secondQuery second CmHandles Map
      * @return combined Map of CmHandles
      */
-    public Map<String, NcmpServiceCmHandle> combineCmHandleQueries(
-            final Map<String, NcmpServiceCmHandle> firstQuery,
-            final Map<String, NcmpServiceCmHandle> secondQuery) {
-        if (firstQuery == NO_QUERY_TO_EXECUTE && secondQuery == NO_QUERY_TO_EXECUTE) {
-            return NO_QUERY_TO_EXECUTE;
-        } else if (firstQuery == NO_QUERY_TO_EXECUTE) {
-            return secondQuery;
-        } else if (secondQuery == NO_QUERY_TO_EXECUTE) {
-            return firstQuery;
-        } else {
-            firstQuery.keySet().retainAll(secondQuery.keySet());
-            return firstQuery;
-        }
-    }
+    Map<String, NcmpServiceCmHandle> combineCmHandleQueries(Map<String, NcmpServiceCmHandle> firstQuery,
+            Map<String, NcmpServiceCmHandle> secondQuery);
 
     /**
      * Method which returns cm handles by the cm handles state.
@@ -111,10 +53,7 @@ public class CmHandleQueries {
      * @param cmHandleState cm handle state
      * @return a list of cm handles
      */
-    public List<DataNode> queryCmHandlesByState(final CmHandleState cmHandleState) {
-        return queryCmHandleDataNodesByCpsPath("//state[@cm-handle-state=\"" + cmHandleState + "\"]",
-            INCLUDE_ALL_DESCENDANTS);
-    }
+    List<DataNode> queryCmHandlesByState(CmHandleState cmHandleState);
 
     /**
      * Method to return data nodes representing the cm handles.
@@ -122,49 +61,24 @@ public class CmHandleQueries {
      * @param cpsPath cps path for which the cmHandle is requested
      * @return a list of data nodes representing the cm handles.
      */
-    public List<DataNode> queryCmHandleDataNodesByCpsPath(final String cpsPath,
-                                                          final FetchDescendantsOption fetchDescendantsOption) {
-        return cpsDataPersistenceService.queryDataNodes(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR,
-            cpsPath + ANCESTOR_CM_HANDLES, fetchDescendantsOption);
-    }
+    List<DataNode> queryCmHandleDataNodesByCpsPath(String cpsPath, FetchDescendantsOption fetchDescendantsOption);
 
     /**
      * Method to check the state of a cm handle with given id.
      *
-     * @param cmHandleId cm handle id
+     * @param cmHandleId            cm handle id
      * @param requiredCmHandleState the required state of the cm handle
      * @return a boolean, true if the state is equal to the required state
      */
-    public boolean cmHandleHasState(final String cmHandleId, final CmHandleState requiredCmHandleState) {
-        final DataNode stateDataNode = getCmHandleState(cmHandleId);
-        final String cmHandleStateAsString = (String) stateDataNode.getLeaves().get("cm-handle-state");
-        return CmHandleState.valueOf(cmHandleStateAsString).equals(requiredCmHandleState);
-    }
+    boolean cmHandleHasState(String cmHandleId, CmHandleState requiredCmHandleState);
 
     /**
      * Method which returns cm handles by the operational sync state of cm handle.
+     *
      * @param dataStoreSyncState sync state
      * @return a list of cm handles
      */
-    public List<DataNode> queryCmHandlesByOperationalSyncState(final DataStoreSyncState dataStoreSyncState) {
-        return queryCmHandleDataNodesByCpsPath("//state/datastores" + "/operational[@sync-state=\""
-                + dataStoreSyncState + "\"]", FetchDescendantsOption.OMIT_DESCENDANTS);
-    }
-
-    private Map<String, NcmpServiceCmHandle> collectDataNodesToNcmpServiceCmHandles(
-            final Collection<DataNode> dataNodes) {
-        final Map<String, NcmpServiceCmHandle> cmHandleIdToNcmpServiceCmHandle = new HashMap<>();
-        dataNodes.forEach(dataNode -> {
-            final NcmpServiceCmHandle ncmpServiceCmHandle = createNcmpServiceCmHandle(dataNode);
-            cmHandleIdToNcmpServiceCmHandle.put(ncmpServiceCmHandle.getCmHandleId(), ncmpServiceCmHandle);
-        });
-        return cmHandleIdToNcmpServiceCmHandle;
-    }
-
-    private NcmpServiceCmHandle createNcmpServiceCmHandle(final DataNode dataNode) {
-        return convertYangModelCmHandleToNcmpServiceCmHandle(YangDataConverter
-                .convertCmHandleToYangModel(dataNode, dataNode.getLeaves().get("id").toString()));
-    }
+    List<DataNode> queryCmHandlesByOperationalSyncState(DataStoreSyncState dataStoreSyncState);
 
     /**
      * Get all cm handles by DMI plugin identifier.
@@ -172,34 +86,5 @@ public class CmHandleQueries {
      * @param dmiPluginIdentifier DMI plugin identifier
      * @return set of cm handles
      */
-    public Set<NcmpServiceCmHandle> getCmHandlesByDmiPluginIdentifier(final String dmiPluginIdentifier) {
-        final Map<String, DataNode> cmHandleAsDataNodePerCmHandleId = new HashMap<>();
-        for (final ModelledDmiServiceLeaves modelledDmiServiceLeaf : ModelledDmiServiceLeaves.values()) {
-            for (final DataNode cmHandleAsDataNode: getCmHandlesByDmiPluginIdentifierAndDmiProperty(
-                    dmiPluginIdentifier,
-                    modelledDmiServiceLeaf.getLeafName())) {
-                cmHandleAsDataNodePerCmHandleId.put(
-                        cmHandleAsDataNode.getLeaves().get("id").toString(), cmHandleAsDataNode);
-            }
-        }
-        final Set<NcmpServiceCmHandle> ncmpServiceCmHandles = new HashSet<>(cmHandleAsDataNodePerCmHandleId.size());
-        cmHandleAsDataNodePerCmHandleId.values().forEach(
-                cmHandleAsDataNode -> ncmpServiceCmHandles.add(createNcmpServiceCmHandle(cmHandleAsDataNode)));
-        return ncmpServiceCmHandles;
-    }
-
-    private List<DataNode> getCmHandlesByDmiPluginIdentifierAndDmiProperty(final String dmiPluginIdentifier,
-                                                             final String dmiProperty) {
-        return cpsDataPersistenceService.queryDataNodes(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR,
-                "/dmi-registry/cm-handles[@" + dmiProperty + "='" + dmiPluginIdentifier + "']",
-                OMIT_DESCENDANTS);
-    }
-
-    private DataNode getCmHandleState(final String cmHandleId) {
-        final String xpath = "/dmi-registry/cm-handles[@id='" + cmHandleId + "']/state";
-        return cpsDataPersistenceService.getDataNode(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR,
-                xpath, OMIT_DESCENDANTS);
-    }
+    Set<NcmpServiceCmHandle> getCmHandlesByDmiPluginIdentifier(String dmiPluginIdentifier);
 }
-
-
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/CmHandleQueriesImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/CmHandleQueriesImpl.java
new file mode 100644 (file)
index 0000000..e9e2fca
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ *  ============LICENSE_START=======================================================
+ *  Copyright (C) 2022 Nordix Foundation
+ *  ================================================================================
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+package org.onap.cps.ncmp.api.inventory;
+
+import static org.onap.cps.ncmp.api.impl.utils.YangDataConverter.convertYangModelCmHandleToNcmpServiceCmHandle;
+import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS;
+import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import lombok.RequiredArgsConstructor;
+import org.onap.cps.ncmp.api.impl.utils.YangDataConverter;
+import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle;
+import org.onap.cps.spi.CpsDataPersistenceService;
+import org.onap.cps.spi.FetchDescendantsOption;
+import org.onap.cps.spi.model.DataNode;
+import org.springframework.stereotype.Component;
+
+@RequiredArgsConstructor
+@Component
+public class CmHandleQueriesImpl implements CmHandleQueries {
+
+    private static final String NCMP_DATASPACE_NAME = "NCMP-Admin";
+    private static final String NCMP_DMI_REGISTRY_ANCHOR = "ncmp-dmi-registry";
+
+    private final CpsDataPersistenceService cpsDataPersistenceService;
+    private static final Map<String, NcmpServiceCmHandle> NO_QUERY_TO_EXECUTE = null;
+    private static final String ANCESTOR_CM_HANDLES = "/ancestor::cm-handles";
+
+
+    @Override
+    public Map<String, NcmpServiceCmHandle> queryCmHandlePublicProperties(
+            final Map<String, String> publicPropertyQueryPairs) {
+        if (publicPropertyQueryPairs.isEmpty()) {
+            return Collections.emptyMap();
+        }
+        Map<String, NcmpServiceCmHandle> cmHandleIdToNcmpServiceCmHandles = null;
+        for (final Map.Entry<String, String> publicPropertyQueryPair : publicPropertyQueryPairs.entrySet()) {
+            final String cpsPath = "//public-properties[@name=\"" + publicPropertyQueryPair.getKey()
+                    + "\" and @value=\"" + publicPropertyQueryPair.getValue() + "\"]";
+
+            final Collection<DataNode> dataNodes = queryCmHandleDataNodesByCpsPath(cpsPath, INCLUDE_ALL_DESCENDANTS);
+            if (cmHandleIdToNcmpServiceCmHandles == null) {
+                cmHandleIdToNcmpServiceCmHandles = collectDataNodesToNcmpServiceCmHandles(dataNodes);
+            } else {
+                final Collection<String> cmHandleIdsToRetain = dataNodes.parallelStream()
+                        .map(dataNode -> dataNode.getLeaves().get("id").toString()).collect(Collectors.toSet());
+                cmHandleIdToNcmpServiceCmHandles.keySet().retainAll(cmHandleIdsToRetain);
+            }
+            if (cmHandleIdToNcmpServiceCmHandles.isEmpty()) {
+                break;
+            }
+        }
+        return cmHandleIdToNcmpServiceCmHandles;
+    }
+
+    @Override
+    public Map<String, NcmpServiceCmHandle> combineCmHandleQueries(final Map<String, NcmpServiceCmHandle> firstQuery,
+            final Map<String, NcmpServiceCmHandle> secondQuery) {
+        if (firstQuery == NO_QUERY_TO_EXECUTE && secondQuery == NO_QUERY_TO_EXECUTE) {
+            return NO_QUERY_TO_EXECUTE;
+        } else if (firstQuery == NO_QUERY_TO_EXECUTE) {
+            return secondQuery;
+        } else if (secondQuery == NO_QUERY_TO_EXECUTE) {
+            return firstQuery;
+        } else {
+            firstQuery.keySet().retainAll(secondQuery.keySet());
+            return firstQuery;
+        }
+    }
+
+    @Override
+    public List<DataNode> queryCmHandlesByState(final CmHandleState cmHandleState) {
+        return queryCmHandleDataNodesByCpsPath("//state[@cm-handle-state=\"" + cmHandleState + "\"]",
+            INCLUDE_ALL_DESCENDANTS);
+    }
+
+    @Override
+    public List<DataNode> queryCmHandleDataNodesByCpsPath(final String cpsPath,
+            final FetchDescendantsOption fetchDescendantsOption) {
+        return cpsDataPersistenceService.queryDataNodes(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR,
+            cpsPath + ANCESTOR_CM_HANDLES, fetchDescendantsOption);
+    }
+
+    @Override
+    public boolean cmHandleHasState(final String cmHandleId, final CmHandleState requiredCmHandleState) {
+        final DataNode stateDataNode = getCmHandleState(cmHandleId);
+        final String cmHandleStateAsString = (String) stateDataNode.getLeaves().get("cm-handle-state");
+        return CmHandleState.valueOf(cmHandleStateAsString).equals(requiredCmHandleState);
+    }
+
+    @Override
+    public List<DataNode> queryCmHandlesByOperationalSyncState(final DataStoreSyncState dataStoreSyncState) {
+        return queryCmHandleDataNodesByCpsPath("//state/datastores" + "/operational[@sync-state=\""
+                + dataStoreSyncState + "\"]", FetchDescendantsOption.OMIT_DESCENDANTS);
+    }
+
+    private Map<String, NcmpServiceCmHandle> collectDataNodesToNcmpServiceCmHandles(
+            final Collection<DataNode> dataNodes) {
+        final Map<String, NcmpServiceCmHandle> cmHandleIdToNcmpServiceCmHandle = new HashMap<>();
+        dataNodes.forEach(dataNode -> {
+            final NcmpServiceCmHandle ncmpServiceCmHandle = createNcmpServiceCmHandle(dataNode);
+            cmHandleIdToNcmpServiceCmHandle.put(ncmpServiceCmHandle.getCmHandleId(), ncmpServiceCmHandle);
+        });
+        return cmHandleIdToNcmpServiceCmHandle;
+    }
+
+    private NcmpServiceCmHandle createNcmpServiceCmHandle(final DataNode dataNode) {
+        return convertYangModelCmHandleToNcmpServiceCmHandle(YangDataConverter
+                .convertCmHandleToYangModel(dataNode, dataNode.getLeaves().get("id").toString()));
+    }
+
+    @Override
+    public Set<NcmpServiceCmHandle> getCmHandlesByDmiPluginIdentifier(final String dmiPluginIdentifier) {
+        final Map<String, DataNode> cmHandleAsDataNodePerCmHandleId = new HashMap<>();
+        for (final ModelledDmiServiceLeaves modelledDmiServiceLeaf : ModelledDmiServiceLeaves.values()) {
+            for (final DataNode cmHandleAsDataNode: getCmHandlesByDmiPluginIdentifierAndDmiProperty(
+                    dmiPluginIdentifier,
+                    modelledDmiServiceLeaf.getLeafName())) {
+                cmHandleAsDataNodePerCmHandleId.put(
+                        cmHandleAsDataNode.getLeaves().get("id").toString(), cmHandleAsDataNode);
+            }
+        }
+        final Set<NcmpServiceCmHandle> ncmpServiceCmHandles = new HashSet<>(cmHandleAsDataNodePerCmHandleId.size());
+        cmHandleAsDataNodePerCmHandleId.values().forEach(
+                cmHandleAsDataNode -> ncmpServiceCmHandles.add(createNcmpServiceCmHandle(cmHandleAsDataNode)));
+        return ncmpServiceCmHandles;
+    }
+
+    private List<DataNode> getCmHandlesByDmiPluginIdentifierAndDmiProperty(final String dmiPluginIdentifier,
+                                                             final String dmiProperty) {
+        return cpsDataPersistenceService.queryDataNodes(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR,
+                "/dmi-registry/cm-handles[@" + dmiProperty + "='" + dmiPluginIdentifier + "']",
+                OMIT_DESCENDANTS);
+    }
+
+    private DataNode getCmHandleState(final String cmHandleId) {
+        final String xpath = "/dmi-registry/cm-handles[@id='" + cmHandleId + "']/state";
+        return cpsDataPersistenceService.getDataNode(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR,
+                xpath, OMIT_DESCENDANTS);
+    }
+}
+
+
index f1294ce..f76316f 100644 (file)
@@ -21,8 +21,8 @@
 package org.onap.cps.ncmp.api.impl
 
 import org.onap.cps.cpspath.parser.PathParsingException
-import org.onap.cps.ncmp.api.inventory.InventoryPersistence
 import org.onap.cps.ncmp.api.inventory.CmHandleQueries
+import org.onap.cps.ncmp.api.inventory.InventoryPersistence
 import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle
 import org.onap.cps.spi.FetchDescendantsOption
 import org.onap.cps.spi.exceptions.DataInUseException
@@ -29,10 +29,10 @@ import spock.lang.Specification
 import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
 import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
 
-class CmHandleQueriesSpec extends Specification {
+class CmHandleQueriesImplSpec extends Specification {
     def cpsDataPersistenceService = Mock(CpsDataPersistenceService)
 
-    def objectUnderTest = new CmHandleQueries(cpsDataPersistenceService)
+    def objectUnderTest = new CmHandleQueriesImpl(cpsDataPersistenceService)
 
     @Shared
     def static sampleDataNodes = [new DataNode()]
index 6ccdcf1..f4176d6 100644 (file)
@@ -26,12 +26,10 @@ import com.fasterxml.jackson.databind.ObjectMapper
 import org.onap.cps.ncmp.api.impl.operations.DmiDataOperations
 import org.onap.cps.ncmp.api.impl.operations.DmiOperations
 import org.onap.cps.ncmp.api.inventory.CmHandleQueries
-import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle
 import org.onap.cps.ncmp.api.inventory.CmHandleState
 import org.onap.cps.ncmp.api.inventory.CompositeState
 import org.onap.cps.ncmp.api.inventory.CompositeStateBuilder
 import org.onap.cps.ncmp.api.inventory.DataStoreSyncState
-import org.onap.cps.ncmp.api.inventory.InventoryPersistence
 import org.onap.cps.ncmp.api.inventory.LockReasonCategory
 import org.onap.cps.spi.FetchDescendantsOption
 import org.onap.cps.spi.model.DataNode
index 6008cb1..1bf7898 100644 (file)
@@ -1,63 +1,64 @@
+
 .ribbon {
-  z-index: 1000;
-  background-color: #a00;
-  overflow: hidden;
-  white-space: nowrap;
-  position: fixed;
-  top: 25px;
-  right: -50px;
-  -webkit-transform: rotate(45deg);
-     -moz-transform: rotate(45deg);
-      -ms-transform: rotate(45deg);
-       -o-transform: rotate(45deg);
-          transform: rotate(45deg);
-  -webkit-box-shadow: 0 0 10px #888;
-     -moz-box-shadow: 0 0 10px #888;
-          box-shadow: 0 0 10px #888;
-
-}
-
-.ribbon a {
-  border: 1px solid #faa;
-  color: #fff;
-  display: block;
-  font: bold 81.25% 'Helvetica Neue', Helvetica, Arial, sans-serif;
-  margin: 1px 0;
-  padding: 10px 50px;
-  text-align: center;
-  text-decoration: none;
-  text-shadow: 0 0 5px #444;
-  transition: 0.5s;
-}
-
-.ribbon a:hover {
-  background: #c11;
-  color: #fff;
-}
-
-
-/* override table width restrictions */
-@media screen and (min-width: 767px) {
-
-   .wy-table-responsive table td, .wy-table-responsive table th {
-      /* !important prevents the common CSS stylesheets from overriding
-         this as on RTD they are loaded after this stylesheet */
-      white-space: normal !important;
-   }
-
-   .wy-table-responsive {
-      overflow: visible !important;
-   }
-}
-
-@media screen and (max-width: 767px) {
-    .wy-table-responsive table td {
-        white-space: nowrap;
+   z-index: 1000;
+   background-color: #a00;
+   overflow: hidden;
+   white-space: nowrap;
+   position: fixed;
+   top: 25px;
+   right: -50px;
+   -webkit-transform: rotate(45deg);
+      -moz-transform: rotate(45deg);
+       -ms-transform: rotate(45deg);
+        -o-transform: rotate(45deg);
+           transform: rotate(45deg);
+   -webkit-box-shadow: 0 0 10px #888;
+      -moz-box-shadow: 0 0 10px #888;
+           box-shadow: 0 0 10px #888;
+
+ }
+
+ .ribbon a {
+   border: 1px solid #faa;
+   color: #fff;
+   display: block;
+   font: bold 81.25% 'Helvetica Neue', Helvetica, Arial, sans-serif;
+   margin: 1px 0;
+   padding: 10px 50px;
+   text-align: center;
+   text-decoration: none;
+   text-shadow: 0 0 5px #444;
+   transition: 0.5s;
+ }
+
+ .ribbon a:hover {
+   background: #c11;
+   color: #fff;
+ }
+
+
+ /* override table width restrictions */
+ @media screen and (min-width: 767px) {
+
+    .wy-table-responsive table td, .wy-table-responsive table th {
+       /* !important prevents the common CSS stylesheets from overriding
+          this as on RTD they are loaded after this stylesheet */
+       white-space: normal !important;
     }
-}
 
-/* fix width of the screen */
+    .wy-table-responsive {
+       overflow: visible !important;
+    }
+ }
+
+ @media screen and (max-width: 767px) {
+     .wy-table-responsive table td {
+         white-space: nowrap;
+     }
+ }
+
+ /* fix width of the screen */
 
-.wy-nav-content {
-    max-width: none;
-}
+ .wy-nav-content {
+     max-width: 800px;
+ }
index 84dac1e..5185b61 100755 (executable)
 #  SPDX-License-Identifier: Apache-2.0
 #  ============LICENSE_END=========================================================
 
-
 from docutils.parsers.rst import directives
-from docs_conf.conf import *
 
-#change 'latest' to relevant branch-name once branch has been created
+project = "onap"
+release = "master"
+version = "master"
+
+author = "Open Network Automation Platform"
+# yamllint disable-line rule:line-length
+copyright = "ONAP. Licensed under Creative Commons Attribution 4.0 International License"
+
+pygments_style = "sphinx"
+html_theme = "sphinx_rtd_theme"
+html_theme_options = {
+    "style_nav_header_background": "white",
+    "sticky_navigation": "False" }
+html_logo = "_static/logo_onap_2017.png"
+html_favicon = "_static/favicon.ico"
+html_static_path = ["_static"]
+html_show_sphinx = False
+
+extensions = [
+    'sphinx.ext.intersphinx','sphinxcontrib.blockdiag',
+    'sphinxcontrib.seqdiag', 'sphinxcontrib.swaggerdoc', 'sphinx.ext.graphviz']
+
+#
+# Map to 'latest' if this file is used in 'latest' (master) 'doc' branch.
+# Change to {releasename} after you have created the new 'doc' branch.
+#
+
 branch = 'latest'
+
 doc_url = 'https://docs.onap.org/projects'
 master_doc = 'index'
 
+exclude_patterns = ['.tox']
+
+spelling_word_list_filename='spelling_wordlist.txt'
+spelling_lang = "en_GB"
+
 intersphinx_mapping = {}
 
 intersphinx_mapping['onap-cps-ncmp-dmi-plugin'] = ('{}/onap-cps-ncmp-dmi-plugin/en/%s'.format(doc_url) % branch, None)
@@ -33,16 +63,7 @@ intersphinx_mapping['onap-cps-cps-temporal'] = ('{}/onap-cps-cps-temporal/en/%s'
 linkcheck_ignore = [
     'http://localhost',
     'https://example.com',
-    'about:config',
-    # this URL is not directly reachable and must be configured in the system hosts file.
-    'https://portal.api.simpledemo.onap.org:30225/ONAPPORTAL/login.htm',
-    # anchor issues
-    'https://docs.onap.org/projects/onap-integration/en/latest/docs_usecases_release.html#.*',
-    'https://docs.linuxfoundation.org/docs/communitybridge/easycla/contributors/contribute-to-a-gerrit-project#.*',
-    'https://docs.onap.org/projects/onap-integration/en/latest/docs_robot.html#docs-robot',
-    'https://docs.onap.org/projects/onap-integration/en/latest/docs_usecases_release.html#docs-usecases-release',
-    'https://docs.onap.org/projects/onap-integration/en/latest/docs_usecases.html#docs-usecases',
-    'https://docs.onap.org/projects/onap-integration/en/latest/usecases/release_non_functional_requirements.html#release-non-functional-requirements',
+    'about:config'
 ]
 
 
index 3b3441a..ed96b42 100644 (file)
@@ -1,3 +1,6 @@
-lfdocs-conf
 sphinx>=4.2.0  # BSD
 sphinx-rtd-theme>=1.0.0  # MIT
+sphinxcontrib-blockdiag  # BSD
+sphinxcontrib-seqdiag # BSD
+sphinxcontrib-swaggerdoc
+sphinxcontrib-spelling
diff --git a/docs/spelling_words.txt b/docs/spelling_words.txt
new file mode 100644 (file)
index 0000000..4417cc8
--- /dev/null
@@ -0,0 +1,10 @@
+Goodger
+Mär
+docinfo
+overlined
+Docutils
+csv
+sectnum
+reST
+unicode
+defs
\ No newline at end of file
index c329a7e..ab2de1b 100644 (file)
@@ -1,26 +1,46 @@
+# ============LICENSE_START=======================================================
+# Copyright (C) 2022 Nordix Foundation
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
 [tox]
 minversion = 1.6
-envlist = docs,
+envlist = docs,docs-linkcheck,docs-spellcheck
 skipsdist = true
-
 [testenv:docs]
 basepython = python3.8
-deps = -r{toxinidir}/requirements-docs.txt
-       -chttps://raw.githubusercontent.com/openstack/requirements/stable/yoga/upper-constraints.txt
-       -chttps://git.onap.org/doc/plain/etc/upper-constraints.onap.txt
+deps =
+    -r{toxinidir}/requirements-docs.txt
+    -chttps://raw.githubusercontent.com/openstack/requirements/stable/yoga/upper-constraints.txt
+    -chttps://git.onap.org/doc/plain/etc/upper-constraints.onap.txt?h=master
 commands =
-    sphinx-build -b html -n -d {envtmpdir}/doctrees ./ {toxinidir}/_build/html
-    echo "Generated docs available in {toxinidir}/_build/html"
-whitelist_externals =
-    echo
-    git
-    sh
-
+    sphinx-build -q -b html -n -d {envtmpdir}/doctrees {toxinidir} {toxinidir}/_build/html
 [testenv:docs-linkcheck]
 basepython = python3.8
-deps = -r{toxinidir}/requirements-docs.txt
-       -chttps://raw.githubusercontent.com/openstack/requirements/stable/yoga/upper-constraints.txt
-       -chttps://git.onap.org/doc/plain/etc/upper-constraints.onap.txt
-commands = echo "Link Checking not enforced"
-#commands = sphinx-build -b linkcheck -d {envtmpdir}/doctrees ./ {toxinidir}/_build/linkcheck
-whitelist_externals = echo
+deps =
+    -r{toxinidir}/requirements-docs.txt
+    -chttps://raw.githubusercontent.com/openstack/requirements/stable/yoga/upper-constraints.txt
+    -chttps://git.onap.org/doc/plain/etc/upper-constraints.onap.txt?h=master
+commands =
+    sphinx-build -b linkcheck -d {envtmpdir}/doctrees {toxinidir} {toxinidir}/_build/linkcheck
+[testenv:docs-spellcheck]
+basepython = python3.8
+deps =
+    -r{toxinidir}/requirements-docs.txt
+    -chttps://raw.githubusercontent.com/openstack/requirements/stable/yoga/upper-constraints.txt
+    -chttps://git.onap.org/doc/plain/etc/upper-constraints.onap.txt?h=master
+commands =
+    sphinx-build -b spelling -Dextensions=sphinxcontrib.spelling -d {envtmpdir}/doctrees {toxinidir} {toxinidir}/_build/spellcheck