summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2016-10-04 16:44:47 +0200
committerMaros Marsalek <mmarsale@cisco.com>2016-10-05 11:52:37 +0000
commit6e92b4740d62b5977590f8a247b08eb945b9e5b7 (patch)
tree366c1f8536528637d58ba55088b3a3c90b522283
parent4cd8aad5217a5225a2a33b448478dd81548e38b1 (diff)
HONEYCOMB-138 - Lisp L2 Support
Change-Id: Idff4776a64a88be2e0a45ab1927978e40876ea92 Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
-rwxr-xr-xlisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/Ipv4Matcher.java1
-rwxr-xr-xlisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/Ipv6Matcher.java1
-rwxr-xr-xlisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/MacMatcher.java1
-rw-r--r--lisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/SimpleAddressBuilder.java11
-rwxr-xr-xlisp/api/src/main/yang/lisp.yang287
-rwxr-xr-xlisp/lisp2vpp/pom.xml1
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/LispModule.java15
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/cfgattrs/LispConfiguration.java5
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/ContextsReaderFactory.java46
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/ContextsReaderFactoryProvider.java36
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/EidMappingContext.java66
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/initializers/LispInitializer.java6
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizer.java8
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizer.java106
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java85
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java47
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java21
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizer.java4
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java125
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java34
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizer.java103
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/AbstractJvppDumpExecutor.java (renamed from lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/AbstractDumpExecutor.java)8
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/ItrRemoteLocatorSetDumpExecutor.java48
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutor.java2
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorSetsDumpExecutor.java2
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MapResolversDumpExecutor.java2
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MappingsDumpExecutor.java2
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/SubtableDumpExecutor.java68
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutor.java16
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/SubtableDumpParams.java75
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/AbstractLispReaderFactoryBase.java22
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/EidTableReaderFactory.java122
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LispStateReaderFactory.java17
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LocatorSetsReaderFactory.java3
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/MapResolversReaderFactory.java4
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingFilterProvider.java50
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducer.java56
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java56
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidMetadataProvider.java36
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidTranslator.java45
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizer.java92
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainSubtableCustomizer.java97
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizer.java82
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizer.java10
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizer.java9
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizer.java20
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizer.java63
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizer.java82
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LispWriterFactory.java14
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LocatorSetsWriterFactory.java3
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/MapResolversWriterFactory.java4
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/VniTableWriterFactory.java98
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriter.java82
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/LispModuleTest.java5
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/EidMappingContextTest.java79
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/initializers/LispInitializerTest.java16
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizerTest.java8
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizerTest.java104
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizerTest.java150
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizerTest.java19
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizerTest.java7
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizerTest.java5
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizerTest.java133
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizerTest.java90
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizerTest.java107
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutorTest.java24
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingFilterProviderTest.java79
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducerTest.java170
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReaderTestCase.java81
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/util/EidTranslatorTest.java6
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizerTest.java134
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainCustomizerTest.java92
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizerTest.java2
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java130
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizerTest.java27
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizerTest.java40
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizerTest.java97
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizerTest.java89
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriterTestCase.java43
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/EidMappingContextHelper.java106
-rw-r--r--lisp/lisp_postman_collection.json764
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/AddressTranslator.java14
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/MacTranslator.java9
83 files changed, 4071 insertions, 858 deletions
diff --git a/lisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/Ipv4Matcher.java b/lisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/Ipv4Matcher.java
index 55f0ec907..1e70fe1aa 100755
--- a/lisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/Ipv4Matcher.java
+++ b/lisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/Ipv4Matcher.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105;
import java.util.List;
diff --git a/lisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/Ipv6Matcher.java b/lisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/Ipv6Matcher.java
index 947088f8f..74d9c2be8 100755
--- a/lisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/Ipv6Matcher.java
+++ b/lisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/Ipv6Matcher.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105;
import java.util.List;
diff --git a/lisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/MacMatcher.java b/lisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/MacMatcher.java
index 663f4ff22..ac58622f0 100755
--- a/lisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/MacMatcher.java
+++ b/lisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/MacMatcher.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105;
import java.util.List;
diff --git a/lisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/SimpleAddressBuilder.java b/lisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/SimpleAddressBuilder.java
index 681e87277..aad92c053 100644
--- a/lisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/SimpleAddressBuilder.java
+++ b/lisp/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/lisp/address/types/rev151105/SimpleAddressBuilder.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105;
@@ -24,12 +25,12 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
/**
- * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
- * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32).
+ * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string
+ * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 -
+ * uint16), or (string - uint32).
* <p/>
- * The reason behind putting it under src/main/java is:
- * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent
- * loss of user code.
+ * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be
+ * finished by the user. This class is generated only once to prevent loss of user code.
*/
public final class SimpleAddressBuilder {
diff --git a/lisp/api/src/main/yang/lisp.yang b/lisp/api/src/main/yang/lisp.yang
index 4f64ca28a..d7aad651c 100755
--- a/lisp/api/src/main/yang/lisp.yang
+++ b/lisp/api/src/main/yang/lisp.yang
@@ -31,7 +31,7 @@ module lisp {
typedef locator-set-ref {
type leafref {
- path "/lisp/locator-sets/locator-set/name";
+ path "/lisp/lisp-feature-data/locator-sets/locator-set/name";
}
description "Locator-set reference";
}
@@ -91,7 +91,6 @@ module lisp {
// lisp_add_del_locator locator-set <ls_name> iface <iface_name>
// p <val> w <val> [del]
container locator-sets {
- when "../lisp:enable = 'true'";
list locator-set {
key "name";
leaf name {
@@ -114,126 +113,147 @@ module lisp {
description "Grouping for locator-sets";
}
- grouping eid-table-grouping {
- container eid-table {
- when "../lisp:enable = 'true'";
- list vni-table {
- key "virtual-network-identifier";
- leaf virtual-network-identifier {
- type uint32;
- description "vni";
+ grouping adjacencies-grouping {
+ container adjacencies {
+ list adjacency {
+ key "id";
+ leaf id {
+ type string;
+ description "Adjacency id";
}
- leaf table-id {
- type uint32;
- description "table-id/vrf";
+ container local-eid {
+ uses lisp-types:lisp-address;
+ description "Local EID that must have a local mapping";
}
- // Once both vni and table-id are set:
- // lisp_eid_table_add_del_map <vni> <vrf>
- container local-mappings {
- list local-mapping {
- key "id";
- leaf id {
- type mapping-id;
- description "Id that uniquely identifies a mapping";
- }
- container eid {
- uses lisp-types:lisp-address;
- description "EID address";
- }
- leaf locator-set {
- type locator-set-ref;
- description "Locator-set";
- }
- description "Local mapping";
- }
- description "Local EID to locator-set mappings";
+ container remote-eid {
+ uses lisp-types:lisp-address;
+ description "Remote EID that must have a remote mapping";
+ }
+ description "List of adjacencies";
+ }
+ description "Adjacencies programmed into the data plane";
+ }
+ description "Adjacencies grouping";
+ }
+
+ grouping dp-subtable-grouping {
+ // Once both vni and table-id are set:
+ // lisp_eid_table_add_del_map <vni> <dp_table>
+ container local-mappings {
+ list local-mapping {
+ key "id";
+ leaf id {
+ type mapping-id;
+ description "Id that uniquely identifies a mapping";
+ }
+ container eid {
+ uses lisp-types:lisp-address;
+ description "EID address";
+ }
+ leaf locator-set {
+ type locator-set-ref;
+ description "Locator-set";
}
+ description "Local mapping";
+ }
+ description "Local EID to locator-set mappings";
+ }
// lisp_add_del_local_eid eid <ip-address/mask> locator-set
// <ls-name> [del]
- // lisp_add_del_remote_mapping vni <vni> eid <ip-pref> seid
- // <ip-pref> [action <action>] rloc
+ // lisp_add_del_remote_mapping vni <vni> eid <eid> seid
+ // <seid> [action <action>] rloc
// <ip-addr> [rloc <ip-addr> ..]
- // NOTE: 1.lisp_add_del_remote_mapping needs updating, right now
- // it expects both seid and deid, but this will be
- // simplified to just eid
- // 2.priority/weight not yet part of API, patch under
- // review
- container remote-mappings {
- list remote-mapping {
- key "id";
- leaf id {
- type mapping-id;
- description "Id that uniquely identifies a mapping";
- }
- container eid {
- description "Remote EID address";
- uses lisp-types:lisp-address;
- }
- leaf ttl {
- type uint32;
- description "Mapping validity period.";
- }
- leaf authoritative {
- type bits {
- bit A {
- description "Authoritative bit.";
- }
- }
- description
- "Bit that indicates if mapping comes from an
- authoritative source.";
+ // NOTE: 1.lisp_add_del_remote_mapping seid is used to build
+ // src/dst mappings. Rlocs have p/w in them
+ container remote-mappings {
+ list remote-mapping {
+ key "id";
+ leaf id {
+ type mapping-id;
+ description "Id that uniquely identifies a mapping";
+ }
+ container eid {
+ description "Remote EID address";
+ uses lisp-types:lisp-address;
+ }
+ leaf ttl {
+ type uint32;
+ description "Mapping validity period.";
+ }
+ leaf authoritative {
+ type bits {
+ bit A {
+ description "Authoritative bit.";
}
- choice locator-list {
- description
- "list of locators are either negative, or positive.";
- case negative-mapping {
- //NOTE if this is enclosed in container,there can be a dedicated writer/reader
- //for setting/reading this node
+ }
+ description
+ "Bit that indicates if mapping comes from an
+ authoritative source.";
+ }
+ choice locator-list {
+ description
+ "list of locators are either negative, or positive.";
+ case negative-mapping {
+ //NOTE - Wrapped in container to prevent leaf map-reply-action enforcing impresence of rlocs
+ container map-reply{
leaf map-reply-action {
type map-reply-action;
description
"Forwarding action for a negative mapping.";
}
+ }
+ }
+ case positive-mapping {
+ // NOTE if container is not needed to encapsulate
+ // locator list, remove it
+ container rlocs {
+ list locator {
+ key "address";
+ leaf address {
+ type inet:ip-address;
+ description "Locator address";
+ }
+ uses locator-properties-grouping;
+ description "Remote locator";
}
- case positive-mapping {
- container rlocs {
- list locator {
- key "address";
- leaf address {
- type inet:ip-address;
- description "Locator address";
- }
- uses locator-properties-grouping;
- description "Remote locator";
- }
- description
- "List of locators for a positive mapping.";
- }
- }
+ description
+ "List of locators for a positive mapping.";
}
- description "List of remote mappings";
}
- description "Map-cache/remote mappings cache";
}
+ uses adjacencies-grouping;
+ description "List of remote mappings";
+ }
+ description "Map-cache/remote mappings cache";
+ }
+ description "Data path subtable (VRF/bridge domain) grouping";
+ }
- container adjacencies {
- list adjacency {
- key "id";
- leaf id {
- type string;
- description "Adjacency id";
- }
- container local-eid {
- uses lisp-types:lisp-address;
- description "Local EID that must have a local mapping";
- }
- container remote-eid {
- uses lisp-types:lisp-address;
- description "Remote EID that must have a remote mapping";
- }
- description "List of adjacencies";
+ grouping eid-table-grouping {
+ container eid-table {
+ list vni-table {
+ key "virtual-network-identifier";
+ leaf virtual-network-identifier {
+ type uint32;
+ description "vni";
+ }
+ container vrf-subtable {
+ leaf table-id {
+ type uint32;
+ description "table-id";
}
- description "Adjacencies programmed into the data plane";
+
+ uses dp-subtable-grouping;
+ description "VRF subtable";
+ }
+ container bridge-domain-subtable {
+ leaf bridge-domain-ref {
+ type string;
+ description "Name reference to existing bridge domain";
+ }
+
+ uses dp-subtable-grouping;
+ description "Bridge domain subtable";
}
description "VNI tables";
}
@@ -244,7 +264,6 @@ module lisp {
grouping map-resolvers-grouping {
container map-resolvers {
// lisp_add_del_map_resolver <ip>
- when "../lisp:enable = 'true'";
list map-resolver {
key ip-address;
leaf ip-address {
@@ -260,52 +279,60 @@ module lisp {
grouping pitr-cfg-grouping {
// lisp_pitr_set_locator_set <ip>
container pitr-cfg {
- when "../lisp:enable = 'true'";
leaf locator-set {
type locator-set-ref;
description "Locator-set reference";
}
description "Proxy-ITR configuration";
}
- description "";
+ description "PITR configuration grouping";
+ }
+
+ grouping itr-remote-locator-sets-grouping{
+ container itr-remote-locator-set{
+ // lisp_add_del_map_request_itr_rlocs add/del <ls_name>
+ // lisp_get_map_request_itr_rlocs
+ leaf remote-locator-set-name{
+ type locator-set-ref;
+ description "Locators to be used in map-requests";
+ }
+ }
+ }
+
+ grouping lisp-feature-data-grouping{
+ //aggregation of all lisp data, restricted by Lisp beeing enabled
+
+ container lisp-feature-data{
+ when "../lisp:enable = 'true'";
+
+ uses locator-sets-grouping;
+ uses eid-table-grouping;
+ uses map-resolvers-grouping;
+ uses pitr-cfg-grouping;
+ uses itr-remote-locator-sets-grouping;
+ }
}
// ref https://wiki.fd.io/view/ONE/Command-line_Interface_CLI_Guide
container lisp {
+
// lisp_enable_disable / lisp_enable_disable_status_dump
leaf enable {
type boolean;
description "Enable/disable LISP feature";
}
- // lisp_add_del_map_request_itr_rlocs add/del <ls_name>
- leaf itr-rlocs {
- type locator-set-ref;
- description "Locators to be used in map-requests";
- }
- uses locator-sets-grouping;
- uses eid-table-grouping;
- uses map-resolvers-grouping;
- uses pitr-cfg-grouping;
-
- // lisp_pitr_set_locator_set <ip>
+ uses lisp-feature-data-grouping;
description "LISP configuration";
}
container lisp-state {
- config false;
+
+ // lisp_enable_disable / lisp_enable_disable_status_dump
leaf enable {
type boolean;
- description "LISP status";
- }
- leaf itr-rlocs {
- type locator-set-ref;
- description "Locators to be used in map-requests";
+ description "Enable/disable LISP feature";
}
- uses locator-sets-grouping;
- uses eid-table-grouping;
- uses map-resolvers-grouping;
- uses pitr-cfg-grouping;
-
+ uses lisp-feature-data-grouping;
description "LISP state";
}
-} \ No newline at end of file
+}
diff --git a/lisp/lisp2vpp/pom.xml b/lisp/lisp2vpp/pom.xml
index 7506f1e0c..38f569a32 100755
--- a/lisp/lisp2vpp/pom.xml
+++ b/lisp/lisp2vpp/pom.xml
@@ -106,5 +106,6 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
+
</dependencies>
</project>
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/LispModule.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/LispModule.java
index 5344dfc7f..2317b49f7 100644
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/LispModule.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/LispModule.java
@@ -23,10 +23,12 @@ import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.LOCATOR_SET_CONTEX
import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.REMOTE_MAPPING_CONTEXT;
import com.google.inject.AbstractModule;
+import com.google.inject.Singleton;
import com.google.inject.multibindings.Multibinder;
import com.google.inject.name.Names;
import io.fd.honeycomb.data.init.DataTreeInitializer;
import io.fd.honeycomb.lisp.cfgattrs.LispConfiguration;
+import io.fd.honeycomb.lisp.context.util.ContextsReaderFactoryProvider;
import io.fd.honeycomb.lisp.context.util.EidMappingContext;
import io.fd.honeycomb.lisp.translate.initializers.LispInitializer;
import io.fd.honeycomb.lisp.translate.read.factory.LispStateReaderFactory;
@@ -44,10 +46,8 @@ public class LispModule extends AbstractModule {
@Override
protected void configure() {
- LOG.info("Installing configuration module");
+ LOG.info("Configuring module Lisp");
install(ConfigurationModule.create());
-
- LOG.info("Injecting Lisp configuration");
requestInjection(LispConfiguration.class);
LOG.info("Binding Naming context[{}]", LOCATOR_SET_CONTEXT);
@@ -67,26 +67,23 @@ public class LispModule extends AbstractModule {
LOG.info("Binding reader factories");
final Multibinder<ReaderFactory> readerFactoryBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class);
-
- LOG.info("Binding [{}]", LispStateReaderFactory.class.getName());
readerFactoryBinder.addBinding().to(LispStateReaderFactory.class);
LOG.info("Reader factories binded");
LOG.info("Binding writer factories");
final Multibinder<WriterFactory> writerFactoryBinder = Multibinder.newSetBinder(binder(), WriterFactory.class);
-
- LOG.info("Binding [{}]", LispWriterFactory.class.getName());
writerFactoryBinder.addBinding().to(LispWriterFactory.class);
LOG.info("Writer factories binded");
LOG.info("Binding initializers");
final Multibinder<DataTreeInitializer> initializerBinder =
Multibinder.newSetBinder(binder(), DataTreeInitializer.class);
-
- LOG.info("Binding [{}]", LispInitializer.class.getName());
initializerBinder.addBinding().to(LispInitializer.class);
LOG.info("Initializers binded");
+ final Multibinder<ReaderFactory> readerBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class);
+ readerBinder.addBinding().toProvider(ContextsReaderFactoryProvider.class).in(Singleton.class);
+
LOG.info("Module Lisp successfully configured");
}
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/cfgattrs/LispConfiguration.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/cfgattrs/LispConfiguration.java
index dae41cebd..75083468c 100644
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/cfgattrs/LispConfiguration.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/cfgattrs/LispConfiguration.java
@@ -53,11 +53,6 @@ public class LispConfiguration {
public static final String HONEYCOMB_INITIALIZER = "honeycomb-initializer";
/**
- * Unique prefix for naming context of interfaces.
- **/
- public static final String INTERFACE_CONTEXT_PREFIX = "interface-";
-
- /**
* Unique prefix for naming context of locator sets.
**/
public static final String LOCATOR_SET_CONTEXT_PREFIX = "locator-set-";
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/ContextsReaderFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/ContextsReaderFactory.java
new file mode 100644
index 000000000..29a5e3fd4
--- /dev/null
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/ContextsReaderFactory.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * 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.
+ */
+
+package io.fd.honeycomb.lisp.context.util;
+
+import io.fd.honeycomb.translate.read.ReaderFactory;
+import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
+import io.fd.honeycomb.translate.util.read.BindingBrokerReader;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.Contexts;
+import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.ContextsBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * {@link ReaderFactory} initiating reader providing data from context data store for eid's.
+ * Making them available over RESTCONF/NETCONF.
+ */
+public class ContextsReaderFactory implements ReaderFactory {
+
+ private final DataBroker contextBindingBrokerDependency;
+
+ public ContextsReaderFactory(final DataBroker contextBindingBrokerDependency) {
+ this.contextBindingBrokerDependency = contextBindingBrokerDependency;
+ }
+
+ @Override
+ public void init(final ModifiableReaderRegistryBuilder registry) {
+ registry.add(new BindingBrokerReader<>(InstanceIdentifier.create(Contexts.class),
+ contextBindingBrokerDependency,
+ LogicalDatastoreType.OPERATIONAL, ContextsBuilder.class));
+ }
+}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/ContextsReaderFactoryProvider.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/ContextsReaderFactoryProvider.java
new file mode 100644
index 000000000..d023b3e9f
--- /dev/null
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/ContextsReaderFactoryProvider.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * 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.
+ */
+
+package io.fd.honeycomb.lisp.context.util;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.name.Named;
+import io.fd.honeycomb.translate.read.ReaderFactory;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+
+
+public class ContextsReaderFactoryProvider implements Provider<ReaderFactory> {
+
+ @Inject
+ @Named("honeycomb-context")
+ private DataBroker contextDataBroker;
+
+ @Override
+ public ReaderFactory get() {
+ return new ContextsReaderFactory(contextDataBroker);
+ }
+}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/EidMappingContext.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/EidMappingContext.java
index 153061ef5..d9513e10e 100644
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/EidMappingContext.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/EidMappingContext.java
@@ -17,6 +17,7 @@
package io.fd.honeycomb.lisp.context.util;
import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkState;
import com.google.common.base.Optional;
import io.fd.honeycomb.lisp.translate.util.EidTranslator;
@@ -35,12 +36,15 @@ import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.MappingId;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Utility class allowing {@link MappingId} to {@link Eid} mapping
*/
public class EidMappingContext implements EidTranslator {
+ private static final Logger LOG = LoggerFactory.getLogger(EidMappingContext.class);
private static final Collector<Mapping, ?, Mapping> SINGLE_ITEM_COLLECTOR = RWUtils.singleItemCollector();
private final KeyedInstanceIdentifier<org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.EidMappingContext, EidMappingContextKey>
@@ -60,22 +64,22 @@ public class EidMappingContext implements EidTranslator {
/**
* Retrieve name for mapping stored provided mappingContext instance.
*
- * @param eid eid of a mapped item
+ * @param remoteEid eid of a mapped item
* @param mappingContext mapping context providing context data for current transaction
* @return name mapped to provided index
*/
@Nonnull
public synchronized MappingId getId(
- @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.local.mapping.Eid eid,
+ @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid remoteEid,
@Nonnull final MappingContext mappingContext) {
final Optional<Mappings> read = mappingContext.read(namingContextIid.child(Mappings.class));
+ checkState(read.isPresent(), "Mapping for eid: %s is not present. But should be", remoteEid);
- //dont create artificial name as naming context, to not create refference to some artificial(in vpp non-existing)eid
- checkArgument(read.isPresent(), "No mapping stored for eid: %s", eid);
-
- return read.get().getMapping().stream()
- .filter(mapping -> compareEids(mapping.getEid(), eid))
+ return read.get().getMapping()
+ .stream()
+ //cannot split to map + filtering,because its collecting mappings,not eid's
+ .filter(mapping -> compareEids(mapping.getEid(), remoteEid))
.collect(SINGLE_ITEM_COLLECTOR).getId();
}
@@ -88,21 +92,13 @@ public class EidMappingContext implements EidTranslator {
*/
@Nonnull
public synchronized MappingId getId(
- @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.Eid eid,
+ @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid eid,
@Nonnull final MappingContext mappingContext) {
final Optional<Mappings> read = mappingContext.read(namingContextIid.child(Mappings.class));
+ //don't create artificial name as naming context, to not create reference to some artificial(in vpp non-existing)eid
+ checkState(read.isPresent(), "Mapping for eid: %s is not present. But should be", eid);
- //dont create artificial name as naming context, to not create refference to some artificial(in vpp non-existing)eid
- checkArgument(read.isPresent(), "No mapping stored for eid: %s", eid);
-
- //this kind of comparing is needed ,because yang generated containers does not override equals,unless they are defined as types
- //in this hierarchy the first that define proper equals is Ipv4Address/Ipv6Address/MacAddress
- //
- // From official javadoc
- // The equals method for class Object implements the most discriminating possible equivalence relation on objects;
- // that is, for any non-null reference values x and y, this method returns true if and only if x and y refer to the same object
- // (x == y has the value true).
return read.get().getMapping().stream()
.filter(mapping -> compareEids(mapping.getEid(), eid))
.collect(SINGLE_ITEM_COLLECTOR).getId();
@@ -116,16 +112,14 @@ public class EidMappingContext implements EidTranslator {
* @return true if present, false otherwise
*/
public synchronized boolean containsId(
- @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.local.mapping.Eid eid,
+ @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid eid,
@Nonnull final MappingContext mappingContext) {
final Optional<Mappings> read = mappingContext.read(namingContextIid.child(Mappings.class));
- //dont create artificial name as naming context, to not create refference to some artificial(in vpp non-existing)eid
- checkArgument(read.isPresent(), "No mapping stored for eid: %s", eid);
-
- return read.isPresent()
- ? read.get().getMapping().stream().anyMatch(mapping -> compareEids(mapping.getEid(), eid))
- : false;
+ return read.isPresent() &&
+ read.get().getMapping()
+ .stream()
+ .anyMatch(mapping -> compareEids(mapping.getEid(), eid));
}
/**
@@ -136,15 +130,14 @@ public class EidMappingContext implements EidTranslator {
* @return true if present, false otherwise
*/
public synchronized boolean containsId(
- @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.Eid eid,
+ @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid eid,
@Nonnull final MappingContext mappingContext) {
final Optional<Mappings> read = mappingContext.read(namingContextIid.child(Mappings.class));
- checkArgument(read.isPresent(), "No mapping stored for eid: %s", eid);
-
- return read.isPresent()
- ? read.get().getMapping().stream().anyMatch(mapping -> compareEids(mapping.getEid(), eid))
- : false;
+ return read.isPresent() &&
+ read.get().getMapping()
+ .stream()
+ .anyMatch(mapping -> compareEids(mapping.getEid(), eid));
}
@@ -157,11 +150,10 @@ public class EidMappingContext implements EidTranslator {
*/
public synchronized void addEid(
@Nonnull final MappingId index,
- @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.local.mapping.Eid eid,
+ @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid eid,
final MappingContext mappingContext) {
final KeyedInstanceIdentifier<Mapping, MappingKey> mappingIid = getMappingIid(index);
- //this copy is needed (type of eid in mapping is different that in local mapping,they only have same ancestor)
mappingContext.put(mappingIid, new MappingBuilder().setId(index).setEid(copyEid(eid)).build());
}
@@ -174,7 +166,7 @@ public class EidMappingContext implements EidTranslator {
*/
public synchronized void addEid(
@Nonnull final MappingId index,
- @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.Eid eid,
+ @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid eid,
final MappingContext mappingContext) {
final KeyedInstanceIdentifier<Mapping, MappingKey> mappingIid = getMappingIid(index);
@@ -186,13 +178,13 @@ public class EidMappingContext implements EidTranslator {
}
private Eid copyEid(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.local.mapping.Eid eid) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid eid) {
return new EidBuilder().setAddress(eid.getAddress()).setAddressType(eid.getAddressType())
.setVirtualNetworkId(eid.getVirtualNetworkId()).build();
}
private Eid copyEid(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.Eid eid) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid eid) {
return new EidBuilder().setAddress(eid.getAddress()).setAddressType(eid.getAddressType())
.setVirtualNetworkId(eid.getVirtualNetworkId()).build();
}
@@ -218,7 +210,7 @@ public class EidMappingContext implements EidTranslator {
public synchronized Eid getEid(@Nonnull final MappingId index, final MappingContext mappingContext) {
final Optional<Mapping> read = mappingContext.read(getMappingIid(index));
checkArgument(read.isPresent(), "No mapping stored for index: %s", index);
- return mappingContext.read(getMappingIid(index)).get().getEid();
+ return read.get().getEid();
}
/**
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/initializers/LispInitializer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/initializers/LispInitializer.java
index 105ee0aec..690d2a91a 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/initializers/LispInitializer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/initializers/LispInitializer.java
@@ -58,11 +58,7 @@ public class LispInitializer extends AbstractDataTreeConverter<LispState, Lisp>
// configuration can fail)
return lispBuilder.setEnable(operationalData.isEnable())
- .setEidTable(operationalData.getEidTable())
- .setLocatorSets(operationalData.getLocatorSets())
- .setMapResolvers(operationalData.getMapResolvers())
- .setPitrCfg(operationalData.getPitrCfg())
+ .setLispFeatureData(operationalData.getLispFeatureData())
.build();
}
-
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizer.java
index 373de70b3..ef5de97f2 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizer.java
@@ -25,10 +25,10 @@ import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import javax.naming.OperationNotSupportedException;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.AdjacenciesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.AdjacencyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.AdjacencyKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.AdjacenciesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.Adjacency;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.AdjacencyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.AdjacencyKey;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizer.java
new file mode 100644
index 000000000..e75562651
--- /dev/null
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizer.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2015 Cisco and/or its affiliates.
+ *
+ * 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.
+ */
+
+package io.fd.honeycomb.lisp.translate.read;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.Optional;
+import io.fd.honeycomb.lisp.translate.read.dump.executor.SubtableDumpExecutor;
+import io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams;
+import io.fd.honeycomb.lisp.translate.read.trait.SubtableReader;
+import io.fd.honeycomb.translate.read.ReadContext;
+import io.fd.honeycomb.translate.read.ReadFailedException;
+import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
+import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
+import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
+import io.fd.honeycomb.translate.vpp.util.NamingContext;
+import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetails;
+import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import java.util.List;
+import java.util.stream.Collectors;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtableBuilder;
+import org.opendaylight.yangtools.concepts.Builder;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BridgeDomainSubtableCustomizer extends FutureJVppCustomizer implements
+ ReaderCustomizer<BridgeDomainSubtable, BridgeDomainSubtableBuilder>, SubtableReader {
+
+ private static final Logger LOG = LoggerFactory.getLogger(BridgeDomainSubtableCustomizer.class);
+ private static final String CACHE_KEY = BridgeDomainSubtableCustomizer.class.getName();
+
+ private final DumpCacheManager<LispEidTableMapDetailsReplyDump, SubtableDumpParams> dumpManager;
+ private final SubtableDumpExecutor dumpExecutor;
+ private final NamingContext bridgeDomainContext;
+
+ public BridgeDomainSubtableCustomizer(@Nonnull final FutureJVppCore futureJvppCore,
+ @Nonnull final NamingContext bridgeDomainContext) {
+ super(futureJvppCore);
+ dumpExecutor = new SubtableDumpExecutor(futureJvppCore);
+ dumpManager =
+ new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableMapDetailsReplyDump, SubtableDumpParams>()
+ .withExecutor(dumpExecutor)
+ .build();
+ this.bridgeDomainContext = checkNotNull(bridgeDomainContext, "Bridge domain context cannot be null");
+ }
+
+ @Nonnull
+ @Override
+ public BridgeDomainSubtableBuilder getBuilder(@Nonnull final InstanceIdentifier<BridgeDomainSubtable> id) {
+ return new BridgeDomainSubtableBuilder();
+ }
+
+ @Override
+ public void readCurrentAttributes(@Nonnull final InstanceIdentifier<BridgeDomainSubtable> id,
+ @Nonnull final BridgeDomainSubtableBuilder builder,
+ @Nonnull final ReadContext ctx) throws ReadFailedException {
+ final int vni = checkNotNull(id.firstKeyOf(VniTable.class), "Cannot find parent VNI Table")
+ .getVirtualNetworkIdentifier().intValue();
+ LOG.debug("Read attributes for id {}", id);
+ //dumps only L2(bridge domains)
+ final Optional<LispEidTableMapDetailsReplyDump> reply =
+ readSubtable(dumpManager, CACHE_KEY, ctx.getModificationCache(), id, L2_PARAMS);
+
+ if (!reply.isPresent() || reply.get().lispEidTableMapDetails.isEmpty()) {
+ return;
+ }
+
+ // Single item collector cant be used in this case,because bridge-domain-subtable is container
+ // so read is invoked every time parent is defined
+ final List<LispEidTableMapDetails>
+ details = reply.get().lispEidTableMapDetails.stream().filter(a -> a.vni == vni)
+ .collect(Collectors.toList());
+ if (details.size() == 1) {
+ final LispEidTableMapDetails detail = details.get(0);
+ builder.setBridgeDomainRef(bridgeDomainContext.getName(detail.dpTable, ctx.getMappingContext()));
+ LOG.debug("Attributes for {} successfully loaded", id);
+ }
+ }
+
+ @Override
+ public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder,
+ @Nonnull final BridgeDomainSubtable readValue) {
+ ((VniTableBuilder) parentBuilder).setBridgeDomainSubtable(readValue);
+ }
+}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java
new file mode 100644
index 000000000..48e559ddc
--- /dev/null
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2015 Cisco and/or its affiliates.
+ *
+ * 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.
+ */
+
+package io.fd.honeycomb.lisp.translate.read;
+
+
+import static io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor.NO_PARAMS;
+
+import com.google.common.base.Optional;
+import io.fd.honeycomb.lisp.translate.read.dump.executor.ItrRemoteLocatorSetDumpExecutor;
+import io.fd.honeycomb.translate.read.ReadContext;
+import io.fd.honeycomb.translate.read.ReadFailedException;
+import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
+import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
+import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager.DumpCacheManagerBuilder;
+import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException;
+import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
+import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.itr.remote.locator.sets.grouping.ItrRemoteLocatorSet;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.itr.remote.locator.sets.grouping.ItrRemoteLocatorSetBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.lisp.feature.data.grouping.LispFeatureDataBuilder;
+import org.opendaylight.yangtools.concepts.Builder;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocsReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+
+public class ItrRemoteLocatorSetCustomizer extends FutureJVppCustomizer
+ implements ReaderCustomizer<ItrRemoteLocatorSet, ItrRemoteLocatorSetBuilder>, ByteDataTranslator {
+
+ private static final String CACHE_KEY = ItrRemoteLocatorSetCustomizer.class.getName();
+
+ private final DumpCacheManager<LispGetMapRequestItrRlocsReply, Void> dumpCacheManager;
+
+ public ItrRemoteLocatorSetCustomizer(@Nonnull final FutureJVppCore futureJVppCore) {
+ super(futureJVppCore);
+ dumpCacheManager = new DumpCacheManagerBuilder<LispGetMapRequestItrRlocsReply, Void>()
+ .withExecutor(new ItrRemoteLocatorSetDumpExecutor(futureJVppCore)).build();
+ }
+
+ @Nonnull
+ @Override
+ public ItrRemoteLocatorSetBuilder getBuilder(@Nonnull final InstanceIdentifier<ItrRemoteLocatorSet> id) {
+ return new ItrRemoteLocatorSetBuilder();
+ }
+
+ @Override
+ public void readCurrentAttributes(@Nonnull final InstanceIdentifier<ItrRemoteLocatorSet> id,
+ @Nonnull final ItrRemoteLocatorSetBuilder builder, @Nonnull final ReadContext ctx)
+ throws ReadFailedException {
+
+ Optional<LispGetMapRequestItrRlocsReply> reply;
+ try {
+ reply = dumpCacheManager.getDump(CACHE_KEY, ctx.getModificationCache(), NO_PARAMS);
+ } catch (DumpExecutionFailedException e) {
+ throw new ReadFailedException(id, e);
+ }
+
+ if (!reply.isPresent() || reply.get().locatorSetName == null) {
+ return;
+ }
+
+ builder.setRemoteLocatorSetName(toString(reply.get().locatorSetName));
+ }
+
+ @Override
+ public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder,
+ @Nonnull final ItrRemoteLocatorSet readValue) {
+ ((LispFeatureDataBuilder) parentBuilder).setItrRemoteLocatorSet(readValue);
+ }
+}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java
index 0290aa086..52135def3 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java
@@ -27,6 +27,7 @@ import com.google.common.base.Optional;
import io.fd.honeycomb.lisp.context.util.EidMappingContext;
import io.fd.honeycomb.lisp.translate.read.dump.executor.MappingsDumpExecutor;
import io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams;
+import io.fd.honeycomb.lisp.translate.read.trait.MappingFilterProvider;
import io.fd.honeycomb.lisp.translate.util.EidTranslator;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
@@ -36,23 +37,24 @@ import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
+import io.fd.vpp.jvpp.core.dto.LispEidTableDetails;
+import io.fd.vpp.jvpp.core.dto.LispEidTableDetailsReplyDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.MappingId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.LocalMappingsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMappingBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMappingKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.LocalMappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.LocalMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.LocalMappingKey;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispEidTableDetails;
-import io.fd.vpp.jvpp.core.dto.LispEidTableDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -61,11 +63,13 @@ import org.slf4j.LoggerFactory;
*/
public class LocalMappingCustomizer
extends FutureJVppCustomizer
- implements ListReaderCustomizer<LocalMapping, LocalMappingKey, LocalMappingBuilder>, EidTranslator {
+ implements ListReaderCustomizer<LocalMapping, LocalMappingKey, LocalMappingBuilder>, EidTranslator,
+ MappingFilterProvider {
private static final Logger LOG = LoggerFactory.getLogger(LocalMappingCustomizer.class);
private static final String KEY = LocalMappingCustomizer.class.getName();
+
private final DumpCacheManager<LispEidTableDetailsReplyDump, MappingsDumpParams> dumpManager;
private final MappingsDumpExecutor dumpExecutor;
private final NamingContext locatorSetContext;
@@ -83,7 +87,6 @@ public class LocalMappingCustomizer
.build();
}
-
@Override
public LocalMappingBuilder getBuilder(InstanceIdentifier<LocalMapping> id) {
return new LocalMappingBuilder();
@@ -128,17 +131,20 @@ public class LocalMappingCustomizer
}
LispEidTableDetails details = replyOptional.get().lispEidTableDetails.stream()
- .filter(a -> compareAddresses(eid.getAddress(),
- getArrayAsEidLocal(valueOf(a.eidType), a.eid).getAddress()))
- .collect(
- RWUtils.singleItemCollector());
+ .filter(subtableFilterForLocalMappings(id))
+ .filter(detail -> compareAddresses(eid.getAddress(), getAddressFromDumpDetail(detail)))
+ .collect(RWUtils.singleItemCollector());
//in case of local mappings,locator_set_index stands for interface index
checkState(locatorSetContext.containsName(details.locatorSetIndex, ctx.getMappingContext()),
"No Locator Set name found for index %s", details.locatorSetIndex);
builder.setLocatorSet(locatorSetContext.getName(details.locatorSetIndex, ctx.getMappingContext()));
builder.setKey(new LocalMappingKey(new MappingId(id.firstKeyOf(LocalMapping.class).getId())));
- builder.setEid(getArrayAsEidLocal(valueOf(details.eidType), details.eid));
+ builder.setEid(getArrayAsEidLocal(valueOf(details.eidType), details.eid, details.vni));
+ }
+
+ private Address getAddressFromDumpDetail(final LispEidTableDetails detail) {
+ return getArrayAsEidLocal(valueOf(detail.eidType), detail.eid, detail.vni).getAddress();
}
@Override
@@ -173,14 +179,14 @@ public class LocalMappingCustomizer
return Collections.emptyList();
}
+
return replyOptional.get().lispEidTableDetails.stream()
- //filtering with vni to skip help local mappings that are created in vpp to handle remote mappings(vpp feature)
.filter(a -> a.vni == vni)
- .map(a -> new LocalMappingKey(
- new MappingId(
- localMappingContext.getId(
- getArrayAsEidLocal(valueOf(a.eidType), a.eid),
- context.getMappingContext()))))
+ .filter(subtableFilterForLocalMappings(id))
+ .map(detail -> getArrayAsEidLocal(valueOf(detail.eidType), detail.eid, detail.vni))
+ .map(localEid -> localMappingContext.getId(localEid, context.getMappingContext()))
+ .map(MappingId::new)
+ .map(LocalMappingKey::new)
.collect(Collectors.toList());
}
@@ -192,4 +198,5 @@ public class LocalMappingCustomizer
private static String bindKey(String prefix) {
return prefix + "_" + KEY;
}
+
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java
index d4e0ef60e..21281c75b 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java
@@ -28,6 +28,10 @@ import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException;
import io.fd.honeycomb.translate.vpp.util.AddressTranslator;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
+import io.fd.vpp.jvpp.core.dto.LispMapResolverDetails;
+import io.fd.vpp.jvpp.core.dto.LispMapResolverDetailsReplyDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@@ -39,9 +43,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispMapResolverDetails;
-import io.fd.vpp.jvpp.core.dto.LispMapResolverDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -83,12 +84,10 @@ public class MapResolverCustomizer extends FutureJVppCustomizer
}
final MapResolverKey key = id.firstKeyOf(MapResolver.class);
- //revert searched key to match vpp's reversed order ip's
- final IpAddress address = reverseAddress(key.getIpAddress());
final LispMapResolverDetails mapResolverDetails =
dumpOptional.get().lispMapResolverDetails.stream()
- .filter(a -> address
- .equals(arrayToIpAddress(byteToBoolean(a.isIpv6), a.ipAddress)))
+ .filter(a -> addressesEqual(key.getIpAddress(),
+ arrayToIpAddressReversed(byteToBoolean(a.isIpv6), a.ipAddress)))
.collect(RWUtils.singleItemCollector());
builder.setKey(key);
@@ -96,6 +95,12 @@ public class MapResolverCustomizer extends FutureJVppCustomizer
arrayToIpAddress(byteToBoolean(mapResolverDetails.isIpv6), mapResolverDetails.ipAddress));
}
+ // safest way to compare addresses - prevents returning false while using different types from hierarchy
+ // Ex. Key for MapResolver contains Ipv4Address as value but we translate addresses from binary data to Ipv4AddressNoZone
+ private boolean addressesEqual(final IpAddress left, final IpAddress right) {
+ return Arrays.equals(left.getValue(), right.getValue());
+ }
+
@Override
public List<MapResolverKey> getAllIds(InstanceIdentifier<MapResolver> id, ReadContext context)
throws ReadFailedException {
@@ -114,7 +119,7 @@ public class MapResolverCustomizer extends FutureJVppCustomizer
return dumpOptional.get().lispMapResolverDetails.stream()
.map(resolver -> new MapResolverKey(
- arrayToIpAddress(byteToBoolean(resolver.isIpv6), resolver.ipAddress)))
+ arrayToIpAddressReversed(byteToBoolean(resolver.isIpv6), resolver.ipAddress)))
.collect(Collectors.toList());
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizer.java
index 6e97216bc..4d8bbede0 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizer.java
@@ -24,7 +24,7 @@ import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import java.util.concurrent.TimeoutException;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.LispStateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.lisp.feature.data.grouping.LispFeatureDataBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.pitr.cfg.grouping.PitrCfg;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.pitr.cfg.grouping.PitrCfgBuilder;
import org.opendaylight.yangtools.concepts.Builder;
@@ -74,7 +74,7 @@ public class PitrCfgCustomizer extends FutureJVppCustomizer
@Override
public void merge(Builder<? extends DataObject> parentBuilder, PitrCfg readValue) {
- ((LispStateBuilder) parentBuilder).setPitrCfg(readValue);
+ ((LispFeatureDataBuilder) parentBuilder).setPitrCfg(readValue);
}
public ShowLispPitrReply getPitrStatus() throws TimeoutException, VppBaseCallException {
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java
index 230c8766d..5d092f988 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java
@@ -21,38 +21,57 @@ import static com.google.common.base.Preconditions.checkState;
import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.valueOf;
import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.FilterType;
import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.MappingsDumpParamsBuilder;
+import static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.MapReplyAction.NoAction;
import com.google.common.base.Optional;
import io.fd.honeycomb.lisp.context.util.EidMappingContext;
+import io.fd.honeycomb.lisp.translate.read.dump.executor.LocatorDumpExecutor;
import io.fd.honeycomb.lisp.translate.read.dump.executor.MappingsDumpExecutor;
+import io.fd.honeycomb.lisp.translate.read.dump.executor.params.LocatorDumpParams;
+import io.fd.honeycomb.lisp.translate.read.dump.executor.params.LocatorDumpParams.LocatorDumpParamsBuilder;
import io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams;
import io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.QuantityType;
+import io.fd.honeycomb.lisp.translate.read.trait.MappingFilterProvider;
import io.fd.honeycomb.lisp.translate.util.EidTranslator;
+import io.fd.honeycomb.translate.ModificationCache;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
import io.fd.honeycomb.translate.util.RWUtils;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException;
+import io.fd.honeycomb.translate.vpp.util.AddressTranslator;
+import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
+import io.fd.vpp.jvpp.core.dto.LispEidTableDetails;
+import io.fd.vpp.jvpp.core.dto.LispEidTableDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.LispLocatorDetails;
+import io.fd.vpp.jvpp.core.dto.LispLocatorDetailsReplyDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.MapReplyAction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.MappingId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.RemoteMappingsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMappingBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMappingKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.NegativeMappingBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.PositiveMappingBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.negative.mapping.MapReplyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.positive.mapping.RlocsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.positive.mapping.rlocs.Locator;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.positive.mapping.rlocs.LocatorBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.positive.mapping.rlocs.LocatorKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.RemoteMappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.RemoteMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.RemoteMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.EidBuilder;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispEidTableDetails;
-import io.fd.vpp.jvpp.core.dto.LispEidTableDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -61,12 +80,13 @@ import org.slf4j.LoggerFactory;
*/
public class RemoteMappingCustomizer extends FutureJVppCustomizer
implements ListReaderCustomizer<RemoteMapping, RemoteMappingKey, RemoteMappingBuilder>,
- EidTranslator {
+ EidTranslator, AddressTranslator, ByteDataTranslator, MappingFilterProvider {
private static final Logger LOG = LoggerFactory.getLogger(RemoteMappingCustomizer.class);
private static final String KEY = RemoteMappingCustomizer.class.getName();
private final DumpCacheManager<LispEidTableDetailsReplyDump, MappingsDumpParams> dumpManager;
+ private final DumpCacheManager<LispLocatorDetailsReplyDump, LocatorDumpParams> locatorsDumpManager;
private final EidMappingContext remoteMappingContext;
public RemoteMappingCustomizer(@Nonnull FutureJVppCore futureJvpp,
@@ -77,6 +97,10 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableDetailsReplyDump, MappingsDumpParams>()
.withExecutor(new MappingsDumpExecutor(futureJvpp))
.build();
+ this.locatorsDumpManager =
+ new DumpCacheManager.DumpCacheManagerBuilder<LispLocatorDetailsReplyDump, LocatorDumpParams>()
+ .withExecutor(new LocatorDumpExecutor(futureJvpp))
+ .build();
}
@@ -130,16 +154,18 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
LOG.debug("Valid dump loaded");
LispEidTableDetails details = replyOptional.get().lispEidTableDetails.stream()
+ .filter(subtableFilterForRemoteMappings(id))
.filter(a -> compareAddresses(eid.getAddress(),
- getArrayAsEidLocal(valueOf(a.eidType), a.eid).getAddress()))
+ getArrayAsEidLocal(valueOf(a.eidType), a.eid, a.vni).getAddress()))
.collect(
RWUtils.singleItemCollector());
- builder.setEid(getArrayAsEidRemote(valueOf(details.eidType), details.eid));
+ builder.setEid(getArrayAsEidRemote(valueOf(details.eidType), details.eid, details.vni));
builder.setKey(new RemoteMappingKey(new MappingId(id.firstKeyOf(RemoteMapping.class).getId())));
builder.setTtl(resolveTtl(details.ttl));
builder.setAuthoritative(
new RemoteMapping.Authoritative(byteToBoolean(details.authoritative)));
+ resolverMappings(id, builder, details, ctx.getModificationCache());
}
//compensate ~0 as default value of ttl
@@ -185,12 +211,11 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
.lispEidTableDetails
.stream()
.filter(a -> a.vni == vni)
- .map(detail -> new RemoteMappingKey(
- new MappingId(
- remoteMappingContext.getId(
- getArrayAsEidRemote(
- valueOf(detail.eidType), detail.eid),
- context.getMappingContext()))))
+ .filter(subtableFilterForRemoteMappings(id))
+ .map(detail -> getArrayAsEidRemote(valueOf(detail.eidType), detail.eid, detail.vni))
+ .map(remoteEid -> remoteMappingContext.getId(remoteEid, context.getMappingContext()))
+ .map(MappingId::new)
+ .map(RemoteMappingKey::new)
.collect(Collectors.toList());
}
@@ -202,4 +227,68 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
private String bindKey(String prefix) {
return prefix + "_" + KEY;
}
+
+ private void resolverMappings(final InstanceIdentifier id, final RemoteMappingBuilder builder,
+ final LispEidTableDetails details,
+ final ModificationCache cache) throws ReadFailedException {
+
+ if (details.action != 0) {
+ // in this case ,negative action was defined
+ bindNegativeMapping(builder, MapReplyAction.forValue(details.action));
+ } else {
+ // in this case, there is no clear determination whether negative action with NO_ACTION(value == 0) was defined,
+ // or if its default value and remote locators, are defined, so only chance to determine so, is to dump locators for this mapping
+
+ // cache key needs to have locator set scope to not mix with cached data
+ final Optional<LispLocatorDetailsReplyDump> reply;
+ try {
+ reply = locatorsDumpManager.getDump(KEY + "_locator_set_" + details.locatorSetIndex, cache,
+ new LocatorDumpParamsBuilder().setLocatorSetIndex(details.locatorSetIndex).build());
+ } catch (DumpExecutionFailedException e) {
+ throw new ReadFailedException(id,
+ new IllegalStateException("Unable to resolve Positive/Negative mapping for RemoteMapping", e));
+ }
+
+ if (!reply.isPresent() || reply.get().lispLocatorDetails.isEmpty()) {
+ // no remote locators exist, therefore there was NO_ACTION defined
+ bindNegativeMapping(builder, NoAction);
+ } else {
+ // bind remote locators
+ bindPositiveMapping(builder, reply.get());
+ }
+ }
+ }
+
+ private void bindNegativeMapping(final RemoteMappingBuilder builder,
+ final MapReplyAction action) {
+ builder.setLocatorList(
+ new NegativeMappingBuilder().setMapReply(new MapReplyBuilder().setMapReplyAction(action).build())
+ .build());
+ }
+
+ private void bindPositiveMapping(final RemoteMappingBuilder builder, final LispLocatorDetailsReplyDump reply) {
+ builder.setLocatorList(
+ new PositiveMappingBuilder()
+ .setRlocs(
+ new RlocsBuilder()
+ .setLocator(reply
+ .lispLocatorDetails
+ .stream()
+ .map(this::detailsToLocator)
+ .collect(Collectors.toList()))
+ .build()
+ )
+ .build()
+ );
+ }
+
+ private Locator detailsToLocator(final LispLocatorDetails details) {
+ final IpAddress address = arrayToIpAddressReversed(byteToBoolean(details.isIpv6), details.ipAddress);
+ return new LocatorBuilder()
+ .setAddress(address)
+ .setKey(new LocatorKey(address))
+ .setPriority((short) details.priority)
+ .setWeight((short) details.weight)
+ .build();
+ }
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java
index 3e26de47d..e8a28cc1b 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java
@@ -28,6 +28,11 @@ import io.fd.honeycomb.translate.util.RWUtils;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
+import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetails;
+import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetails;
+import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetailsReplyDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@@ -39,9 +44,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetails;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -54,16 +56,16 @@ public class VniTableCustomizer extends FutureJVppCustomizer
private static final Logger LOG = LoggerFactory.getLogger(VniTableCustomizer.class);
private static final String LISP_TABLE_ID_DUMP = VniTableCustomizer.class.getName();
- private final DumpCacheManager<LispEidTableMapDetailsReplyDump, Void> dumpManager;
+ private final DumpCacheManager<LispEidTableVniDetailsReplyDump, Void> dumpManager;
public VniTableCustomizer(@Nonnull final FutureJVppCore futureJvpp) {
super(futureJvpp);
- this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableMapDetailsReplyDump, Void>()
+ this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableVniDetailsReplyDump, Void>()
.withExecutor(new VniTableDumpExecutor(futureJvpp))
.build();
}
- private static VniTableKey detailsToKey(final LispEidTableMapDetails lispEidTableMapDetails) {
+ private static VniTableKey detailsToKey(final LispEidTableVniDetails lispEidTableMapDetails) {
return new VniTableKey(Integer.valueOf(lispEidTableMapDetails.vni).longValue());
}
@@ -86,18 +88,18 @@ public class VniTableCustomizer extends FutureJVppCustomizer
throws ReadFailedException {
LOG.trace("Reading all IDS...");
- Optional<LispEidTableMapDetailsReplyDump> optionalReply;
+ Optional<LispEidTableVniDetailsReplyDump> optionalReply;
try {
optionalReply = dumpManager.getDump(LISP_TABLE_ID_DUMP, context.getModificationCache(), NO_PARAMS);
} catch (DumpExecutionFailedException e) {
throw new ReadFailedException(id, e);
}
- if (!optionalReply.isPresent() || optionalReply.get().lispEidTableMapDetails.isEmpty()) {
+ if (!optionalReply.isPresent() || optionalReply.get().lispEidTableVniDetails.isEmpty()) {
return Collections.emptyList();
}
- return optionalReply.get().lispEidTableMapDetails.stream().map(VniTableCustomizer::detailsToKey)
+ return optionalReply.get().lispEidTableVniDetails.stream().map(VniTableCustomizer::detailsToKey)
.collect(Collectors.toList());
}
@@ -109,23 +111,25 @@ public class VniTableCustomizer extends FutureJVppCustomizer
checkState(id.firstKeyOf(VniTable.class) != null, "No VNI present");
VniTableKey key = new VniTableKey(id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier());
- Optional<LispEidTableMapDetailsReplyDump> optionalReply;
+ Optional<LispEidTableVniDetailsReplyDump> optionalReply;
try {
optionalReply = dumpManager.getDump(LISP_TABLE_ID_DUMP, ctx.getModificationCache(), NO_PARAMS);
} catch (DumpExecutionFailedException e) {
throw new ReadFailedException(id, e);
}
- if (!optionalReply.isPresent() || optionalReply.get().lispEidTableMapDetails.isEmpty()) {
+ if (!optionalReply.isPresent() || optionalReply.get().lispEidTableVniDetails.isEmpty()) {
return;
}
//transforming right away to single detail(specific request should do the magic)
- final LispEidTableMapDetails details =
- optionalReply.get().lispEidTableMapDetails.stream().filter(a -> detailsToKey(a).equals(key))
- .collect(RWUtils.singleItemCollector());
+ final LispEidTableVniDetails details = optionalReply.get()
+ .lispEidTableVniDetails
+ .stream()
+ .filter(a -> a.vni == key.getVirtualNetworkIdentifier().intValue())
+ .collect(RWUtils.singleItemCollector());
builder.setVirtualNetworkIdentifier((long) details.vni);
- builder.setTableId((long) details.dpTable);
+ builder.setKey(new VniTableKey(Long.valueOf(details.vni)));
}
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizer.java
new file mode 100644
index 000000000..5072c37c2
--- /dev/null
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizer.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2015 Cisco and/or its affiliates.
+ *
+ * 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.
+ */
+
+package io.fd.honeycomb.lisp.translate.read;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.Optional;
+import io.fd.honeycomb.lisp.translate.read.dump.executor.SubtableDumpExecutor;
+import io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams;
+import io.fd.honeycomb.lisp.translate.read.trait.SubtableReader;
+import io.fd.honeycomb.translate.read.ReadContext;
+import io.fd.honeycomb.translate.read.ReadFailedException;
+import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
+import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
+import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
+import java.util.List;
+import java.util.stream.Collectors;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtableBuilder;
+import org.opendaylight.yangtools.concepts.Builder;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetails;
+import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class VrfSubtableCustomizer extends FutureJVppCustomizer
+ implements ReaderCustomizer<VrfSubtable, VrfSubtableBuilder>, SubtableReader {
+
+ private static final Logger LOG = LoggerFactory.getLogger(VrfSubtableCustomizer.class);
+ private static final String CACHE_KEY = VrfSubtableCustomizer.class.getName();
+
+ private final DumpCacheManager<LispEidTableMapDetailsReplyDump, SubtableDumpParams> dumpManager;
+ private final SubtableDumpExecutor dumpExecutor;
+
+ public VrfSubtableCustomizer(@Nonnull final FutureJVppCore futureJvpp) {
+ super(futureJvpp);
+ dumpExecutor = new SubtableDumpExecutor(futureJvpp);
+ dumpManager =
+ new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableMapDetailsReplyDump, SubtableDumpParams>()
+ .withExecutor(dumpExecutor)
+ .build();
+ }
+
+ @Nonnull
+ @Override
+ public VrfSubtableBuilder getBuilder(@Nonnull final InstanceIdentifier<VrfSubtable> id) {
+ return new VrfSubtableBuilder();
+ }
+
+ @Override
+ public void readCurrentAttributes(@Nonnull final InstanceIdentifier<VrfSubtable> id,
+ @Nonnull final VrfSubtableBuilder builder, @Nonnull final ReadContext ctx)
+ throws ReadFailedException {
+ LOG.debug("Read attributes for {}", id);
+ final int vni = checkNotNull(id.firstKeyOf(VniTable.class), "Cannot find parent VNI Table")
+ .getVirtualNetworkIdentifier().intValue();
+
+ final Optional<LispEidTableMapDetailsReplyDump> reply =
+ readSubtable(dumpManager, CACHE_KEY, ctx.getModificationCache(), id, L3_PARAMS);
+
+ if (!reply.isPresent() || reply.get().lispEidTableMapDetails.isEmpty()) {
+ return;
+ }
+
+ // Single item collector cant be used in this case,because vrf-subtable is container
+ // so read is invoked every time parent is defined
+ final List<LispEidTableMapDetails> details =
+ reply.get().lispEidTableMapDetails.stream().filter(a -> a.vni == vni)
+ .collect(Collectors.toList());
+ if (details.size() == 1) {
+ final LispEidTableMapDetails detail = details.get(0);
+ builder.setTableId(Integer.valueOf(detail.dpTable).longValue());
+
+ LOG.debug("Attributes for {} successfully loaded", id);
+ }
+ }
+
+ @Override
+ public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder,
+ @Nonnull final VrfSubtable readValue) {
+ ((VniTableBuilder) parentBuilder).setVrfSubtable(readValue);
+ }
+}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/AbstractDumpExecutor.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/AbstractJvppDumpExecutor.java
index d1aea12b0..65f41443c 100644
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/AbstractDumpExecutor.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/AbstractJvppDumpExecutor.java
@@ -23,13 +23,13 @@ import io.fd.vpp.jvpp.core.future.FutureJVppCore;
/**
- * Abstract holder for jvpp refference
+ * Abstract holder for jvpp reference
*/
-public abstract class AbstractDumpExecutor {
+public abstract class AbstractJvppDumpExecutor {
protected final FutureJVppCore vppApi;
- protected AbstractDumpExecutor(@Nonnull final FutureJVppCore vppApi) {
- this.vppApi = checkNotNull(vppApi, "VPP Api refference cannot be null");
+ public AbstractJvppDumpExecutor(@Nonnull final FutureJVppCore vppApi) {
+ this.vppApi = checkNotNull(vppApi, "VPP Api reference cannot be null");
}
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/ItrRemoteLocatorSetDumpExecutor.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/ItrRemoteLocatorSetDumpExecutor.java
new file mode 100644
index 000000000..391fa7668
--- /dev/null
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/ItrRemoteLocatorSetDumpExecutor.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015 Cisco and/or its affiliates.
+ *
+ * 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.
+ */
+
+package io.fd.honeycomb.lisp.translate.read.dump.executor;
+
+import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
+import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException;
+import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException;
+import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpTimeoutException;
+import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
+import java.util.concurrent.TimeoutException;
+import javax.annotation.Nonnull;
+import io.fd.vpp.jvpp.VppBaseCallException;
+import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocs;
+import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocsReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+
+public class ItrRemoteLocatorSetDumpExecutor extends AbstractJvppDumpExecutor
+ implements EntityDumpExecutor<LispGetMapRequestItrRlocsReply, Void>, JvppReplyConsumer {
+
+ public ItrRemoteLocatorSetDumpExecutor(@Nonnull final FutureJVppCore vppApi) {
+ super(vppApi);
+ }
+
+ @Override
+ public LispGetMapRequestItrRlocsReply executeDump(final Void params) throws DumpExecutionFailedException {
+ try {
+ return getReply(vppApi.lispGetMapRequestItrRlocs(new LispGetMapRequestItrRlocs()).toCompletableFuture());
+ } catch (TimeoutException e) {
+ throw DumpTimeoutException.wrapTimeoutException("Dumping of Itr Remote Locator Sets ended in timeout", e);
+ } catch (VppBaseCallException e) {
+ throw DumpCallFailedException.wrapFailedCallException("Dumping of Itr Remote Locator Sets failed", e);
+ }
+ }
+}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutor.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutor.java
index ad588e28d..86ac1ac63 100644
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutor.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutor.java
@@ -35,7 +35,7 @@ import io.fd.vpp.jvpp.core.future.FutureJVppCore;
/**
* Executor for dumping of locators
*/
-public class LocatorDumpExecutor extends AbstractDumpExecutor
+public class LocatorDumpExecutor extends AbstractJvppDumpExecutor
implements EntityDumpExecutor<LispLocatorDetailsReplyDump, LocatorDumpParams>, JvppReplyConsumer {
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorSetsDumpExecutor.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorSetsDumpExecutor.java
index ec2cb3405..383cb8e78 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorSetsDumpExecutor.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorSetsDumpExecutor.java
@@ -30,7 +30,7 @@ import io.fd.vpp.jvpp.core.dto.LispLocatorSetDump;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-public class LocatorSetsDumpExecutor extends AbstractDumpExecutor
+public class LocatorSetsDumpExecutor extends AbstractJvppDumpExecutor
implements EntityDumpExecutor<LispLocatorSetDetailsReplyDump, Void>, JvppReplyConsumer {
public LocatorSetsDumpExecutor(@Nonnull FutureJVppCore api) {
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MapResolversDumpExecutor.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MapResolversDumpExecutor.java
index 9b6f5dec3..7df537040 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MapResolversDumpExecutor.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MapResolversDumpExecutor.java
@@ -30,7 +30,7 @@ import io.fd.vpp.jvpp.core.dto.LispMapResolverDump;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-public class MapResolversDumpExecutor extends AbstractDumpExecutor
+public class MapResolversDumpExecutor extends AbstractJvppDumpExecutor
implements EntityDumpExecutor<LispMapResolverDetailsReplyDump, Void>, JvppReplyConsumer {
public MapResolversDumpExecutor(@Nonnull FutureJVppCore api) {
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MappingsDumpExecutor.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MappingsDumpExecutor.java
index bdf84e14d..8e68c143a 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MappingsDumpExecutor.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MappingsDumpExecutor.java
@@ -36,7 +36,7 @@ import io.fd.vpp.jvpp.core.future.FutureJVppCore;
/**
* Common dump executor for both local and remote mappings
*/
-public class MappingsDumpExecutor extends AbstractDumpExecutor
+public class MappingsDumpExecutor extends AbstractJvppDumpExecutor
implements EntityDumpExecutor<LispEidTableDetailsReplyDump, MappingsDumpParams>, JvppReplyConsumer {
public MappingsDumpExecutor(@Nonnull FutureJVppCore vppApi) {
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/SubtableDumpExecutor.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/SubtableDumpExecutor.java
new file mode 100644
index 000000000..722cbb182
--- /dev/null
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/SubtableDumpExecutor.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2015 Cisco and/or its affiliates.
+ *
+ * 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.
+ */
+
+package io.fd.honeycomb.lisp.translate.read.dump.executor;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams;
+import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
+import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException;
+import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException;
+import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpTimeoutException;
+import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
+import java.util.concurrent.TimeoutException;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable;
+import io.fd.vpp.jvpp.VppBaseCallException;
+import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.LispEidTableMapDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+
+/**
+ * Dump executor for {@link VrfSubtable}/{@link BridgeDomainSubtable}
+ */
+public final class SubtableDumpExecutor extends AbstractJvppDumpExecutor
+ implements EntityDumpExecutor<LispEidTableMapDetailsReplyDump, SubtableDumpParams>, JvppReplyConsumer {
+
+ private SubtableDumpParams params;
+ private LispEidTableMapDump request;
+
+ public SubtableDumpExecutor(@Nonnull final FutureJVppCore vppApi) {
+ super(vppApi);
+ }
+
+ @Override
+ public LispEidTableMapDetailsReplyDump executeDump(final SubtableDumpParams params)
+ throws DumpExecutionFailedException {
+ this.params = checkNotNull(params, "Cannot bind null params");
+
+ LispEidTableMapDump request = new LispEidTableMapDump();
+ request.isL2 = params.isL2();
+
+ try {
+ return getReply(vppApi.lispEidTableMapDump(request).toCompletableFuture());
+ } catch (TimeoutException e) {
+ throw DumpTimeoutException
+ .wrapTimeoutException("Dumping subtable with params " + params + " timed out", e);
+ } catch (VppBaseCallException e) {
+ throw DumpCallFailedException
+ .wrapFailedCallException("Dumping subtable with params " + params + " timed out", e);
+ }
+ }
+
+}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutor.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutor.java
index 05e33c2e1..6c9a21ef1 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutor.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutor.java
@@ -22,25 +22,25 @@ import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecut
import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException;
import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpTimeoutException;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDump;
+import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.LispEidTableVniDump;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import java.util.concurrent.TimeoutException;
+import javax.annotation.Nonnull;
-public class VniTableDumpExecutor extends AbstractDumpExecutor
- implements EntityDumpExecutor<LispEidTableMapDetailsReplyDump, Void>, JvppReplyConsumer {
+public class VniTableDumpExecutor extends AbstractJvppDumpExecutor
+ implements EntityDumpExecutor<LispEidTableVniDetailsReplyDump, Void>, JvppReplyConsumer {
public VniTableDumpExecutor(@Nonnull FutureJVppCore api) {
super(api);
}
@Override
- public LispEidTableMapDetailsReplyDump executeDump(Void params) throws DumpExecutionFailedException {
+ public LispEidTableVniDetailsReplyDump executeDump(Void params) throws DumpExecutionFailedException {
try {
- return getReply(vppApi.lispEidTableMapDump(new LispEidTableMapDump()).toCompletableFuture());
+ return getReply(vppApi.lispEidTableVniDump(new LispEidTableVniDump()).toCompletableFuture());
} catch (TimeoutException e) {
throw DumpTimeoutException.wrapTimeoutException("Eid table map dump ended in timeout", e);
} catch (VppBaseCallException e) {
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/SubtableDumpParams.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/SubtableDumpParams.java
new file mode 100644
index 000000000..a9a19ccf5
--- /dev/null
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/SubtableDumpParams.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2015 Cisco and/or its affiliates.
+ *
+ * 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.
+ */
+
+package io.fd.honeycomb.lisp.translate.read.dump.executor.params;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable;
+
+/**
+ * Parameters for dumping {@link VrfSubtable}/{@link BridgeDomainSubtable}
+ */
+public final class SubtableDumpParams {
+
+ private final byte isL2;
+
+ private SubtableDumpParams(SubtableDumpParamsBuilder builder) {
+ this.isL2 = builder.isL2;
+ }
+
+ public byte isL2() {
+ return isL2;
+ }
+
+ @Override
+ public String toString() {
+ return "SubtableDumpParams{" +
+ "isL2=" + isL2 +
+ '}';
+ }
+
+ public enum MapLevel {
+ L2(1),
+ L3(0);
+
+ private final int value;
+
+ private MapLevel(final int value) {
+ this.value = value;
+ }
+
+ public int getValue() {
+ return value;
+ }
+ }
+
+ public static final class SubtableDumpParamsBuilder {
+
+ private byte isL2;
+
+ public SubtableDumpParamsBuilder setL2(@Nonnull final MapLevel mapLevel) {
+ isL2 = Integer.valueOf(checkNotNull(mapLevel, "Cannot set null map level").getValue()).byteValue();
+ return this;
+ }
+
+ public SubtableDumpParams build() {
+ return new SubtableDumpParams(this);
+ }
+ }
+}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/AbstractLispReaderFactoryBase.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/AbstractLispReaderFactoryBase.java
index 123aba59d..2aec19fcb 100644
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/AbstractLispReaderFactoryBase.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/AbstractLispReaderFactoryBase.java
@@ -35,6 +35,7 @@ abstract class AbstractLispReaderFactoryBase {
protected final FutureJVppCore vppApi;
protected NamingContext interfaceContext;
protected NamingContext locatorSetContext;
+ protected NamingContext bridgeDomainContext;
protected EidMappingContext localMappingContext;
protected EidMappingContext remoteMappingContext;
@@ -76,4 +77,25 @@ abstract class AbstractLispReaderFactoryBase {
this.remoteMappingContext = checkNotNull(remoteMappingContext,
"Remote mappings reference is null,for readers that don't need this dependency use different constructor");
}
+
+ protected AbstractLispReaderFactoryBase(@Nonnull final InstanceIdentifier<LispState> lispStateId,
+ @Nonnull final FutureJVppCore vppApi,
+ @Nonnull final NamingContext interfaceContext,
+ @Nonnull final NamingContext locatorSetContext,
+ @Nonnull final NamingContext bridgeDomainContext,
+ @Nonnull final EidMappingContext localMappingContext,
+ @Nonnull final EidMappingContext remoteMappingContext) {
+ this.lispStateId = checkNotNull(lispStateId, "Lisp state identifier is null");
+ this.vppApi = checkNotNull(vppApi, "VPP api reference is null");
+ this.interfaceContext = checkNotNull(interfaceContext,
+ "Interface naming context is null,for readers that don't need this dependency,use different constructor");
+ this.locatorSetContext = checkNotNull(locatorSetContext,
+ "Locator set naming context is null,for readers that don't need this dependency,use different constructor");
+ this.bridgeDomainContext = checkNotNull(bridgeDomainContext,
+ "Bridge domain naming context is null,for readers that don't need this dependency,use different constructor");
+ this.localMappingContext = checkNotNull(localMappingContext,
+ "Local mappings reference is null,for readers that don't need this dependency use different constructor");
+ this.remoteMappingContext = checkNotNull(remoteMappingContext,
+ "Remote mappings reference is null,for readers that don't need this dependency use different constructor");
+ }
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/EidTableReaderFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/EidTableReaderFactory.java
index 6395f29a2..805d6c5bd 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/EidTableReaderFactory.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/EidTableReaderFactory.java
@@ -20,31 +20,40 @@ package io.fd.honeycomb.lisp.translate.read.factory;
import com.google.common.collect.ImmutableSet;
import io.fd.honeycomb.lisp.context.util.EidMappingContext;
import io.fd.honeycomb.lisp.translate.read.AdjacencyCustomizer;
+import io.fd.honeycomb.lisp.translate.read.BridgeDomainSubtableCustomizer;
import io.fd.honeycomb.lisp.translate.read.LocalMappingCustomizer;
import io.fd.honeycomb.lisp.translate.read.RemoteMappingCustomizer;
import io.fd.honeycomb.lisp.translate.read.VniTableCustomizer;
+import io.fd.honeycomb.lisp.translate.read.VrfSubtableCustomizer;
import io.fd.honeycomb.translate.impl.read.GenericListReader;
+import io.fd.honeycomb.translate.impl.read.GenericReader;
import io.fd.honeycomb.translate.read.ReaderFactory;
import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.LispState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.Adjacencies;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.AdjacenciesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.Adjacency;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.adjacency.LocalEid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.adjacency.RemoteEid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.LocalMappings;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.LocalMappingsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.RemoteMappings;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.RemoteMappingsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.negative.mapping.MapReply;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.positive.mapping.Rlocs;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.positive.mapping.rlocs.Locator;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.EidTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.EidTableBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.Adjacencies;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.AdjacenciesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.LocalMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.LocalMappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.RemoteMappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.adjacency.LocalEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.adjacency.RemoteEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.RemoteMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.lisp.feature.data.grouping.LispFeatureData;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
/**
@@ -56,57 +65,110 @@ final class EidTableReaderFactory extends AbstractLispReaderFactoryBase implemen
final FutureJVppCore vppApi,
final NamingContext interfaceContext,
final NamingContext locatorSetContext,
+ final NamingContext bridgeDomainContext,
final EidMappingContext localMappingContext,
final EidMappingContext remoteMappingContext) {
- super(lispStateId, vppApi,interfaceContext, locatorSetContext, localMappingContext, remoteMappingContext);
+ super(lispStateId, vppApi, interfaceContext, locatorSetContext, bridgeDomainContext, localMappingContext,
+ remoteMappingContext);
}
public static EidTableReaderFactory newInstance(@Nonnull final InstanceIdentifier<LispState> lispStateId,
@Nonnull final FutureJVppCore vppApi,
@Nonnull final NamingContext interfaceContext,
@Nonnull final NamingContext locatorSetContext,
+ @Nonnull final NamingContext bridgeDomainContext,
@Nonnull final EidMappingContext localMappingContext,
@Nonnull final EidMappingContext remoteMappingContext) {
- return new EidTableReaderFactory(lispStateId, vppApi, interfaceContext, locatorSetContext, localMappingContext,
+ return new EidTableReaderFactory(lispStateId, vppApi, interfaceContext, locatorSetContext, bridgeDomainContext,
+ localMappingContext,
remoteMappingContext);
}
@Override
public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
- InstanceIdentifier<EidTable> eidTableInstanceIdentifier = lispStateId.child(EidTable.class);
- InstanceIdentifier<VniTable> vniTableInstanceIdentifier = eidTableInstanceIdentifier.child(VniTable.class);
- InstanceIdentifier<LocalMappings> localMappingsInstanceIdentifier =
- vniTableInstanceIdentifier.child(LocalMappings.class);
- InstanceIdentifier<RemoteMappings> remoteMappingsInstanceIdentifier =
- vniTableInstanceIdentifier.child(RemoteMappings.class);
- InstanceIdentifier<Adjacencies> adjacenciesInstanceIdentifier =
- vniTableInstanceIdentifier.child(Adjacencies.class);
+ final InstanceIdentifier<EidTable> eidTableInstanceIdentifier =
+ lispStateId.child(LispFeatureData.class).child(EidTable.class);
+ final InstanceIdentifier<VniTable> vniTableInstanceIdentifier =
+ eidTableInstanceIdentifier.child(VniTable.class);
+ final InstanceIdentifier<VrfSubtable> vrfSubtable = vniTableInstanceIdentifier.child(VrfSubtable.class);
+ final InstanceIdentifier<BridgeDomainSubtable> bridgeDomainSubtable =
+ vniTableInstanceIdentifier.child(BridgeDomainSubtable.class);
+
+ final InstanceIdentifier<LocalMappings> vrfTableLocalMappingsInstanceIdentifier =
+ vrfSubtable.child(LocalMappings.class);
+ final InstanceIdentifier<RemoteMappings> vrfTableRemoteMappingsInstanceIdentifier =
+ vrfSubtable.child(RemoteMappings.class);
+ final InstanceIdentifier<Adjacencies> vrfTableAdjacenciesInstanceIdentifier =
+ vrfSubtable.child(RemoteMappings.class).child(RemoteMapping.class).child(Adjacencies.class);
+ final InstanceIdentifier<LocalMappings> bridgeDomainLocalMappingsInstanceIdentifier =
+ bridgeDomainSubtable.child(LocalMappings.class);
+ final InstanceIdentifier<RemoteMappings> bridgeDomainRemoteMappingsInstanceIdentifier =
+ bridgeDomainSubtable.child(RemoteMappings.class);
+ final InstanceIdentifier<Adjacencies> bridgeDomainAdjacenciesInstanceIdentifier =
+ bridgeDomainSubtable.child(RemoteMappings.class).child(RemoteMapping.class).child(Adjacencies.class);
+
+ //EidTable
registry.addStructuralReader(eidTableInstanceIdentifier, EidTableBuilder.class);
+ //EidTable -> VniTable
registry.add(new GenericListReader<>(vniTableInstanceIdentifier, new VniTableCustomizer(vppApi)));
- registry.addStructuralReader(localMappingsInstanceIdentifier, LocalMappingsBuilder.class);
+ //EidTable -> VniTable -> VrfSubtable
+ registry.add(new GenericReader<>(vrfSubtable, new VrfSubtableCustomizer(vppApi)));
+
+ //EidTable -> VniTable -> BridgeDomainSubtable
+ registry.add(new GenericReader<>(bridgeDomainSubtable,
+ new BridgeDomainSubtableCustomizer(vppApi, bridgeDomainContext)));
+
+ //EidTable -> VniTable -> VrfSubtable -> LocalMappings
+ registry.addStructuralReader(vrfTableLocalMappingsInstanceIdentifier, LocalMappingsBuilder.class);
+ //EidTable -> VniTable -> BridgeDomainSubtable -> LocalMappings
+ registry.addStructuralReader(bridgeDomainLocalMappingsInstanceIdentifier, LocalMappingsBuilder.class);
final InstanceIdentifier<LocalMapping> localMappingSubtreeId = InstanceIdentifier.create(LocalMapping.class);
+ //EidTable -> VniTable -> VrfSubtable -> LocalMappings -> LocalMapping
registry.subtreeAdd(ImmutableSet.of(localMappingSubtreeId
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.local.mapping.Eid.class)),
- new GenericListReader<>(localMappingsInstanceIdentifier.child(LocalMapping.class),
+ .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid.class)),
+ new GenericListReader<>(vrfTableLocalMappingsInstanceIdentifier.child(LocalMapping.class),
new LocalMappingCustomizer(vppApi, locatorSetContext, localMappingContext)));
- registry.addStructuralReader(remoteMappingsInstanceIdentifier, RemoteMappingsBuilder.class);
+ //EidTable -> VniTable -> BridgeDomainSubtable -> LocalMappings -> LocalMapping
+ registry.subtreeAdd(ImmutableSet.of(localMappingSubtreeId
+ .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid.class)),
+ new GenericListReader<>(bridgeDomainLocalMappingsInstanceIdentifier.child(LocalMapping.class),
+ new LocalMappingCustomizer(vppApi, locatorSetContext, localMappingContext)));
+
+ //EidTable -> VniTable -> VrfSubtable -> RemoteMappings
+ registry.addStructuralReader(vrfTableRemoteMappingsInstanceIdentifier, RemoteMappingsBuilder.class);
+ registry.addStructuralReader(bridgeDomainRemoteMappingsInstanceIdentifier, RemoteMappingsBuilder.class);
final InstanceIdentifier<RemoteMapping> remoteMappingSubtreeId = InstanceIdentifier.create(RemoteMapping.class);
registry.subtreeAdd(ImmutableSet.of(remoteMappingSubtreeId
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.Eid.class)),
- new GenericListReader<>(remoteMappingsInstanceIdentifier.child(RemoteMapping.class),
+ .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid.class),
+ remoteMappingSubtreeId.child(Rlocs.class),
+ remoteMappingSubtreeId.child(Rlocs.class).child(Locator.class),
+ remoteMappingSubtreeId.child(MapReply.class)),
+ new GenericListReader<>(vrfTableRemoteMappingsInstanceIdentifier.child(RemoteMapping.class),
+ new RemoteMappingCustomizer(vppApi, remoteMappingContext)));
+ registry.subtreeAdd(ImmutableSet.of(remoteMappingSubtreeId
+ .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid.class),
+ remoteMappingSubtreeId.child(Rlocs.class),
+ remoteMappingSubtreeId.child(Rlocs.class).child(Locator.class),
+ remoteMappingSubtreeId.child(MapReply.class)),
+ new GenericListReader<>(bridgeDomainRemoteMappingsInstanceIdentifier.child(RemoteMapping.class),
new RemoteMappingCustomizer(vppApi, remoteMappingContext)));
- registry.addStructuralReader(adjacenciesInstanceIdentifier, AdjacenciesBuilder.class);
+ registry.addStructuralReader(vrfTableAdjacenciesInstanceIdentifier, AdjacenciesBuilder.class);
+ registry.addStructuralReader(bridgeDomainAdjacenciesInstanceIdentifier, AdjacenciesBuilder.class);
final InstanceIdentifier<Adjacency> adjacencySubtreeId = InstanceIdentifier.create(Adjacency.class);
registry.subtreeAdd(
ImmutableSet.of(adjacencySubtreeId.child(LocalEid.class), adjacencySubtreeId.child(RemoteEid.class)),
- new GenericListReader<>(adjacenciesInstanceIdentifier.child(Adjacency.class),
+ new GenericListReader<>(vrfTableAdjacenciesInstanceIdentifier.child(Adjacency.class),
+ new AdjacencyCustomizer(vppApi)));
+ registry.subtreeAdd(
+ ImmutableSet.of(adjacencySubtreeId.child(LocalEid.class), adjacencySubtreeId.child(RemoteEid.class)),
+ new GenericListReader<>(bridgeDomainAdjacenciesInstanceIdentifier.child(Adjacency.class),
new AdjacencyCustomizer(vppApi)));
}
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LispStateReaderFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LispStateReaderFactory.java
index 9e710c69f..a2290bda1 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LispStateReaderFactory.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LispStateReaderFactory.java
@@ -30,11 +30,13 @@ import io.fd.honeycomb.translate.impl.read.GenericReader;
import io.fd.honeycomb.translate.read.ReaderFactory;
import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.LispState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.lisp.feature.data.grouping.LispFeatureData;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.lisp.feature.data.grouping.LispFeatureDataBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.pitr.cfg.grouping.PitrCfg;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
/**
@@ -46,26 +48,27 @@ public class LispStateReaderFactory extends AbstractLispReaderFactoryBase implem
public LispStateReaderFactory(final FutureJVppCore vppApi,
@Named(INTERFACE_CONTEXT) final NamingContext interfaceContext,
@Named(LOCATOR_SET_CONTEXT) final NamingContext locatorSetContext,
+ @Named("bridge-domain-context") final NamingContext bridgeDomainContext,
@Named(LOCAL_MAPPING_CONTEXT) final EidMappingContext localMappingContext,
@Named(REMOTE_MAPPING_CONTEXT) final EidMappingContext remoteMappingContext) {
super(InstanceIdentifier.create(LispState.class), vppApi, interfaceContext, locatorSetContext,
- localMappingContext,
- remoteMappingContext);
+ bridgeDomainContext, localMappingContext, remoteMappingContext);
}
-
@Override
public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
registry.add(new GenericReader<>(lispStateId, new LispStateCustomizer(vppApi)));
+ registry.addStructuralReader(lispStateId.child(LispFeatureData.class), LispFeatureDataBuilder.class);
LocatorSetsReaderFactory.newInstance(lispStateId, vppApi, interfaceContext, locatorSetContext).init(registry);
MapResolversReaderFactory.newInstance(lispStateId, vppApi).init(registry);
EidTableReaderFactory
- .newInstance(lispStateId, vppApi, interfaceContext, locatorSetContext, localMappingContext,
- remoteMappingContext)
+ .newInstance(lispStateId, vppApi, interfaceContext, locatorSetContext, bridgeDomainContext,
+ localMappingContext, remoteMappingContext)
.init(registry);
- registry.add(new GenericReader<>(lispStateId.child(PitrCfg.class), new PitrCfgCustomizer(vppApi)));
+ registry.add(new GenericReader<>(lispStateId.child(LispFeatureData.class).child(PitrCfg.class),
+ new PitrCfgCustomizer(vppApi)));
}
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LocatorSetsReaderFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LocatorSetsReaderFactory.java
index bc96474f5..9a8e74383 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LocatorSetsReaderFactory.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LocatorSetsReaderFactory.java
@@ -25,6 +25,7 @@ import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.LispState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.lisp.feature.data.grouping.LispFeatureData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.locator.sets.grouping.LocatorSets;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.locator.sets.grouping.LocatorSetsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.locator.sets.grouping.locator.sets.LocatorSet;
@@ -57,7 +58,7 @@ public class LocatorSetsReaderFactory extends AbstractLispReaderFactoryBase impl
@Override
public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
- InstanceIdentifier<LocatorSets> locatorSetsInstanceIdentifier = lispStateId.child(LocatorSets.class);
+ InstanceIdentifier<LocatorSets> locatorSetsInstanceIdentifier = lispStateId.child(LispFeatureData.class).child(LocatorSets.class);
InstanceIdentifier<LocatorSet> locatorSetInstanceIdentifier =
locatorSetsInstanceIdentifier.child(LocatorSet.class);
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/MapResolversReaderFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/MapResolversReaderFactory.java
index a484f3635..b41f26f81 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/MapResolversReaderFactory.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/MapResolversReaderFactory.java
@@ -23,6 +23,7 @@ import io.fd.honeycomb.translate.read.ReaderFactory;
import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.LispState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.lisp.feature.data.grouping.LispFeatureData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.map.resolvers.grouping.MapResolvers;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.map.resolvers.grouping.MapResolversBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.map.resolvers.grouping.map.resolvers.MapResolver;
@@ -47,7 +48,8 @@ public class MapResolversReaderFactory extends AbstractLispReaderFactoryBase imp
@Override
public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
- InstanceIdentifier<MapResolvers> mapResolversInstanceIdentifier = lispStateId.child(MapResolvers.class);
+ InstanceIdentifier<MapResolvers> mapResolversInstanceIdentifier =
+ lispStateId.child(LispFeatureData.class).child(MapResolvers.class);
registry.addStructuralReader(mapResolversInstanceIdentifier, MapResolversBuilder.class);
registry.add(new GenericListReader<>(mapResolversInstanceIdentifier.child(MapResolver.class),
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingFilterProvider.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingFilterProvider.java
new file mode 100644
index 000000000..ef1ca0438
--- /dev/null
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingFilterProvider.java
@@ -0,0 +1,50 @@
+package io.fd.honeycomb.lisp.translate.read.trait;
+
+import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV4;
+import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV6;
+import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.MAC;
+
+import java.util.function.Predicate;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import io.fd.vpp.jvpp.core.dto.LispEidTableDetails;
+
+/**
+ * Trait providing predicates to filter mappings to respective subtables
+ */
+public interface MappingFilterProvider {
+
+ Predicate<LispEidTableDetails> BRIDGE_DOMAIN_MAPPINGS_ONLY =
+ (LispEidTableDetails detail) -> detail.eidType == MAC.getValue();
+
+ Predicate<LispEidTableDetails> VRF_MAPPINGS_ONLY =
+ (LispEidTableDetails detail) -> detail.eidType == IPV4.getValue() || detail.eidType == IPV6.getValue();
+
+ default Predicate<LispEidTableDetails> subtableFilterForLocalMappings(
+ @Nonnull final InstanceIdentifier<LocalMapping> identifier) {
+
+ if (identifier.firstIdentifierOf(VrfSubtable.class) != null) {
+ return VRF_MAPPINGS_ONLY;
+ } else if (identifier.firstIdentifierOf(BridgeDomainSubtable.class) != null) {
+ return BRIDGE_DOMAIN_MAPPINGS_ONLY;
+ } else {
+ throw new IllegalArgumentException("Cannot determine mappings predicate for " + identifier);
+ }
+ }
+
+ default Predicate<LispEidTableDetails> subtableFilterForRemoteMappings(
+ @Nonnull final InstanceIdentifier<RemoteMapping> identifier) {
+
+ if (identifier.firstIdentifierOf(VrfSubtable.class) != null) {
+ return VRF_MAPPINGS_ONLY;
+ } else if (identifier.firstIdentifierOf(BridgeDomainSubtable.class) != null) {
+ return BRIDGE_DOMAIN_MAPPINGS_ONLY;
+ } else {
+ throw new IllegalArgumentException("Cannot determine mappings predicate for " + identifier);
+ }
+ }
+}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducer.java
new file mode 100644
index 000000000..104e696e3
--- /dev/null
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducer.java
@@ -0,0 +1,56 @@
+package io.fd.honeycomb.lisp.translate.read.trait;
+
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv6Afi;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.MacAfi;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * Trait that verifies data for mappings
+ */
+public interface MappingProducer {
+
+ /**
+ * Checks whether provided {@link LocalMapping} can be written under subtree idenfied by {@link InstanceIdentifier}
+ */
+ default void checkAllowedCombination(@Nonnull final InstanceIdentifier<LocalMapping> identifier,
+ @Nonnull final LocalMapping data) throws WriteFailedException {
+ final Class<? extends LispAddressFamily> eidAddressType = data.getEid().getAddressType();
+
+ if (identifier.firstIdentifierOf(VrfSubtable.class) != null) {
+ if (Ipv4Afi.class != eidAddressType && Ipv6Afi.class != eidAddressType) {
+ throw new WriteFailedException.CreateFailedException(identifier, data,
+ new IllegalArgumentException("Only Ipv4/Ipv6 eid's are allowed for Vrf Subtable"));
+ }
+ } else if (identifier.firstIdentifierOf(BridgeDomainSubtable.class) != null) {
+ if (MacAfi.class != eidAddressType) {
+ throw new WriteFailedException.CreateFailedException(identifier, data,
+ new IllegalArgumentException("Only Mac eid's are allowed for Bridge Domain Subtable"));
+ }
+ }
+ }
+
+ default void checkAllowedCombination(@Nonnull final InstanceIdentifier<RemoteMapping> identifier,
+ @Nonnull final RemoteMapping data) throws WriteFailedException {
+ final Class<? extends LispAddressFamily> eidAddressType = data.getEid().getAddressType();
+
+ if (identifier.firstIdentifierOf(VrfSubtable.class) != null) {
+ if (Ipv4Afi.class != eidAddressType && Ipv6Afi.class != eidAddressType) {
+ throw new WriteFailedException.CreateFailedException(identifier, data,
+ new IllegalArgumentException("Only Ipv4/Ipv6 eid's are allowed for Vrf Subtable"));
+ }
+ } else if (identifier.firstIdentifierOf(BridgeDomainSubtable.class) != null) {
+ if (MacAfi.class != eidAddressType) {
+ throw new WriteFailedException.CreateFailedException(identifier, data,
+ new IllegalArgumentException("Only Mac eid's are allowed for Bridge Domain Subtable"));
+ }
+ }
+ }
+}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java
new file mode 100644
index 000000000..7af6a7e90
--- /dev/null
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2015 Cisco and/or its affiliates.
+ *
+ * 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.
+ */
+
+package io.fd.honeycomb.lisp.translate.read.trait;
+
+
+import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.MapLevel.L2;
+import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.MapLevel.L3;
+import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.SubtableDumpParamsBuilder;
+
+import com.google.common.base.Optional;
+import io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams;
+import io.fd.honeycomb.translate.ModificationCache;
+import io.fd.honeycomb.translate.read.ReadFailedException;
+import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
+import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
+
+/**
+ * Provides common logic for reading Eid subtables
+ */
+public interface SubtableReader {
+
+ SubtableDumpParams L2_PARAMS = new SubtableDumpParamsBuilder().setL2(L2).build();
+ SubtableDumpParams L3_PARAMS = new SubtableDumpParamsBuilder().setL2(L3).build();
+
+ default Optional<LispEidTableMapDetailsReplyDump> readSubtable(
+ @Nonnull final DumpCacheManager<LispEidTableMapDetailsReplyDump, SubtableDumpParams> dumpManager,
+ @Nonnull final String cacheKey,
+ @Nonnull final ModificationCache cache,
+ @Nonnull final InstanceIdentifier<? extends ChildOf<VniTable>> id,
+ @Nonnull final SubtableDumpParams params) throws ReadFailedException {
+ try {
+ return dumpManager.getDump(cacheKey, cache, params);
+ } catch (DumpExecutionFailedException e) {
+ throw new ReadFailedException(id, e);
+ }
+ }
+}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidMetadataProvider.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidMetadataProvider.java
new file mode 100644
index 000000000..11de4e7b8
--- /dev/null
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidMetadataProvider.java
@@ -0,0 +1,36 @@
+package io.fd.honeycomb.lisp.translate.util;
+
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddressFamily;
+
+/**
+ * Trait providing metadata for eid's
+ */
+public interface EidMetadataProvider {
+
+ /**
+ * Returns new {@link org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder}
+ * binded with metadata
+ */
+ default org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder newRemoteEidBuilder(
+ @Nonnull final Class<? extends LispAddressFamily> eidAddressType,
+ final int vni) {
+ return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
+ .setAddressType(eidAddressType)
+ .setVirtualNetworkId(new InstanceIdType(Long.valueOf(vni)));
+ }
+
+ /**
+ * Returns new {@link org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder}
+ * binded with metadata
+ */
+ default org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder newLocalEidBuilder(
+ @Nonnull final Class<? extends LispAddressFamily> eidAddressType,
+ final int vni) {
+ return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder()
+ .setAddressType(eidAddressType)
+ .setVirtualNetworkId(new InstanceIdType(Long.valueOf(vni)));
+ }
+
+}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidTranslator.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidTranslator.java
index dcf9a7e27..7bc99e5f2 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidTranslator.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidTranslator.java
@@ -24,9 +24,13 @@ import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsD
import io.fd.honeycomb.translate.vpp.util.AddressTranslator;
import java.util.Arrays;
+import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv6Afi;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.MacAfi;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder;
@@ -35,16 +39,15 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.addres
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Mac;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.MacBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.adjacency.LocalEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.adjacency.RemoteEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.local.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.local.mapping.EidBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.adjacency.LocalEid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.adjacency.RemoteEid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid;
/**
* Trait providing converting logic for eid's
*/
-public interface EidTranslator extends AddressTranslator {
+public interface EidTranslator extends AddressTranslator, EidMetadataProvider {
default byte getPrefixLength(LocalEid address) {
@@ -61,12 +64,12 @@ public interface EidTranslator extends AddressTranslator {
}
default byte getPrefixLength(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.local.mapping.Eid address) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid address) {
return resolverPrefixLength(address.getAddress());
}
default byte getPrefixLength(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.Eid address) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid address) {
return resolverPrefixLength(address.getAddress());
}
@@ -84,21 +87,21 @@ public interface EidTranslator extends AddressTranslator {
}
}
- default Eid getArrayAsEidLocal(EidType type, byte[] address) {
+ default Eid getArrayAsEidLocal(@Nonnull final EidType type, final byte[] address, final int vni) {
switch (type) {
case IPV4: {
- return new EidBuilder().setAddress(
+ return newLocalEidBuilder(Ipv4Afi.class, vni).setAddress(
new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZoneReversed(address)).build())
.build();
}
case IPV6: {
- return new EidBuilder().setAddress(
+ return newLocalEidBuilder(Ipv6Afi.class, vni).setAddress(
new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZoneReversed(address)).build())
.build();
}
case MAC: {
- return new EidBuilder().setAddress(
+ return newLocalEidBuilder(MacAfi.class, vni).setAddress(
new MacBuilder().setMac(new MacAddress(byteArrayToMacSeparated(address)))
.build()).build();
}
@@ -108,26 +111,26 @@ public interface EidTranslator extends AddressTranslator {
}
}
- default org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.Eid getArrayAsEidRemote(
- EidType type, byte[] address) {
+ default org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid getArrayAsEidRemote(
+ @Nonnull final EidType type, final byte[] address, final int vni) {
switch (type) {
case IPV4: {
- return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.EidBuilder()
+ return newRemoteEidBuilder(Ipv4Afi.class, vni)
.setAddress(
new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZoneReversed(address))
.build())
.build();
}
case IPV6: {
- return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.EidBuilder()
+ return newRemoteEidBuilder(Ipv6Afi.class, vni)
.setAddress(
new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZoneReversed(address))
.build())
.build();
}
case MAC: {
- return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.EidBuilder()
+ return newRemoteEidBuilder(MacAfi.class, vni)
.setAddress(
new MacBuilder().setMac(new MacAddress(byteArrayToMacSeparated(address)))
.build()).build();
@@ -166,7 +169,7 @@ public interface EidTranslator extends AddressTranslator {
}
default EidType getEidType(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.local.mapping.Eid address) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid address) {
checkNotNull(address, "SimpleAddress cannot be null");
return resolveType(address.getAddress());
@@ -174,7 +177,7 @@ public interface EidTranslator extends AddressTranslator {
default EidType getEidType(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.Eid address) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid address) {
checkNotNull(address, "Address cannot be null");
return resolveType(address.getAddress());
@@ -215,14 +218,14 @@ public interface EidTranslator extends AddressTranslator {
}
default byte[] getEidAsByteArray(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.local.mapping.Eid address) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid address) {
checkNotNull(address, "Eid cannot be null");
return resolveByteArray(getEidType(address), address.getAddress());
}
default byte[] getEidAsByteArray(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.Eid address) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid address) {
checkNotNull(address, "Eid cannot be null");
return resolveByteArray(getEidType(address), address.getAddress());
@@ -279,6 +282,6 @@ public interface EidTranslator extends AddressTranslator {
return ((Mac) firstAddress).getMac().getValue().equals(((Mac) secondAddress).getMac().getValue());
}
- throw new IllegalArgumentException("Unsupported eid type " + firstAddress.getClass());
+ return false;
}
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizer.java
index 9cd276741..89f398d4d 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizer.java
@@ -18,9 +18,10 @@ package io.fd.honeycomb.lisp.translate.write;
import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkState;
+import static com.google.common.base.Preconditions.checkNotNull;
import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType;
+import io.fd.honeycomb.lisp.context.util.EidMappingContext;
import io.fd.honeycomb.lisp.translate.util.EidTranslator;
import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
@@ -28,23 +29,33 @@ import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.VppBaseCallException;
+import io.fd.vpp.jvpp.core.dto.LispAddDelAdjacency;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.concurrent.TimeoutException;
import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.Adjacency;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.AdjacencyKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.adjacency.LocalEid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.adjacency.RemoteEid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.AdjacencyKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.LispAddDelAdjacency;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
public class AdjacencyCustomizer extends FutureJVppCustomizer
implements ListWriterCustomizer<Adjacency, AdjacencyKey>, ByteDataTranslator, EidTranslator,
JvppReplyConsumer {
- public AdjacencyCustomizer(@Nonnull final FutureJVppCore futureJvpp) {
+ private final EidMappingContext localEidsMappingContext;
+ private final EidMappingContext remoteEidsMappingContext;
+
+ public AdjacencyCustomizer(@Nonnull final FutureJVppCore futureJvpp,
+ @Nonnull EidMappingContext localEidsMappingContext,
+ @Nonnull EidMappingContext remoteEidsMappingContext) {
super(futureJvpp);
+ this.localEidsMappingContext =
+ checkNotNull(localEidsMappingContext, "Eid context for local eid's cannot be null");
+ this.remoteEidsMappingContext =
+ checkNotNull(remoteEidsMappingContext, "Eid context for remote eid's cannot be null");
}
@Override
@@ -53,7 +64,7 @@ public class AdjacencyCustomizer extends FutureJVppCustomizer
throws WriteFailedException {
try {
- addDelAdjacency(true, id, dataAfter);
+ addDelAdjacency(true, id, dataAfter, writeContext);
} catch (TimeoutException | VppBaseCallException e) {
throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
}
@@ -71,20 +82,31 @@ public class AdjacencyCustomizer extends FutureJVppCustomizer
@Nonnull final Adjacency dataBefore, @Nonnull final WriteContext writeContext)
throws WriteFailedException {
try {
- addDelAdjacency(false, id, dataBefore);
+ addDelAdjacency(false, id, dataBefore, writeContext);
} catch (TimeoutException | VppBaseCallException e) {
throw new WriteFailedException.CreateFailedException(id, dataBefore, e);
}
}
- private void addDelAdjacency(boolean add, final InstanceIdentifier<Adjacency> id, Adjacency data)
+ private void addDelAdjacency(boolean add, final InstanceIdentifier<Adjacency> id, final Adjacency data,
+ final WriteContext writeContext)
throws TimeoutException, VppBaseCallException {
- checkState(id.firstKeyOf(VniTable.class) != null, "Unable to find parent VNI for {}", id);
- final int vni = id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier().intValue();
-
- EidType localEidType = getEidType(data.getLocalEid());
- EidType remoteEidType = getEidType(data.getRemoteEid());
+ final int vni = checkNotNull(id.firstKeyOf(VniTable.class), "Unable to find parent VNI for {}", id)
+ .getVirtualNetworkIdentifier().intValue();
+
+ // both local and remote eids must be referenced to have respective mapping,
+ // if there is an attempt to add adjacency.
+ // In our case its enough to check if local/remote mapping exist for respective eid,
+ // because such mappings are created while creating mappings
+ final LocalEid localEid = add
+ ? verifiedLocalEid(data.getLocalEid(), writeContext)
+ : data.getLocalEid();
+ final RemoteEid remoteEid = add
+ ? verifiedRemoteEid(data.getRemoteEid(), writeContext)
+ : data.getRemoteEid();
+ final EidType localEidType = getEidType(localEid);
+ final EidType remoteEidType = getEidType(data.getRemoteEid());
checkArgument(localEidType ==
remoteEidType, "Local[%s] and Remote[%s] eid types must be the same", localEidType, remoteEidType);
@@ -92,13 +114,43 @@ public class AdjacencyCustomizer extends FutureJVppCustomizer
LispAddDelAdjacency request = new LispAddDelAdjacency();
request.isAdd = booleanToByte(add);
- request.leid = getEidAsByteArray(data.getLocalEid());
- request.leidLen = getPrefixLength(data.getLocalEid());
- request.reid = getEidAsByteArray(data.getRemoteEid());
- request.reidLen = getPrefixLength(data.getRemoteEid());
+ request.leid = getEidAsByteArray(localEid);
+ request.leidLen = getPrefixLength(localEid);
+ request.reid = getEidAsByteArray(remoteEid);
+ request.reidLen = getPrefixLength(remoteEid);
request.eidType = (byte) localEidType.getValue();
request.vni = vni;
getReply(getFutureJVpp().lispAddDelAdjacency(request).toCompletableFuture());
}
+
+ private LocalEid verifiedLocalEid(final LocalEid localEid, final WriteContext writeContext) {
+ if (localEidsMappingContext.containsId(toLocalEid(localEid), writeContext.getMappingContext())) {
+ return localEid;
+ }
+ throw new IllegalStateException(
+ "Referenced Local Eid[" + localEid +
+ "] doesn't have local mapping defined, therefore it can't be used in adjacency");
+ }
+
+ private RemoteEid verifiedRemoteEid(final RemoteEid remoteEid, final WriteContext writeContext) {
+ if (remoteEidsMappingContext.containsId(toRemoteEid(remoteEid), writeContext.getMappingContext())) {
+ return remoteEid;
+ }
+ throw new IllegalStateException(
+ "Referenced Remote Eid[" + remoteEid +
+ "] doesn't have remote mapping defined, therefore it can't be used in adjacency");
+ }
+
+ private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid toRemoteEid(
+ final RemoteEid remoteEid) {
+ return newRemoteEidBuilder(remoteEid.getAddressType(), remoteEid.getVirtualNetworkId().getValue().intValue())
+ .setAddress(remoteEid.getAddress()).build();
+ }
+
+ private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid toLocalEid(
+ LocalEid localEid) {
+ return newLocalEidBuilder(localEid.getAddressType(), localEid.getVirtualNetworkId().getValue().intValue())
+ .setAddress(localEid.getAddress()).build();
+ }
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainSubtableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainSubtableCustomizer.java
new file mode 100644
index 000000000..d86957b37
--- /dev/null
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainSubtableCustomizer.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2015 Cisco and/or its affiliates.
+ *
+ * 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.
+ */
+
+package io.fd.honeycomb.lisp.translate.write;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+
+import io.fd.honeycomb.lisp.translate.write.trait.SubtableWriter;
+import io.fd.honeycomb.translate.MappingContext;
+import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
+import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
+import io.fd.honeycomb.translate.vpp.util.NamingContext;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.VppBaseCallException;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import java.util.concurrent.TimeoutException;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BridgeDomainSubtableCustomizer extends FutureJVppCustomizer
+ implements WriterCustomizer<BridgeDomainSubtable>, SubtableWriter {
+
+ private static final Logger LOG = LoggerFactory.getLogger(BridgeDomainSubtableCustomizer.class);
+
+ private final NamingContext bridgeDomainContext;
+
+ public BridgeDomainSubtableCustomizer(@Nonnull final FutureJVppCore futureJvpp,
+ @Nonnull final NamingContext bridgeDomainContext) {
+ super(futureJvpp);
+ this.bridgeDomainContext = checkNotNull(bridgeDomainContext, "Bridge domain context cannot be null");
+ }
+
+ @Override
+ public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<BridgeDomainSubtable> id,
+ @Nonnull final BridgeDomainSubtable dataAfter,
+ @Nonnull final WriteContext writeContext) throws WriteFailedException {
+ LOG.debug("Writing Id {} ", id);
+
+ try {
+ addDelSubtableMapping(getFutureJVpp(), true, extractVni(id),
+ extractBridgeDomainId(dataAfter.getBridgeDomainRef(), writeContext.getMappingContext()), true, LOG);
+ } catch (TimeoutException | VppBaseCallException e) {
+ throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
+ }
+
+ LOG.debug("{} successfully written", id);
+ }
+
+ @Override
+ public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<BridgeDomainSubtable> id,
+ @Nonnull final BridgeDomainSubtable dataBefore,
+ @Nonnull final BridgeDomainSubtable dataAfter,
+ @Nonnull final WriteContext writeContext) throws WriteFailedException {
+ throw new UnsupportedOperationException("Operation not supported");
+ }
+
+ @Override
+ public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<BridgeDomainSubtable> id,
+ @Nonnull final BridgeDomainSubtable dataBefore,
+ @Nonnull final WriteContext writeContext) throws WriteFailedException {
+ LOG.debug("Removing Id {}", id);
+
+ try {
+ addDelSubtableMapping(getFutureJVpp(), false, extractVni(id),
+ extractBridgeDomainId(dataBefore.getBridgeDomainRef(), writeContext.getMappingContext()), true,
+ LOG);
+ } catch (TimeoutException | VppBaseCallException e) {
+ throw new WriteFailedException.CreateFailedException(id, dataBefore, e);
+ }
+
+ LOG.debug("{} successfully removed", id);
+ }
+
+ private int extractBridgeDomainId(final String bridgeDomainName, final MappingContext mappingContext) {
+ checkState(bridgeDomainContext.containsIndex(bridgeDomainName, mappingContext),
+ "No mapping for bridge domain name %s", bridgeDomainName);
+ return bridgeDomainContext.getIndex(bridgeDomainName, mappingContext);
+ }
+}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizer.java
new file mode 100644
index 000000000..f57601af0
--- /dev/null
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizer.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2015 Cisco and/or its affiliates.
+ *
+ * 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.
+ */
+
+package io.fd.honeycomb.lisp.translate.write;
+
+
+import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
+import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
+import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
+import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import java.nio.charset.StandardCharsets;
+import java.util.concurrent.TimeoutException;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.itr.remote.locator.sets.grouping.ItrRemoteLocatorSet;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import io.fd.vpp.jvpp.VppBaseCallException;
+import io.fd.vpp.jvpp.core.dto.LispAddDelMapRequestItrRlocs;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+
+public class ItrRemoteLocatorSetCustomizer extends FutureJVppCustomizer implements
+ WriterCustomizer<ItrRemoteLocatorSet>, ByteDataTranslator, JvppReplyConsumer {
+
+ public ItrRemoteLocatorSetCustomizer(@Nonnull final FutureJVppCore futureJVppCore) {
+ super(futureJVppCore);
+ }
+
+ @Override
+ public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<ItrRemoteLocatorSet> id,
+ @Nonnull final ItrRemoteLocatorSet dataAfter,
+ @Nonnull final WriteContext writeContext) throws WriteFailedException {
+ try {
+ addDelItrRemoteLocatorSet(true, dataAfter);
+ } catch (TimeoutException | VppBaseCallException e) {
+ throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
+ }
+ }
+
+ @Override
+ public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<ItrRemoteLocatorSet> id,
+ @Nonnull final ItrRemoteLocatorSet dataBefore,
+ @Nonnull final ItrRemoteLocatorSet dataAfter,
+ @Nonnull final WriteContext writeContext) throws WriteFailedException {
+ throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter,
+ new UnsupportedOperationException("Operation not supported"));
+ }
+
+ @Override
+ public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<ItrRemoteLocatorSet> id,
+ @Nonnull final ItrRemoteLocatorSet dataBefore,
+ @Nonnull final WriteContext writeContext) throws WriteFailedException {
+ try {
+ addDelItrRemoteLocatorSet(false, dataBefore);
+ } catch (TimeoutException | VppBaseCallException e) {
+ throw new WriteFailedException.DeleteFailedException(id, e);
+ }
+ }
+
+ private void addDelItrRemoteLocatorSet(final boolean add, @Nonnull final ItrRemoteLocatorSet data)
+ throws TimeoutException, VppBaseCallException {
+
+ LispAddDelMapRequestItrRlocs request = new LispAddDelMapRequestItrRlocs();
+ request.isAdd = booleanToByte(add);
+ request.locatorSetName = data.getRemoteLocatorSetName().getBytes(StandardCharsets.UTF_8);
+
+ getReply(getFutureJVpp().lispAddDelMapRequestItrRlocs(request).toCompletableFuture());
+ }
+}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizer.java
index b5256db06..e181b9a20 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizer.java
@@ -23,6 +23,7 @@ import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsD
import static java.nio.charset.StandardCharsets.UTF_8;
import io.fd.honeycomb.lisp.context.util.EidMappingContext;
+import io.fd.honeycomb.lisp.translate.read.trait.MappingProducer;
import io.fd.honeycomb.lisp.translate.util.EidTranslator;
import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
@@ -34,9 +35,9 @@ import java.io.UnsupportedEncodingException;
import java.util.concurrent.TimeoutException;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.MappingId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMappingKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.LocalMappingKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import io.fd.vpp.jvpp.VppBaseCallException;
import io.fd.vpp.jvpp.core.dto.LispAddDelLocalEid;
@@ -48,7 +49,7 @@ import io.fd.vpp.jvpp.core.future.FutureJVppCore;
*/
public class LocalMappingCustomizer extends FutureJVppCustomizer
implements ListWriterCustomizer<LocalMapping, LocalMappingKey>, ByteDataTranslator, EidTranslator,
- JvppReplyConsumer {
+ JvppReplyConsumer, MappingProducer {
private final EidMappingContext localMappingsContext;
@@ -64,9 +65,10 @@ public class LocalMappingCustomizer extends FutureJVppCustomizer
checkNotNull(dataAfter.getEid(), "Eid is null");
checkNotNull(dataAfter.getLocatorSet(), "Locator set is null");
checkState(id.firstKeyOf(VniTable.class) != null, "Parent vni table not found");
+ checkAllowedCombination(id, dataAfter);
//checks whether value with specified mapping-id does not exist in mapping allready
- MappingId mappingId = id.firstKeyOf(LocalMapping.class).getId();
+ final MappingId mappingId = id.firstKeyOf(LocalMapping.class).getId();
checkState(!localMappingsContext
.containsEid(mappingId, writeContext.getMappingContext()),
"Local mapping with id %s already defined", id);
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizer.java
index ed30623d8..32d0fd3a4 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizer.java
@@ -39,6 +39,8 @@ import io.fd.vpp.jvpp.core.future.FutureJVppCore;
public class PitrCfgCustomizer extends FutureJVppCustomizer
implements WriterCustomizer<PitrCfg>, JvppReplyConsumer, ByteDataTranslator {
+ private static final String DEFAULT_LOCATOR_SET_NAME = "N/A";
+
public PitrCfgCustomizer(FutureJVppCore futureJvpp) {
super(futureJvpp);
}
@@ -85,6 +87,13 @@ public class PitrCfgCustomizer extends FutureJVppCustomizer
private void addDelPitrSetLocatorSetAndReply(boolean add, PitrCfg data)
throws VppBaseCallException, TimeoutException {
+ if (DEFAULT_LOCATOR_SET_NAME.equals(data.getLocatorSet())) {
+ // ignores attempts to write default locator set
+ // therefore even while its loaded to config data of honeycomb while starting
+ // you can still enable/disable Lisp without having to define N/A as default pitr-set
+ return;
+ }
+
LispPitrSetLocatorSet request = new LispPitrSetLocatorSet();
request.isAdd = booleanToByte(add);
request.lsName = data.getLocatorSet().getBytes(UTF_8);
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizer.java
index 01c8548d5..9f51977ab 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizer.java
@@ -25,6 +25,7 @@ import static io.fd.honeycomb.lisp.translate.write.RemoteMappingCustomizer.Locat
import com.google.common.base.Preconditions;
import io.fd.honeycomb.lisp.context.util.EidMappingContext;
+import io.fd.honeycomb.lisp.translate.read.trait.MappingProducer;
import io.fd.honeycomb.lisp.translate.util.EidTranslator;
import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
import io.fd.honeycomb.translate.vpp.util.AddressTranslator;
@@ -43,14 +44,14 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.MapReplyAction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.MappingId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMappingKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.LocatorList;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.NegativeMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.PositiveMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.positive.mapping.Rlocs;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.positive.mapping.rlocs.Locator;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.RemoteMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.LocatorList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.locator.list.NegativeMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.locator.list.PositiveMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.locator.list.positive.mapping.Rlocs;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.locator.list.positive.mapping.rlocs.Locator;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import io.fd.vpp.jvpp.VppBaseCallException;
import io.fd.vpp.jvpp.core.dto.LispAddDelRemoteMapping;
@@ -62,7 +63,7 @@ import io.fd.vpp.jvpp.core.future.FutureJVppCore;
*/
public class RemoteMappingCustomizer extends FutureJVppCustomizer
implements ListWriterCustomizer<RemoteMapping, RemoteMappingKey>, EidTranslator,
- AddressTranslator, JvppReplyConsumer {
+ AddressTranslator, JvppReplyConsumer, MappingProducer {
private final EidMappingContext remoteMappingContext;
@@ -78,6 +79,7 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
checkNotNull(dataAfter, "Mapping is null");
checkNotNull(dataAfter.getEid(), "Eid is null");
checkState(id.firstKeyOf(VniTable.class) != null, "Parent vni table not found");
+ checkAllowedCombination(id, dataAfter);
//checks whether mapping not already contains such key
MappingId mappingId = id.firstKeyOf(RemoteMapping.class).getId();
@@ -167,7 +169,7 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
Preconditions.checkArgument(NEGATIVE.equals(resolveType(locatorList)),
"Action can be extracted only from Negative Mapping");
- return ((NegativeMapping) locatorList).getMapReplyAction();
+ return ((NegativeMapping) locatorList).getMapReply().getMapReplyAction();
}
private static Rlocs extractRemoteLocators(LocatorList locatorList) {
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizer.java
index 7ad8f24c0..92a1564c0 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizer.java
@@ -16,30 +16,28 @@
package io.fd.honeycomb.lisp.translate.write;
-import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import com.google.common.base.Optional;
import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
+import io.fd.honeycomb.translate.util.RWUtils;
+
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
-import java.util.concurrent.TimeoutException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTableKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.LispEidTableAddDelMap;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Customizer for {@code TableId}
+ * This customizer serves only as a check if user is not trying to define VniTable <br>
+ * without mapping to vrf/bd
*/
-public class VniTableCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<VniTable, VniTableKey>, ByteDataTranslator, JvppReplyConsumer {
+public class VniTableCustomizer extends FutureJVppCustomizer implements ListWriterCustomizer<VniTable, VniTableKey> {
private static final Logger LOG = LoggerFactory.getLogger(VniTableCustomizer.class);
@@ -50,19 +48,7 @@ public class VniTableCustomizer extends FutureJVppCustomizer
@Override
public void writeCurrentAttributes(InstanceIdentifier<VniTable> id, VniTable dataAfter, WriteContext writeContext)
throws WriteFailedException {
-
- checkNotNull(dataAfter.getTableId(), "VRF cannot be null");
- checkNotNull(dataAfter.getVirtualNetworkIdentifier(), "VNI cannot be null");
-
- LOG.debug("Writing {}", id);
-
- try {
- addDelMap(true, dataAfter.getVirtualNetworkIdentifier().intValue(), dataAfter.getTableId().intValue());
- } catch (TimeoutException | VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
-
- LOG.debug("Write of {} successful", id);
+ checkAtLeastOnChildExists(id, writeContext, false);
}
@Override
@@ -74,29 +60,24 @@ public class VniTableCustomizer extends FutureJVppCustomizer
@Override
public void deleteCurrentAttributes(InstanceIdentifier<VniTable> id, VniTable dataBefore, WriteContext writeContext)
throws WriteFailedException {
- checkNotNull(dataBefore.getTableId(), "VRF cannot be null");
- checkNotNull(dataBefore.getVirtualNetworkIdentifier(), "VNI cannot be null");
-
- LOG.debug("Removing {}", id);
-
- try {
- addDelMap(false, dataBefore.getVirtualNetworkIdentifier().intValue(), dataBefore.getTableId().intValue());
- } catch (TimeoutException | VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataBefore, e);
- }
-
- LOG.debug("Remove of {} successful", id);
+ checkAtLeastOnChildExists(id, writeContext, true);
}
- private void addDelMap(boolean isAdd, int vni, int vrf) throws TimeoutException, VppBaseCallException {
+ private void checkAtLeastOnChildExists(final InstanceIdentifier<VniTable> id, final WriteContext writeContext,
+ final boolean before) {
- LispEidTableAddDelMap request = new LispEidTableAddDelMap();
+ Optional<VniTable> optData;
+ final InstanceIdentifier<VniTable> trimmedId = RWUtils.cutId(id, InstanceIdentifier.create(VniTable.class));
+ if (before) {
+ optData = writeContext.readBefore(trimmedId);
+ } else {
+ optData = writeContext.readAfter(trimmedId);
+ }
- request.isAdd = booleanToByte(isAdd);
- request.vni = vni;
- request.dpTable = vrf;
- request.isL2 = 0;
+ checkState(optData.isPresent(), "Illegal after-write state");
- getReply(getFutureJVpp().lispEidTableAddDelMap(request).toCompletableFuture());
+ final VniTable dataAfter = optData.get();
+ checkState(dataAfter.getVrfSubtable() != null || dataAfter.getBridgeDomainSubtable() != null,
+ "At least one of VrfSubtable/BridgeDomainSubtable must be defined");
}
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizer.java
new file mode 100644
index 000000000..a48ec6e22
--- /dev/null
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizer.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2015 Cisco and/or its affiliates.
+ *
+ * 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.
+ */
+
+package io.fd.honeycomb.lisp.translate.write;
+
+import io.fd.honeycomb.lisp.translate.write.trait.SubtableWriter;
+import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
+import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import java.util.concurrent.TimeoutException;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import io.fd.vpp.jvpp.VppBaseCallException;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class VrfSubtableCustomizer extends FutureJVppCustomizer
+ implements WriterCustomizer<VrfSubtable>, SubtableWriter {
+
+ private static final Logger LOG = LoggerFactory.getLogger(VrfSubtableCustomizer.class);
+
+ public VrfSubtableCustomizer(@Nonnull final FutureJVppCore futureJvpp) {
+ super(futureJvpp);
+ }
+
+ @Override
+ public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<VrfSubtable> id,
+ @Nonnull final VrfSubtable dataAfter, @Nonnull final WriteContext writeContext)
+ throws WriteFailedException {
+
+ LOG.debug("Writing Id[{}]/Data[{}]", id, dataAfter);
+
+ try {
+ addDelSubtableMapping(getFutureJVpp(), true, extractVni(id), dataAfter.getTableId().intValue(), false, LOG);
+ } catch (TimeoutException | VppBaseCallException e) {
+ throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
+ }
+
+ LOG.debug("{} successfully written", id);
+ }
+
+ @Override
+ public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<VrfSubtable> id,
+ @Nonnull final VrfSubtable dataBefore, @Nonnull final VrfSubtable dataAfter,
+ @Nonnull final WriteContext writeContext) throws WriteFailedException {
+ throw new UnsupportedOperationException("Operation not supported");
+ }
+
+ @Override
+ public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<VrfSubtable> id,
+ @Nonnull final VrfSubtable dataBefore, @Nonnull final WriteContext writeContext)
+ throws WriteFailedException {
+
+ LOG.debug("Removing Id[{}]/Data[{}]", id, dataBefore);
+
+ try {
+ addDelSubtableMapping(getFutureJVpp(), false, extractVni(id), dataBefore.getTableId().intValue(), false,
+ LOG);
+ } catch (TimeoutException | VppBaseCallException e) {
+ throw new WriteFailedException.CreateFailedException(id, dataBefore, e);
+ }
+
+ LOG.debug("{} successfully removed", id);
+ }
+
+}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LispWriterFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LispWriterFactory.java
index aa839ba49..4021cc70c 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LispWriterFactory.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LispWriterFactory.java
@@ -17,6 +17,7 @@
package io.fd.honeycomb.lisp.translate.write.factory;
+import static com.google.common.base.Preconditions.checkNotNull;
import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.INTERFACE_CONTEXT;
import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.LOCAL_MAPPING_CONTEXT;
import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.LOCATOR_SET_CONTEXT;
@@ -31,11 +32,12 @@ import io.fd.honeycomb.translate.impl.write.GenericWriter;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.Lisp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.lisp.feature.data.grouping.LispFeatureData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.pitr.cfg.grouping.PitrCfg;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
/**
@@ -43,26 +45,32 @@ import io.fd.vpp.jvpp.core.future.FutureJVppCore;
*/
public final class LispWriterFactory extends AbstractLispWriterFactoryBase implements WriterFactory {
+ private final NamingContext bridgeDomainContext;
+
@Inject
public LispWriterFactory(final FutureJVppCore vppApi,
@Named(INTERFACE_CONTEXT) final NamingContext interfaceContext,
@Named(LOCATOR_SET_CONTEXT) final NamingContext locatorSetContext,
+ @Named("bridge-domain-context") final NamingContext bridgeDomainContext,
@Named(LOCAL_MAPPING_CONTEXT) final EidMappingContext localMappingContext,
@Named(REMOTE_MAPPING_CONTEXT) final EidMappingContext remoteMappingContext) {
super(InstanceIdentifier.create(Lisp.class), vppApi, interfaceContext, locatorSetContext, localMappingContext,
remoteMappingContext);
+ this.bridgeDomainContext = checkNotNull(bridgeDomainContext, "Bridge domain context cannot be null");
}
@Override
public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
registry.add(new GenericWriter<>(lispInstanceIdentifier, new LispCustomizer(vppApi)));
- VniTableWriterFactory.newInstance(lispInstanceIdentifier, vppApi, localMappingContext, remoteMappingContext)
+ VniTableWriterFactory.newInstance(lispInstanceIdentifier, vppApi, localMappingContext, remoteMappingContext,
+ bridgeDomainContext)
.init(registry);
LocatorSetsWriterFactory.newInstance(lispInstanceIdentifier, vppApi, interfaceContext, locatorSetContext)
.init(registry);
MapResolversWriterFactory.newInstance(lispInstanceIdentifier, vppApi).init(registry);
- registry.add(new GenericWriter<>(lispInstanceIdentifier.child(PitrCfg.class), new PitrCfgCustomizer(vppApi)));
+ registry.add(new GenericWriter<>(lispInstanceIdentifier.child(LispFeatureData.class).child(PitrCfg.class),
+ new PitrCfgCustomizer(vppApi)));
}
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LocatorSetsWriterFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LocatorSetsWriterFactory.java
index d2f70dfda..4ebae0c0f 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LocatorSetsWriterFactory.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LocatorSetsWriterFactory.java
@@ -24,6 +24,7 @@ import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.Lisp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.lisp.feature.data.grouping.LispFeatureData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.locator.sets.grouping.LocatorSets;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.locator.sets.grouping.locator.sets.LocatorSet;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.locator.sets.grouping.locator.sets.locator.set.Interface;
@@ -54,7 +55,7 @@ final class LocatorSetsWriterFactory extends AbstractLispWriterFactoryBase imple
@Override
public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
InstanceIdentifier<LocatorSet> locatorSetId =
- lispInstanceIdentifier.child(LocatorSets.class).child(LocatorSet.class);
+ lispInstanceIdentifier.child(LispFeatureData.class).child(LocatorSets.class).child(LocatorSet.class);
registry.add(new GenericListWriter<>(locatorSetId, new LocatorSetCustomizer(vppApi, locatorSetContext)));
registry.add(new GenericListWriter<>(locatorSetId.child(Interface.class),
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/MapResolversWriterFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/MapResolversWriterFactory.java
index 6bd251d5b..a4250fb2d 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/MapResolversWriterFactory.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/MapResolversWriterFactory.java
@@ -23,6 +23,7 @@ import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.Lisp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.lisp.feature.data.grouping.LispFeatureData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.map.resolvers.grouping.MapResolvers;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.map.resolvers.grouping.map.resolvers.MapResolver;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -47,7 +48,8 @@ final class MapResolversWriterFactory extends AbstractLispWriterFactoryBase impl
@Override
public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
- registry.add(new GenericListWriter<>(lispInstanceIdentifier.child(MapResolvers.class).child(MapResolver.class),
+ registry.add(new GenericListWriter<>(
+ lispInstanceIdentifier.child(LispFeatureData.class).child(MapResolvers.class).child(MapResolver.class),
new MapResolverCustomizer(vppApi)));
}
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/VniTableWriterFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/VniTableWriterFactory.java
index 5fc29845a..4d43b77df 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/VniTableWriterFactory.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/VniTableWriterFactory.java
@@ -16,31 +16,41 @@
package io.fd.honeycomb.lisp.translate.write.factory;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import com.google.common.collect.ImmutableSet;
import io.fd.honeycomb.lisp.context.util.EidMappingContext;
import io.fd.honeycomb.lisp.translate.write.AdjacencyCustomizer;
+import io.fd.honeycomb.lisp.translate.write.BridgeDomainSubtableCustomizer;
import io.fd.honeycomb.lisp.translate.write.LocalMappingCustomizer;
import io.fd.honeycomb.lisp.translate.write.RemoteMappingCustomizer;
import io.fd.honeycomb.lisp.translate.write.VniTableCustomizer;
+import io.fd.honeycomb.lisp.translate.write.VrfSubtableCustomizer;
import io.fd.honeycomb.translate.impl.write.GenericListWriter;
+import io.fd.honeycomb.translate.impl.write.GenericWriter;
+import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.Lisp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.Adjacencies;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.Adjacency;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.adjacency.LocalEid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.adjacency.RemoteEid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.LocalMappings;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.RemoteMappings;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.negative.mapping.MapReply;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.positive.mapping.Rlocs;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.positive.mapping.rlocs.Locator;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.EidTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.Adjacencies;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.LocalMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.adjacency.LocalEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.adjacency.RemoteEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.locator.list.positive.mapping.Rlocs;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.locator.list.positive.mapping.rlocs.Locator;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.lisp.feature.data.grouping.LispFeatureData;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
/**
@@ -48,47 +58,91 @@ import io.fd.vpp.jvpp.core.future.FutureJVppCore;
*/
final class VniTableWriterFactory extends AbstractLispWriterFactoryBase implements WriterFactory {
+ private final NamingContext bridgeDomainContext;
+
private VniTableWriterFactory(final InstanceIdentifier<Lisp> lispInstanceIdentifier,
final FutureJVppCore vppApi,
final EidMappingContext localMappingContext,
- final EidMappingContext remoteMappingContext) {
+ final EidMappingContext remoteMappingContext,
+ final NamingContext bridgeDomainContext) {
super(lispInstanceIdentifier, vppApi, localMappingContext, remoteMappingContext);
+ this.bridgeDomainContext = checkNotNull(bridgeDomainContext, "Bridge domain context cannot be null");
}
public static VniTableWriterFactory newInstance(
@Nonnull final InstanceIdentifier<Lisp> lispInstanceIdentifier,
@Nonnull final FutureJVppCore vppApi,
@Nonnull final EidMappingContext localMappingContext,
- @Nonnull final EidMappingContext remoteMappingContext) {
- return new VniTableWriterFactory(lispInstanceIdentifier, vppApi, localMappingContext, remoteMappingContext);
+ @Nonnull final EidMappingContext remoteMappingContext,
+ @Nonnull final NamingContext bridgeDomainContext) {
+ return new VniTableWriterFactory(lispInstanceIdentifier, vppApi, localMappingContext, remoteMappingContext,
+ bridgeDomainContext);
}
@Override
public void init(final ModifiableWriterRegistryBuilder registry) {
final InstanceIdentifier<VniTable> vniTableId =
- lispInstanceIdentifier.child(EidTable.class).child(VniTable.class);
+ lispInstanceIdentifier.child(LispFeatureData.class).child(EidTable.class).child(VniTable.class);
+
+ final InstanceIdentifier<VrfSubtable> vrfSubtableId = vniTableId.child(VrfSubtable.class);
+ final InstanceIdentifier<BridgeDomainSubtable> bridgeDomainSubtableId =
+ vniTableId.child(BridgeDomainSubtable.class);
registry.add(new GenericListWriter<>(vniTableId, new VniTableCustomizer(vppApi)));
+ registry.add(new GenericWriter<>(vrfSubtableId, new VrfSubtableCustomizer(vppApi)));
+ registry.add(new GenericWriter<>(bridgeDomainSubtableId,
+ new BridgeDomainSubtableCustomizer(vppApi, bridgeDomainContext)));
+ //VniTable - > VrfSubtable -> LocalMappings - > LocalMapping
final InstanceIdentifier<LocalMapping> localMappingSubtreeId = InstanceIdentifier.create(LocalMapping.class);
registry.subtreeAdd(ImmutableSet.of(localMappingSubtreeId
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.local.mapping.Eid.class)),
- new GenericListWriter<>(vniTableId.child(LocalMappings.class).child(LocalMapping.class),
+ .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid.class)),
+ new GenericListWriter<>(
+ vrfSubtableId.child(LocalMappings.class).child(LocalMapping.class),
+ new LocalMappingCustomizer(vppApi, localMappingContext)));
+ //VniTable - > BridgeDomainSubtable -> LocalMappings - > LocalMapping
+ registry.subtreeAdd(ImmutableSet.of(localMappingSubtreeId
+ .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid.class)),
+ new GenericListWriter<>(bridgeDomainSubtableId.child(LocalMappings.class)
+ .child(LocalMapping.class),
new LocalMappingCustomizer(vppApi, localMappingContext)));
+ //VniTable - > VrfSubtable -> RemoteMappings - > RemoteMapping
final InstanceIdentifier<RemoteMapping> remoteMappingSubtreeId = InstanceIdentifier.create(RemoteMapping.class);
registry.subtreeAdd(ImmutableSet.of(remoteMappingSubtreeId
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.Eid.class),
+ .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid.class),
+ remoteMappingSubtreeId.child(Rlocs.class),
+ remoteMappingSubtreeId.child(Rlocs.class).child(Locator.class),
+ remoteMappingSubtreeId.child(MapReply.class)),
+ new GenericListWriter<>(
+ vrfSubtableId.child(RemoteMappings.class).child(RemoteMapping.class),
+ new RemoteMappingCustomizer(vppApi, remoteMappingContext)));
+ //VniTable - > BridgeDomainSubtable -> RemoteMappings - > RemoteMapping
+ registry.subtreeAdd(ImmutableSet.of(remoteMappingSubtreeId
+ .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid.class),
remoteMappingSubtreeId.child(Rlocs.class),
- remoteMappingSubtreeId.child(Rlocs.class).child(Locator.class)),
- new GenericListWriter<>(vniTableId.child(RemoteMappings.class).child(RemoteMapping.class),
+ remoteMappingSubtreeId.child(Rlocs.class).child(Locator.class),
+ remoteMappingSubtreeId.child(MapReply.class)),
+ new GenericListWriter<>(bridgeDomainSubtableId.child(RemoteMappings.class)
+ .child(RemoteMapping.class),
new RemoteMappingCustomizer(vppApi, remoteMappingContext)));
+ //VniTable - > VrfSubtable -> RemoteMappings - > RemoteMapping - > Adjacencies - > Adjacency
final InstanceIdentifier<Adjacency> adjacencySubtreeId = InstanceIdentifier.create(Adjacency.class);
registry.subtreeAdd(ImmutableSet.of(adjacencySubtreeId
.child(LocalEid.class), adjacencySubtreeId.child(RemoteEid.class)),
- new GenericListWriter<>(vniTableId.child(Adjacencies.class).child(Adjacency.class),
- new AdjacencyCustomizer(vppApi)));
+ new GenericListWriter<>(
+ vrfSubtableId.child(RemoteMappings.class).child(RemoteMapping.class)
+ .child(Adjacencies.class).child(Adjacency.class),
+ new AdjacencyCustomizer(vppApi, localMappingContext, remoteMappingContext)));
+ //VniTable - > BridgeDomainSubtable -> RemoteMappings - > RemoteMapping - > Adjacencies - > Adjacency
+ registry.subtreeAdd(ImmutableSet.of(adjacencySubtreeId
+ .child(LocalEid.class), adjacencySubtreeId.child(RemoteEid.class)),
+ new GenericListWriter<>(
+ bridgeDomainSubtableId.child(RemoteMappings.class)
+ .child(RemoteMapping.class)
+ .child(Adjacencies.class).child(Adjacency.class),
+ new AdjacencyCustomizer(vppApi, localMappingContext, remoteMappingContext)));
}
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriter.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriter.java
new file mode 100644
index 000000000..d7f46ad9b
--- /dev/null
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriter.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2015 Cisco and/or its affiliates.
+ *
+ * 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.
+ */
+
+package io.fd.honeycomb.lisp.translate.write.trait;
+
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
+import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
+import java.util.concurrent.TimeoutException;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable;
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import io.fd.vpp.jvpp.VppBaseCallException;
+import io.fd.vpp.jvpp.core.dto.LispEidTableAddDelMap;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import org.slf4j.Logger;
+
+/**
+ * Trait providing logic for writing subtables
+ */
+public interface SubtableWriter extends ByteDataTranslator, JvppReplyConsumer {
+ int DEFAULT_VNI = 0;
+
+ /**
+ * Writes mapping from {@link VniTable}
+ * to {@link VrfSubtable} or
+ * {@link BridgeDomainSubtable}
+ *
+ * @param addDel true if add,delete otherwise
+ * @param vni {@link VniTable} ID
+ * @param tableId if <b>isL2</b> is true, than bridge domain subtable id,else vrf subtable id
+ * @param isL2 indicates whether (false) writing to L3 vrfSubtrable of (true) L2 bridgeDomainSubtrable
+ */
+ default void addDelSubtableMapping(@Nonnull final FutureJVppCore vppApi, final boolean addDel, final int vni,
+ final int tableId,
+ final boolean isL2,
+ final Logger logger) throws TimeoutException, VppBaseCallException {
+
+ if (vni == DEFAULT_VNI) {
+ // attempt to write subtable with default vni mapping(it does'nt make sense and it should'nt be possible)
+ // also allows to enable lisp without defining default mapping in request
+ logger.info("An attempt to write subtable[id = {}] with default vni {} was detected, ignoring write",
+ tableId, DEFAULT_VNI);
+ return;
+ }
+
+ checkNotNull(vppApi, "VPP Api refference cannot be null");
+
+ LispEidTableAddDelMap request = new LispEidTableAddDelMap();
+
+ request.isAdd = booleanToByte(addDel);
+ request.vni = vni;
+ request.dpTable = tableId;
+ request.isL2 = booleanToByte(isL2);
+
+ getReply(vppApi.lispEidTableAddDelMap(request).toCompletableFuture());
+ }
+
+ default int extractVni(@Nonnull final InstanceIdentifier<? extends ChildOf<VniTable>> id) {
+ return checkNotNull(
+ checkNotNull(id, "Identifier cannot be null").firstKeyOf(VniTable.class),
+ "Parent VNI id not defined").getVirtualNetworkIdentifier().intValue();
+ }
+}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/LispModuleTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/LispModuleTest.java
index 76cebc882..6d1e05ce8 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/LispModuleTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/LispModuleTest.java
@@ -47,6 +47,10 @@ public class LispModuleTest {
@Bind
private NamingContext interfaceContext;
+ @Named("bridge-domain-context")
+ @Bind
+ private NamingContext bridgeDomainContext;
+
@Named("honeycomb-context")
@Bind
@Mock
@@ -71,6 +75,7 @@ public class LispModuleTest {
public void setUp() throws Exception {
initMocks(this);
interfaceContext = new NamingContext("interfaceContext", "interfaceContext");
+ bridgeDomainContext = new NamingContext("bridgeDomainContext", "bridgeDomainContext");
Guice.createInjector(new LispModule(), BoundFieldModule.of(this)).injectMembers(this);
}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/EidMappingContextTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/EidMappingContextTest.java
index 710477a70..1691a9e87 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/EidMappingContextTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/EidMappingContextTest.java
@@ -19,62 +19,76 @@ package io.fd.honeycomb.lisp.context.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
-import com.google.common.base.Optional;
+import io.fd.honeycomb.lisp.util.EidMappingContextHelper;
import io.fd.honeycomb.translate.MappingContext;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.MappingBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.local.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.local.mapping.EidBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder;
-public class EidMappingContextTest {
+public class EidMappingContextTest implements EidMappingContextHelper {
- private EidMappingContext eidMappingContext;
+ private static final String EID_MAPPING_CONTEXT_NAME = "eidMappingContext";
@Mock
private MappingContext mappingContext;
+ private EidMappingContext eidMappingContext;
+ private Eid localEid;
+ private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid
+ remoteEid;
+ private org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid
+ mappingEid;
+ private MappingId mappingId;
+
@Before
public void init() {
MockitoAnnotations.initMocks(this);
- eidMappingContext = new EidMappingContext("eid-eidMappingContext");
- }
+ eidMappingContext = new EidMappingContext(EID_MAPPING_CONTEXT_NAME);
- @Test
- public void testStoreAndGet() {
- Eid eid =
+ localEid =
new EidBuilder().setAddress(new Ipv4Builder().setIpv4(new Ipv4Address("192.168.2.1")).build()).build();
- MappingId id = new MappingId("first");
-
- eidMappingContext.addEid(id, eid, mappingContext);
- when(mappingContext.read(Mockito.any(InstanceIdentifier.class)))
- .thenReturn(Optional.of(
- new MappingBuilder().setId(id).setEid(copyEid(eid)).build()
- ));
+ remoteEid = fromLocalToRemoteEid(localEid);
+ mappingEid = fromLocalToMappingEid(localEid);
+ mappingId = new MappingId("mapping");
- Eid sameEid =
- new EidBuilder().setAddress(new Ipv4Builder().setIpv4(new Ipv4Address("192.168.2.1")).build()).build();
- MappingId sameId = new MappingId("first");
-
- assertTrue(eidMappingContext.containsEid(sameId, mappingContext));
+ defineMapping(mappingContext, mappingEid, mappingId, EID_MAPPING_CONTEXT_NAME);
+ }
+ @Test
+ public void testContainsEid() {
+ assertTrue(eidMappingContext.containsEid(mappingId, mappingContext));
org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid
- loadedEid = eidMappingContext.getEid(sameId, mappingContext);
+ loadedEid = eidMappingContext.getEid(mappingId, mappingContext);
assertEquals("192.168.2.1", ((Ipv4) (loadedEid.getAddress())).getIpv4().getValue());
}
- private org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid copyEid(
+ @Test
+ public void testContainsId() {
+ assertTrue(eidMappingContext.containsId(localEid, mappingContext));
+ assertTrue(eidMappingContext.containsId(remoteEid, mappingContext));
+ }
+
+ @Test
+ public void testGetEid() {
+ assertEquals(mappingEid, eidMappingContext.getEid(mappingId, mappingContext));
+ }
+
+ @Test
+ public void testGetId() {
+ assertEquals(mappingId, eidMappingContext.getId(localEid, mappingContext));
+ assertEquals(mappingId, eidMappingContext.getId(remoteEid, mappingContext));
+ }
+
+ private org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid fromLocalToMappingEid(
Eid eid) {
return new org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.EidBuilder()
.setAddress(eid.getAddress())
@@ -82,4 +96,13 @@ public class EidMappingContextTest {
.setVirtualNetworkId(eid.getVirtualNetworkId())
.build();
}
+
+ private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid fromLocalToRemoteEid(
+ Eid eid) {
+ return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
+ .setAddress(eid.getAddress())
+ .setAddressType(eid.getAddressType())
+ .setVirtualNetworkId(eid.getVirtualNetworkId())
+ .build();
+ }
}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/initializers/LispInitializerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/initializers/LispInitializerTest.java
index 087f2cdee..4da6593e0 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/initializers/LispInitializerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/initializers/LispInitializerTest.java
@@ -9,10 +9,7 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.Lisp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.LispState;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.LispStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.EidTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.locator.sets.grouping.LocatorSetsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.map.resolvers.grouping.MapResolversBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.pitr.cfg.grouping.PitrCfgBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.lisp.feature.data.grouping.LispFeatureDataBuilder;
public class LispInitializerTest {
@@ -22,21 +19,14 @@ public class LispInitializerTest {
final LispInitializer initializer = new LispInitializer(mock(DataBroker.class));
final LispState state = new LispStateBuilder()
.setEnable(true)
- .setEidTable(new EidTableBuilder().build())
- .setLocatorSets(new LocatorSetsBuilder().build())
- .setMapResolvers(new MapResolversBuilder().build())
- .setPitrCfg(new PitrCfgBuilder().build())
+ .setLispFeatureData(new LispFeatureDataBuilder().build())
.build();
final Lisp operational = initializer.convert(state);
assertNotNull(operational);
- assertEquals(operational.getPitrCfg(), state.getPitrCfg());
assertEquals(operational.isEnable(), state.isEnable());
- assertEquals(operational.getEidTable(), state.getEidTable());
- assertEquals(operational.getLocatorSets(), state.getLocatorSets());
- assertEquals(operational.getMapResolvers(), state.getMapResolvers());
-
+ assertEquals(operational.getLispFeatureData(), state.getLispFeatureData());
}
} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizerTest.java
index 0a88f946c..861fff67c 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizerTest.java
@@ -7,10 +7,10 @@ import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
import org.junit.Before;
import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.AdjacenciesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.AdjacencyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.AdjacencyKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.AdjacenciesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.Adjacency;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.AdjacencyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.AdjacencyKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizerTest.java
new file mode 100644
index 000000000..5902028fe
--- /dev/null
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizerTest.java
@@ -0,0 +1,104 @@
+package io.fd.honeycomb.lisp.translate.read;
+
+
+import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.MapLevel.L2;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import io.fd.honeycomb.lisp.translate.read.trait.SubtableReaderTestCase;
+import io.fd.honeycomb.translate.read.ReadFailedException;
+import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
+import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException;
+import io.fd.honeycomb.translate.vpp.util.NamingContext;
+import io.fd.vpp.jvpp.VppCallbackException;
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.EidTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtableBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class BridgeDomainSubtableCustomizerTest
+ extends SubtableReaderTestCase<BridgeDomainSubtable, BridgeDomainSubtableBuilder> {
+
+ private InstanceIdentifier<BridgeDomainSubtable> validId;
+ private NamingContext bridgeDomainContext;
+
+ public BridgeDomainSubtableCustomizerTest() {
+ super(BridgeDomainSubtable.class, VniTableBuilder.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ bridgeDomainContext = new NamingContext("br", "br-domain-context");
+ validId = InstanceIdentifier.create(EidTable.class).child(VniTable.class, new VniTableKey(expectedVni))
+ .child(BridgeDomainSubtable.class);
+
+ defineMapping(mappingContext, "br-domain", expectedTableId, "br-domain-context");
+ }
+
+ @Test
+ public void testReadCurrentSuccessfull() throws ReadFailedException {
+ doReturnValidNonEmptyDataOnDump();
+ BridgeDomainSubtableBuilder builder = new BridgeDomainSubtableBuilder();
+ customizer.readCurrentAttributes(validId, builder, ctx);
+
+ verifyLispEidTableMapDumpCalled(L2);
+
+ final BridgeDomainSubtable subtable = builder.build();
+ assertNotNull(subtable);
+ assertEquals("br-domain", subtable.getBridgeDomainRef());
+ }
+
+
+ @Test
+ public void testReadCurrentEmptyDump() throws ReadFailedException {
+ doReturnEmptyDataOnDump();
+ BridgeDomainSubtableBuilder builder = new BridgeDomainSubtableBuilder();
+ customizer.readCurrentAttributes(validId, builder, ctx);
+
+ verifyLispEidTableMapDumpCalled(L2);
+
+ final BridgeDomainSubtable subtable = builder.build();
+ assertNotNull(subtable);
+ assertNull(subtable.getBridgeDomainRef());
+ }
+
+ @Test
+ public void testReadCurrentFailed() {
+ doThrowOnDump();
+ BridgeDomainSubtableBuilder builder = new BridgeDomainSubtableBuilder();
+ try {
+ customizer.readCurrentAttributes(validId, builder, ctx);
+ } catch (ReadFailedException e) {
+ assertTrue(e.getCause() instanceof DumpCallFailedException);
+ assertTrue(e.getCause().getCause() instanceof VppCallbackException);
+ assertNull(builder.getBridgeDomainRef());
+ verifyLispEidTableMapDumpNotCalled();
+
+ return;
+ }
+
+ fail("Test should throw ReadFailedException");
+ }
+
+ @Test
+ public void testGetBuilder() {
+ final BridgeDomainSubtableBuilder builder = customizer.getBuilder(validId);
+
+ assertNotNull(builder);
+ assertNull(builder.getLocalMappings());
+ assertNull(builder.getRemoteMappings());
+ assertNull(builder.getBridgeDomainRef());
+ }
+
+ @Override
+ protected ReaderCustomizer<BridgeDomainSubtable, BridgeDomainSubtableBuilder> initCustomizer() {
+ return new BridgeDomainSubtableCustomizer(api, bridgeDomainContext);
+ }
+}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizerTest.java
new file mode 100644
index 000000000..a1688ae35
--- /dev/null
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizerTest.java
@@ -0,0 +1,150 @@
+package io.fd.honeycomb.lisp.translate.read;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import io.fd.honeycomb.translate.read.ReadFailedException;
+import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
+import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException;
+import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
+import io.fd.vpp.jvpp.VppCallbackException;
+import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocs;
+import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocsReply;
+import java.nio.charset.StandardCharsets;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.itr.remote.locator.sets.grouping.ItrRemoteLocatorSet;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.itr.remote.locator.sets.grouping.ItrRemoteLocatorSetBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.lisp.feature.data.grouping.LispFeatureDataBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+
+public class ItrRemoteLocatorSetCustomizerTest
+ extends ReaderCustomizerTest<ItrRemoteLocatorSet, ItrRemoteLocatorSetBuilder> {
+
+ private static final String EXPECTED_LOCATOR_SET_NAME = "loc-set";
+
+ private InstanceIdentifier<ItrRemoteLocatorSet> validId;
+ private ItrRemoteLocatorSetBuilder builder;
+
+ public ItrRemoteLocatorSetCustomizerTest() {
+ super(ItrRemoteLocatorSet.class, LispFeatureDataBuilder.class);
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ validId = InstanceIdentifier.create(ItrRemoteLocatorSet.class);
+ builder = new ItrRemoteLocatorSetBuilder();
+ }
+
+ @Override
+ protected ReaderCustomizer<ItrRemoteLocatorSet, ItrRemoteLocatorSetBuilder> initCustomizer() {
+ return new ItrRemoteLocatorSetCustomizer(api);
+ }
+
+ @Test
+ public void getBuilder() throws Exception {
+ final ItrRemoteLocatorSetBuilder itrRemoteLocatorSetBuilder = getCustomizer().getBuilder(validId);
+
+ assertNotNull(itrRemoteLocatorSetBuilder);
+ assertNull(itrRemoteLocatorSetBuilder.getRemoteLocatorSetName());
+ }
+
+ @Test
+ public void readCurrentAttributesSuccess() throws Exception {
+ doReturnValidDataOnDump();
+
+ getCustomizer().readCurrentAttributes(validId, builder, ctx);
+
+ assertNotNull(builder);
+ assertEquals(EXPECTED_LOCATOR_SET_NAME, builder.getRemoteLocatorSetName());
+ verifyLispGetMapRequestItrRlocsInvokedOnce();
+ }
+
+ @Test
+ public void readCurrentAttributesEmptyData() throws Exception {
+ doReturnEmptyDataOnDump();
+ getCustomizer().readCurrentAttributes(validId, builder, ctx);
+ verifyInvalidDataCase(builder);
+ }
+
+ @Test
+ public void readCurrentAttributesFailedCallHalted() {
+ doThrowExceptionOnDump();
+ try {
+ getCustomizer().readCurrentAttributes(validId, builder, ctx);
+ } catch (ReadFailedException e) {
+ assertTrue(e.getCause() instanceof DumpCallFailedException);
+ assertTrue(e.getCause().getCause() instanceof VppCallbackException);
+ assertNotNull(builder);
+ assertNull(builder.getRemoteLocatorSetName());
+
+ verifyLispGetMapRequestItrRlocsInvokedOnce();
+ return;
+ }
+
+ fail("Test should have thrown exception");
+ }
+
+ @Test
+ public void merge() throws Exception {
+ LispFeatureDataBuilder builder = new LispFeatureDataBuilder();
+ ItrRemoteLocatorSet set = new ItrRemoteLocatorSetBuilder().setRemoteLocatorSetName("loc-set").build();
+ getCustomizer().merge(builder, set);
+
+ assertNotNull(builder);
+ assertEquals(set, builder.getItrRemoteLocatorSet());
+ }
+
+
+ private void doReturnValidDataOnDump() {
+ LispGetMapRequestItrRlocsReply reply = new LispGetMapRequestItrRlocsReply();
+ reply.locatorSetName = EXPECTED_LOCATOR_SET_NAME.getBytes(StandardCharsets.UTF_8);
+
+ when(api.lispGetMapRequestItrRlocs(any(LispGetMapRequestItrRlocs.class)))
+ .thenReturn(CompletableFuture.completedFuture(reply));
+ }
+
+ private void doReturnNullDataOnDump() {
+ when(api.lispGetMapRequestItrRlocs(any(LispGetMapRequestItrRlocs.class)))
+ .thenReturn(CompletableFuture.completedFuture(null));
+ }
+
+ private void doReturnEmptyDataOnDump() {
+ when(api.lispGetMapRequestItrRlocs(any(LispGetMapRequestItrRlocs.class)))
+ .thenReturn(CompletableFuture.completedFuture(new LispGetMapRequestItrRlocsReply()));
+ }
+
+ private void doThrowExceptionOnDump() {
+ when(api.lispGetMapRequestItrRlocs(any(LispGetMapRequestItrRlocs.class))).
+ thenReturn(new CompletableFuture<LispGetMapRequestItrRlocsReply>() {
+ @Override
+ public LispGetMapRequestItrRlocsReply get(final long l, final TimeUnit timeUnit)
+ throws InterruptedException, ExecutionException, TimeoutException {
+ throw new ExecutionException(new VppCallbackException("lispGetMapRequestItrRlocs", 1, -2));
+ }
+ });
+ }
+
+ private void verifyLispGetMapRequestItrRlocsInvokedOnce() {
+ verify(api, times(1)).lispGetMapRequestItrRlocs(any(LispGetMapRequestItrRlocs.class));
+ }
+
+ private void verifyInvalidDataCase(final ItrRemoteLocatorSetBuilder builder) {
+ assertNotNull(builder);
+ assertNull(builder.getRemoteLocatorSetName());
+
+ verifyLispGetMapRequestItrRlocsInvokedOnce();
+ }
+} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizerTest.java
index 3b1506e39..a7317b9cc 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizerTest.java
@@ -1,5 +1,6 @@
package io.fd.honeycomb.lisp.translate.read;
+import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV4;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Matchers.any;
@@ -7,6 +8,7 @@ import static org.mockito.Mockito.when;
import com.google.common.collect.ImmutableList;
import io.fd.honeycomb.lisp.context.util.EidMappingContext;
+import io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams;
import io.fd.honeycomb.lisp.translate.util.EidTranslator;
import io.fd.honeycomb.translate.MappingContext;
import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
@@ -20,15 +22,17 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.MappingId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.LocalMappings;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.LocalMappingsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMappingBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMappingKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.EidTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.LocalMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.LocalMappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.LocalMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.LocalMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.local.mapping.Eid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import io.fd.vpp.jvpp.core.dto.LispEidTableDetails;
import io.fd.vpp.jvpp.core.dto.LispEidTableDetailsReplyDump;
@@ -53,11 +57,13 @@ public class LocalMappingCustomizerTest extends
public void setUp() {
emptyIdentifier = InstanceIdentifier.create(EidTable.class)
.child(VniTable.class, new VniTableKey(12L))
+ .child(VrfSubtable.class)
.child(LocalMappings.class)
.child(LocalMapping.class);
validIdentifier = InstanceIdentifier.create(EidTable.class)
.child(VniTable.class, new VniTableKey(12L))
+ .child(VrfSubtable.class)
.child(LocalMappings.class)
.child(LocalMapping.class, new LocalMappingKey(new MappingId("local-mapping")));
@@ -73,6 +79,7 @@ public class LocalMappingCustomizerTest extends
detail.context = 4;
detail.eid = new byte[]{-64, -88, 2, 1};
detail.eidPrefixLen = 32;
+ detail.eidType = (byte) IPV4.getValue();
detail.isLocal = 1;
detail.locatorSetIndex = 1;
detail.ttl = 7;
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizerTest.java
index 7afd8dd4f..112350676 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizerTest.java
@@ -8,6 +8,8 @@ import static org.mockito.Mockito.when;
import com.google.common.collect.ImmutableList;
import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
+import io.fd.vpp.jvpp.core.dto.LispMapResolverDetails;
+import io.fd.vpp.jvpp.core.dto.LispMapResolverDetailsReplyDump;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
@@ -19,14 +21,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.map.resolvers.grouping.map.resolvers.MapResolverBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.map.resolvers.grouping.map.resolvers.MapResolverKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispMapResolverDetails;
-import io.fd.vpp.jvpp.core.dto.LispMapResolverDetailsReplyDump;
public class MapResolverCustomizerTest
extends ListReaderCustomizerTest<MapResolver, MapResolverKey, MapResolverBuilder> {
- private static final IpAddress IP_ADDRESS = new IpAddress(new Ipv4AddressNoZone("192.168.2.1"));
private static final IpAddress IP_ADDRESS_REVERTED =
new IpAddress(new Ipv4AddressNoZone("1.2.168.192"));
@@ -64,7 +63,7 @@ public class MapResolverCustomizerTest
final MapResolverKey key = keys.get(0);
assertNotNull(key);
- assertEquals("192.168.2.1", new String(key.getIpAddress().getValue()));
+ assertEquals("1.2.168.192", new String(key.getIpAddress().getValue()));
}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizerTest.java
index c46d1f454..6c345223e 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizerTest.java
@@ -11,6 +11,7 @@ import java.nio.charset.StandardCharsets;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.LispStateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.lisp.feature.data.grouping.LispFeatureDataBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.pitr.cfg.grouping.PitrCfg;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.pitr.cfg.grouping.PitrCfgBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -22,16 +23,14 @@ public class PitrCfgCustomizerTest extends ReaderCustomizerTest<PitrCfg, PitrCfg
private static final byte[] LOC_SET_NAME_BYTES = "loc-set".getBytes(StandardCharsets.UTF_8);
private InstanceIdentifier<PitrCfg> emptyId;
- private PitrCfg validData;
public PitrCfgCustomizerTest() {
- super(PitrCfg.class, LispStateBuilder.class);
+ super(PitrCfg.class, LispFeatureDataBuilder.class);
}
@Before
public void init() {
emptyId = InstanceIdentifier.create(PitrCfg.class);
- validData = new PitrCfgBuilder().setLocatorSet("loc-set").build();
mockDumpData();
}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizerTest.java
index a431d224c..5ab8e5996 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizerTest.java
@@ -2,6 +2,7 @@ package io.fd.honeycomb.lisp.translate.read;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.when;
@@ -11,6 +12,11 @@ import io.fd.honeycomb.lisp.translate.util.EidTranslator;
import io.fd.honeycomb.translate.MappingContext;
import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
+import io.fd.vpp.jvpp.core.dto.LispEidTableDetails;
+import io.fd.vpp.jvpp.core.dto.LispEidTableDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.LispLocatorDetails;
+import io.fd.vpp.jvpp.core.dto.LispLocatorDetailsReplyDump;
+import java.util.Collections;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
@@ -19,19 +25,22 @@ import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.MapReplyAction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.MappingId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.RemoteMappings;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.RemoteMappingsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMappingBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMappingKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.NegativeMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.PositiveMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.positive.mapping.rlocs.Locator;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.EidTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.RemoteMappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.RemoteMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.RemoteMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.Eid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispEidTableDetails;
-import io.fd.vpp.jvpp.core.dto.LispEidTableDetailsReplyDump;
public class RemoteMappingCustomizerTest
extends ListReaderCustomizerTest<RemoteMapping, RemoteMappingKey, RemoteMappingBuilder>
@@ -43,7 +52,6 @@ public class RemoteMappingCustomizerTest
@Mock
private EidMappingContext eidMappingContext;
- private InstanceIdentifier<RemoteMapping> emptyId;
private InstanceIdentifier<RemoteMapping> validId;
public RemoteMappingCustomizerTest() {
@@ -53,22 +61,56 @@ public class RemoteMappingCustomizerTest
@Before
public void init() {
- emptyId = InstanceIdentifier.create(EidTable.class)
- .child(VniTable.class, new VniTableKey(12L))
- .child(RemoteMappings.class)
- .child(RemoteMapping.class);
-
validId = InstanceIdentifier.create(EidTable.class)
.child(VniTable.class, new VniTableKey(12L))
+ .child(VrfSubtable.class)
.child(RemoteMappings.class)
.child(RemoteMapping.class, new RemoteMappingKey(new MappingId("remote-mapping")));
-
- mockDumpData();
mockMappings();
}
- private void mockDumpData() {
+ private void mockDumpDataActionZero() {
+ LispEidTableDetailsReplyDump replyDump = new LispEidTableDetailsReplyDump();
+ LispEidTableDetails detail = new LispEidTableDetails();
+ detail.action = 0;
+ detail.authoritative = 1;
+ detail.context = 4;
+ detail.eid = new byte[]{-64, -88, 2, 1};
+ detail.eidPrefixLen = 32;
+ detail.isLocal = 0;
+ detail.locatorSetIndex = 1;
+ detail.ttl = 7;
+ detail.vni = 12;
+
+ replyDump.lispEidTableDetails = ImmutableList.of(detail);
+
+ when(api.lispEidTableDump(any())).thenReturn(future(replyDump));
+
+ LispLocatorDetailsReplyDump rlocs = new LispLocatorDetailsReplyDump();
+ rlocs.lispLocatorDetails = Collections.emptyList();
+ when(api.lispLocatorDump(any())).thenReturn(future(rlocs));
+ }
+
+ private void mockDumpDataActionOne() {
+ LispEidTableDetailsReplyDump replyDump = new LispEidTableDetailsReplyDump();
+ LispEidTableDetails detail = new LispEidTableDetails();
+ detail.action = 1;
+ detail.authoritative = 1;
+ detail.context = 4;
+ detail.eid = new byte[]{-64, -88, 2, 1};
+ detail.eidPrefixLen = 32;
+ detail.isLocal = 0;
+ detail.locatorSetIndex = 1;
+ detail.ttl = 7;
+ detail.vni = 12;
+
+ replyDump.lispEidTableDetails = ImmutableList.of(detail);
+
+ when(api.lispEidTableDump(any())).thenReturn(future(replyDump));
+ }
+
+ private void mockDumpDataActionZeroWithRemotes() {
LispEidTableDetailsReplyDump replyDump = new LispEidTableDetailsReplyDump();
LispEidTableDetails detail = new LispEidTableDetails();
detail.action = 0;
@@ -84,8 +126,20 @@ public class RemoteMappingCustomizerTest
replyDump.lispEidTableDetails = ImmutableList.of(detail);
when(api.lispEidTableDump(any())).thenReturn(future(replyDump));
+
+ LispLocatorDetailsReplyDump rlocs = new LispLocatorDetailsReplyDump();
+ LispLocatorDetails rloc = new LispLocatorDetails();
+ rloc.ipAddress = new byte[]{-64, -88, 2, 1};
+ rloc.isIpv6 = 0;
+ rloc.priority = 1;
+ rloc.weight = 2;
+
+ rlocs.lispLocatorDetails = ImmutableList.of(rloc);
+
+ when(api.lispLocatorDump(any())).thenReturn(future(rlocs));
}
+
private void mockMappings() {
when(eidMappingContext.getId(any(Eid.class), any(MappingContext.class)))
@@ -96,7 +150,41 @@ public class RemoteMappingCustomizerTest
}
@Test
- public void readCurrentAttributes() throws Exception {
+ public void readCurrentAttributesNegativeMappingOne() throws Exception {
+ mockDumpDataActionOne();
+ RemoteMappingBuilder builder = new RemoteMappingBuilder();
+ getCustomizer().readCurrentAttributes(validId, builder, ctx);
+
+ RemoteMapping mapping = builder.build();
+
+ assertNotNull(mapping);
+ assertEquals(true, compareAddresses(EID_ADDRESS, mapping.getEid().getAddress()));
+ assertEquals(true, mapping.getAuthoritative().isA());
+ assertEquals(7L, mapping.getTtl().longValue());
+ assertTrue(mapping.getLocatorList() instanceof NegativeMapping);
+ assertEquals(MapReplyAction.NativelyForward,
+ ((NegativeMapping) mapping.getLocatorList()).getMapReply().getMapReplyAction());
+ }
+
+ @Test
+ public void readCurrentAttributesNegativeMappingZero() throws Exception {
+ mockDumpDataActionZero();
+ RemoteMappingBuilder builder = new RemoteMappingBuilder();
+ getCustomizer().readCurrentAttributes(validId, builder, ctx);
+
+ RemoteMapping mapping = builder.build();
+
+ assertNotNull(mapping);
+ assertEquals(true, compareAddresses(EID_ADDRESS, mapping.getEid().getAddress()));
+ assertEquals(true, mapping.getAuthoritative().isA());
+ assertEquals(7L, mapping.getTtl().longValue());
+ assertEquals(MapReplyAction.NoAction,
+ ((NegativeMapping) mapping.getLocatorList()).getMapReply().getMapReplyAction());
+ }
+
+ @Test
+ public void readCurrentAttributesPositiveMapping() throws Exception {
+ mockDumpDataActionZeroWithRemotes();
RemoteMappingBuilder builder = new RemoteMappingBuilder();
getCustomizer().readCurrentAttributes(validId, builder, ctx);
@@ -106,11 +194,20 @@ public class RemoteMappingCustomizerTest
assertEquals(true, compareAddresses(EID_ADDRESS, mapping.getEid().getAddress()));
assertEquals(true, mapping.getAuthoritative().isA());
assertEquals(7L, mapping.getTtl().longValue());
+ assertTrue(mapping.getLocatorList() instanceof PositiveMapping);
+
+ final List<Locator> locators = ((PositiveMapping) mapping.getLocatorList()).getRlocs().getLocator();
+ assertEquals(1, locators.size());
+ final Locator locator = locators.get(0);
+ assertEquals("192.168.2.1", locator.getAddress().getIpv4Address().getValue());
+ assertEquals(1, locator.getPriority().shortValue());
+ assertEquals(2, locator.getWeight().shortValue());
}
@Test
public void getAllIds() throws Exception {
+ mockDumpDataActionOne();
final List<RemoteMappingKey> keys = getCustomizer().getAllIds(validId, ctx);
assertNotNull(keys);
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizerTest.java
index f4fe52c5d..fe967e486 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizerTest.java
@@ -1,25 +1,34 @@
package io.fd.honeycomb.lisp.translate.read;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
import com.google.common.collect.ImmutableList;
+import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
+import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException;
import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
+import io.fd.vpp.jvpp.VppCallbackException;
+import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetails;
+import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetailsReplyDump;
import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.Mockito;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.EidTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.EidTableBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTableBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTableKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetails;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
-
public class VniTableCustomizerTest extends ListReaderCustomizerTest<VniTable, VniTableKey, VniTableBuilder> {
@@ -31,41 +40,72 @@ public class VniTableCustomizerTest extends ListReaderCustomizerTest<VniTable, V
@Before
public void init() {
- validId = InstanceIdentifier.create(EidTable.class).child(VniTable.class, new VniTableKey(2L));
-
- final LispEidTableMapDetailsReplyDump replyDump = new LispEidTableMapDetailsReplyDump();
- final LispEidTableMapDetails detail = new LispEidTableMapDetails();
- detail.dpTable = 3;
- detail.vni = 2;
- detail.context = 4;
- replyDump.lispEidTableMapDetails = ImmutableList.of(detail);
-
- when(api.lispEidTableMapDump(any())).thenReturn(future(replyDump));
+ validId = InstanceIdentifier.create(EidTable.class).child(VniTable.class, new VniTableKey(12L));
}
@Test
- public void getAllIds() throws Exception {
+ public void testReadAllSuccessfull() throws ReadFailedException {
+ whenLispEidTableVniDumpReturnValid();
final List<VniTableKey> keys = getCustomizer().getAllIds(validId, ctx);
- assertEquals(1, keys.size());
+ assertNotNull(keys);
+ assertEquals(3, keys.size());
+ assertTrue(keys.contains(new VniTableKey(12L)));
+ assertTrue(keys.contains(new VniTableKey(14L)));
+ assertTrue(keys.contains(new VniTableKey(16L)));
+ }
- final VniTableKey key = keys.get(0);
- assertNotNull(key);
- //due to ambigous call (long,long) vs (Object,Object)
- assertEquals(2L, key.getVirtualNetworkIdentifier().longValue());
+ @Test
+ public void testReadAllFailed() {
+ whenLispEidTableVniDumpThrowException();
+ try {
+ getCustomizer().getAllIds(validId, ctx);
+ } catch (ReadFailedException e) {
+ assertTrue(e instanceof ReadFailedException);
+ assertTrue(e.getCause() instanceof DumpCallFailedException);
+ assertTrue(e.getCause().getCause() instanceof VppCallbackException);
+ }
}
@Test
- public void readCurrentAttributes() throws Exception {
+ public void testReadAttributes() throws ReadFailedException {
+ whenLispEidTableVniDumpReturnValid();
VniTableBuilder builder = new VniTableBuilder();
- getCustomizer().readCurrentAttributes(validId, builder, ctx);
- final VniTable table = builder.build();
+ customizer.readCurrentAttributes(validId, builder, ctx);
+ final VniTable table = builder.build();
assertNotNull(table);
- assertEquals(3L, table.getTableId().longValue());
- assertEquals(2L, table.getVirtualNetworkIdentifier().longValue());
+ assertEquals(12L, table.getVirtualNetworkIdentifier().longValue());
+ }
+
+ private void whenLispEidTableVniDumpReturnValid() {
+
+ LispEidTableVniDetailsReplyDump dump = new LispEidTableVniDetailsReplyDump();
+ LispEidTableVniDetails details1 = new LispEidTableVniDetails();
+ details1.vni = 14;
+
+ LispEidTableVniDetails details2 = new LispEidTableVniDetails();
+ details2.vni = 12;
+
+ LispEidTableVniDetails details3 = new LispEidTableVniDetails();
+ details3.vni = 16;
+
+ dump.lispEidTableVniDetails = ImmutableList.of(details1, details2, details3);
+
+ when(api.lispEidTableVniDump(Mockito.any())).thenReturn(CompletableFuture.completedFuture(dump));
+ }
+
+ private void whenLispEidTableVniDumpThrowException() {
+ when(api.lispEidTableVniDump(Mockito.any()))
+ .thenReturn(new CompletableFuture<LispEidTableVniDetailsReplyDump>() {
+ @Override
+ public LispEidTableVniDetailsReplyDump get(final long l, final TimeUnit timeUnit)
+ throws InterruptedException, ExecutionException, TimeoutException {
+ throw new ExecutionException(new VppCallbackException("lispEidTableVniDump", 1, -2));
+ }
+ });
}
@Override
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizerTest.java
new file mode 100644
index 000000000..f18f349d8
--- /dev/null
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizerTest.java
@@ -0,0 +1,107 @@
+package io.fd.honeycomb.lisp.translate.read;
+
+
+import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.MapLevel.L3;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import io.fd.honeycomb.lisp.translate.read.trait.SubtableReaderTestCase;
+import io.fd.honeycomb.translate.read.ReadFailedException;
+import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
+import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException;
+import io.fd.vpp.jvpp.VppCallbackException;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.EidTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtableBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class VrfSubtableCustomizerTest extends SubtableReaderTestCase<VrfSubtable, VrfSubtableBuilder> {
+
+ private InstanceIdentifier<VrfSubtable> validId;
+
+ public VrfSubtableCustomizerTest() {
+ super(VrfSubtable.class, VrfSubtableBuilder.class);
+ }
+
+ @Before
+ public void init() {
+ validId = InstanceIdentifier.create(EidTable.class).child(VniTable.class, new VniTableKey(expectedVni))
+ .child(VrfSubtable.class);
+ }
+
+ @Test
+ public void testReadCurrentSuccessfull() throws ReadFailedException {
+ doReturnValidNonEmptyDataOnDump();
+ VrfSubtableBuilder builder = new VrfSubtableBuilder();
+ customizer.readCurrentAttributes(validId, builder, ctx);
+
+ verifyLispEidTableMapDumpCalled(L3);
+
+ final VrfSubtable subtable = builder.build();
+ assertNotNull(subtable);
+ assertEquals(expectedTableId, subtable.getTableId().longValue());
+ }
+
+ @Test
+ public void testReadCurrentEmptyDump() throws ReadFailedException {
+ doReturnEmptyDataOnDump();
+ VrfSubtableBuilder builder = new VrfSubtableBuilder();
+ customizer.readCurrentAttributes(validId, builder, ctx);
+
+ verifyLispEidTableMapDumpCalled(L3);
+
+ final VrfSubtable subtable = builder.build();
+ assertNotNull(subtable);
+ assertNull(subtable.getTableId());
+ }
+
+ @Test
+ public void testReadCurrentFailed() {
+ doThrowOnDump();
+ VrfSubtableBuilder builder = new VrfSubtableBuilder();
+ try {
+ customizer.readCurrentAttributes(validId, builder, ctx);
+ } catch (ReadFailedException e) {
+ assertTrue(e.getCause() instanceof DumpCallFailedException);
+ assertTrue(e.getCause().getCause() instanceof VppCallbackException);
+ assertTrue(builder.getTableId() == null);
+ verifyLispEidTableMapDumpNotCalled();
+
+ return;
+ }
+
+ fail("Test should throw ReadFailedException");
+ }
+
+ @Override
+ protected ReaderCustomizer<VrfSubtable, VrfSubtableBuilder> initCustomizer() {
+ return new VrfSubtableCustomizer(api);
+ }
+
+ @Test
+ public void testGetBuilder() {
+ final VrfSubtableBuilder builder = customizer.getBuilder(validId);
+
+ assertNotNull(builder);
+ assertNull(builder.getLocalMappings());
+ assertNull(builder.getRemoteMappings());
+ assertNull(builder.getTableId());
+ }
+
+ @Test
+ public void testMerge() {
+ VniTableBuilder parentBuilder = new VniTableBuilder();
+ VrfSubtable subtable = new VrfSubtableBuilder().build();
+
+ customizer.merge(parentBuilder, subtable);
+ assertEquals(subtable, parentBuilder.getVrfSubtable());
+ }
+}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutorTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutorTest.java
index 3bc95d52b..b955609c5 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutorTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutorTest.java
@@ -12,6 +12,8 @@ import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecut
import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException;
import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpTimeoutException;
import io.fd.honeycomb.vpp.test.read.JvppDumpExecutorTest;
+import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetails;
+import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetailsReplyDump;
import java.util.concurrent.TimeoutException;
import org.junit.Before;
import org.junit.Test;
@@ -22,28 +24,27 @@ import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
public class VniTableDumpExecutorTest extends JvppDumpExecutorTest<VniTableDumpExecutor> {
- private LispEidTableMapDetailsReplyDump validDump;
+ private LispEidTableVniDetailsReplyDump validDump;
@Before
public void init() {
- validDump = new LispEidTableMapDetailsReplyDump();
- LispEidTableMapDetails detail = new LispEidTableMapDetails();
- detail.dpTable = 1;
+ validDump = new LispEidTableVniDetailsReplyDump();
+ LispEidTableVniDetails detail = new LispEidTableVniDetails();
detail.vni = 2;
detail.context = 4;
- validDump.lispEidTableMapDetails = ImmutableList.of(detail);
+ validDump.lispEidTableVniDetails = ImmutableList.of(detail);
}
@Test(expected = DumpCallFailedException.class)
public void testExecuteDumpFail() throws DumpExecutionFailedException {
- doThrowFailExceptionWhen().lispEidTableMapDump(Mockito.any());
+ doThrowFailExceptionWhen().lispEidTableVniDump(Mockito.any());
getExecutor().executeDump(EntityDumpExecutor.NO_PARAMS);
}
@Test
public void testExecuteDumpTimeout() throws Exception {
- doThrowTimeoutExceptionWhen().lispEidTableMapDump(Mockito.any());
+ doThrowTimeoutExceptionWhen().lispEidTableVniDump(Mockito.any());
try {
getExecutor().executeDump(EntityDumpExecutor.NO_PARAMS);
} catch (Exception e) {
@@ -57,15 +58,14 @@ public class VniTableDumpExecutorTest extends JvppDumpExecutorTest<VniTableDumpE
@Test
public void testExecuteDump() throws DumpExecutionFailedException {
- doReturnResponseWhen(validDump).lispEidTableMapDump(Mockito.any());
- final LispEidTableMapDetailsReplyDump reply = getExecutor().executeDump(EntityDumpExecutor.NO_PARAMS);
+ doReturnResponseWhen(validDump).lispEidTableVniDump(Mockito.any());
+ final LispEidTableVniDetailsReplyDump reply = getExecutor().executeDump(EntityDumpExecutor.NO_PARAMS);
assertNotNull(reply);
- assertEquals(1, reply.lispEidTableMapDetails.size());
- final LispEidTableMapDetails detail = reply.lispEidTableMapDetails.get(0);
+ assertEquals(1, reply.lispEidTableVniDetails.size());
+ final LispEidTableVniDetails detail = reply.lispEidTableVniDetails.get(0);
assertEquals(4, detail.context);
- assertEquals(1, detail.dpTable);
assertEquals(2, detail.vni);
}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingFilterProviderTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingFilterProviderTest.java
new file mode 100644
index 000000000..6a7c3b7e7
--- /dev/null
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingFilterProviderTest.java
@@ -0,0 +1,79 @@
+package io.fd.honeycomb.lisp.translate.read.trait;
+
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.LocalMappings;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.RemoteMappings;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class MappingFilterProviderTest implements MappingFilterProvider {
+
+ private InstanceIdentifier<LocalMapping> validVrfLocal;
+ private InstanceIdentifier<LocalMapping> validBdLocal;
+ private InstanceIdentifier<LocalMapping> invalidLocal;
+
+ private InstanceIdentifier<RemoteMapping> validVrfRemote;
+ private InstanceIdentifier<RemoteMapping> validBdRemote;
+ private InstanceIdentifier<RemoteMapping> invalidRemote;
+
+
+ @Before
+ public void init() {
+ validVrfLocal = InstanceIdentifier.create(VrfSubtable.class)
+ .child(LocalMappings.class)
+ .child(LocalMapping.class);
+
+ validBdLocal = InstanceIdentifier.create(BridgeDomainSubtable.class)
+ .child(LocalMappings.class)
+ .child(LocalMapping.class);
+
+ invalidLocal = InstanceIdentifier.create(LocalMapping.class);
+
+ validVrfRemote = InstanceIdentifier.create(VrfSubtable.class)
+ .child(RemoteMappings.class)
+ .child(RemoteMapping.class);
+
+ validBdRemote = InstanceIdentifier.create(BridgeDomainSubtable.class)
+ .child(RemoteMappings.class)
+ .child(RemoteMapping.class);
+
+ invalidRemote = InstanceIdentifier.create(RemoteMapping.class);
+ }
+
+ @Test
+ public void testVrfLocalValid() {
+ assertEquals(VRF_MAPPINGS_ONLY, subtableFilterForLocalMappings(validVrfLocal));
+ }
+
+ @Test
+ public void testBridgeDomainLocalValid() {
+ assertEquals(BRIDGE_DOMAIN_MAPPINGS_ONLY, subtableFilterForLocalMappings(validBdLocal));
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testLocalInvalid() {
+ subtableFilterForLocalMappings(invalidLocal);
+ }
+
+ @Test
+ public void testVrfRemoteValid() {
+ assertEquals(VRF_MAPPINGS_ONLY, subtableFilterForRemoteMappings(validVrfRemote));
+ }
+
+ @Test
+ public void testBridgeDomainRemoteValid() {
+ assertEquals(BRIDGE_DOMAIN_MAPPINGS_ONLY, subtableFilterForRemoteMappings(validBdRemote));
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testRemoteInvalid() {
+ subtableFilterForRemoteMappings(invalidRemote);
+ }
+} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducerTest.java
new file mode 100644
index 000000000..89eab3c5e
--- /dev/null
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducerTest.java
@@ -0,0 +1,170 @@
+package io.fd.honeycomb.lisp.translate.read.trait;
+
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv6Afi;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.MacAfi;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.LocalMappings;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.RemoteMappings;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMappingBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMappingBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class MappingProducerTest implements MappingProducer {
+
+ private InstanceIdentifier<LocalMapping> validVrfLocalMappingId;
+ private InstanceIdentifier<LocalMapping> validBridgeDomainLocalMappingId;
+ private InstanceIdentifier<RemoteMapping> validVrfRemoteMappingId;
+ private InstanceIdentifier<RemoteMapping> validBridgeDomainRemoteMappingId;
+
+ private LocalMapping ipv4LocalMapping;
+ private LocalMapping ipv6LocalMapping;
+ private LocalMapping macLocalMapping;
+
+ private RemoteMapping ipv4RemoteMapping;
+ private RemoteMapping ipv6RemoteMapping;
+ private RemoteMapping macRemoteMapping;
+
+ @Before
+ public void init() {
+ validVrfLocalMappingId = InstanceIdentifier.create(VrfSubtable.class)
+ .child(LocalMappings.class)
+ .child(LocalMapping.class);
+
+ validBridgeDomainLocalMappingId = InstanceIdentifier.create(BridgeDomainSubtable.class)
+ .child(LocalMappings.class)
+ .child(LocalMapping.class);
+
+ validVrfRemoteMappingId = InstanceIdentifier.create(VrfSubtable.class)
+ .child(RemoteMappings.class)
+ .child(RemoteMapping.class);
+
+ validBridgeDomainRemoteMappingId = InstanceIdentifier.create(BridgeDomainSubtable.class)
+ .child(RemoteMappings.class)
+ .child(RemoteMapping.class);
+
+ ipv4LocalMapping = new LocalMappingBuilder()
+ .setEid(new EidBuilder()
+ .setAddressType(Ipv4Afi.class)
+ .build()).build();
+
+ ipv6LocalMapping = new LocalMappingBuilder()
+ .setEid(new EidBuilder()
+ .setAddressType(Ipv6Afi.class)
+ .build()).build();
+ macLocalMapping = new LocalMappingBuilder()
+ .setEid(new EidBuilder()
+ .setAddressType(MacAfi.class)
+ .build()).build();
+
+ ipv4RemoteMapping = new RemoteMappingBuilder()
+ .setEid(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
+ .setAddressType(Ipv4Afi.class).build()).build();
+
+ ipv6RemoteMapping = new RemoteMappingBuilder()
+ .setEid(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
+ .setAddressType(Ipv6Afi.class).build()).build();
+
+ macRemoteMapping = new RemoteMappingBuilder()
+ .setEid(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
+ .setAddressType(MacAfi.class).build()).build();
+ }
+
+ @Test
+ public void testValidVrfLocal() {
+ testPositiveCase(validVrfLocalMappingId, ipv4LocalMapping);
+ testPositiveCase(validVrfLocalMappingId, ipv6LocalMapping);
+ }
+
+ @Test
+ public void testValidBridgeDomainLocal() {
+ testPositiveCase(validBridgeDomainLocalMappingId, macLocalMapping);
+ }
+
+ @Test
+ public void testInvalidVrfLocal() {
+ testNegativeCase(validVrfLocalMappingId, macLocalMapping);
+ }
+
+ @Test
+ public void testInvalidBridgeDomainLocal() {
+ testNegativeCase(validBridgeDomainLocalMappingId, ipv4LocalMapping);
+ testNegativeCase(validBridgeDomainLocalMappingId, ipv6LocalMapping);
+ }
+
+
+ @Test
+ public void testValidVrfRemote() {
+ testPositiveCase(validVrfRemoteMappingId, ipv4RemoteMapping);
+ testPositiveCase(validVrfRemoteMappingId, ipv6RemoteMapping);
+ }
+
+ @Test
+ public void testValidBridgeDomainRemote() {
+ testPositiveCase(validBridgeDomainRemoteMappingId, macRemoteMapping);
+ }
+
+ @Test
+ public void testInvalidVrfRemote() {
+ testNegativeCase(validVrfRemoteMappingId, macRemoteMapping);
+ }
+
+ @Test
+ public void testInvalidBridgeDomainRemote() {
+ testNegativeCase(validBridgeDomainRemoteMappingId, ipv4RemoteMapping);
+ testNegativeCase(validBridgeDomainRemoteMappingId, ipv6RemoteMapping);
+ }
+
+ private void testNegativeCase(final InstanceIdentifier<LocalMapping> identifier, final LocalMapping data) {
+ try {
+ checkAllowedCombination(identifier, data);
+ } catch (WriteFailedException e) {
+ assertTrue(e instanceof WriteFailedException.CreateFailedException);
+ assertTrue(e.getCause() instanceof IllegalArgumentException);
+ return;
+ }
+
+ fail("Test should have failed");
+ }
+
+
+ private void testPositiveCase(final InstanceIdentifier<LocalMapping> identifier, final LocalMapping data) {
+ try {
+ checkAllowedCombination(identifier, data);
+ } catch (WriteFailedException e) {
+ fail("Test should have passed");
+ }
+ }
+
+ private void testNegativeCase(final InstanceIdentifier<RemoteMapping> identifier, final RemoteMapping data) {
+ try {
+ checkAllowedCombination(identifier, data);
+ } catch (WriteFailedException e) {
+ assertTrue(e instanceof WriteFailedException.CreateFailedException);
+ assertTrue(e.getCause() instanceof IllegalArgumentException);
+ return;
+ }
+
+ fail("Test should have failed");
+ }
+
+
+ private void testPositiveCase(final InstanceIdentifier<RemoteMapping> identifier, final RemoteMapping data) {
+ try {
+ checkAllowedCombination(identifier, data);
+ } catch (WriteFailedException e) {
+ fail("Test should have passed");
+ }
+ }
+}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReaderTestCase.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReaderTestCase.java
new file mode 100644
index 000000000..f40d72951
--- /dev/null
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReaderTestCase.java
@@ -0,0 +1,81 @@
+package io.fd.honeycomb.lisp.translate.read.trait;
+
+
+import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.MapLevel;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import com.google.common.collect.ImmutableList;
+import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
+import io.fd.vpp.jvpp.VppCallbackException;
+import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetails;
+import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.LispEidTableMapDump;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import javax.annotation.Nonnull;
+import org.junit.Before;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
+import org.opendaylight.yangtools.concepts.Builder;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+public abstract class SubtableReaderTestCase<D extends DataObject, B extends Builder<D>>
+ extends ReaderCustomizerTest<D, B>
+ implements SubtableReader {
+
+ protected final long expectedVni = 12;
+ protected final int expectedTableId = 14;
+
+ @Captor
+ protected ArgumentCaptor<LispEidTableMapDump> requestCaptor;
+
+ public SubtableReaderTestCase(final Class<D> dataObjectClass,
+ final Class<? extends Builder<? extends DataObject>> parentBuilderClass) {
+ super(dataObjectClass, parentBuilderClass);
+ }
+
+ protected void doReturnValidNonEmptyDataOnDump() {
+ LispEidTableMapDetailsReplyDump reply = new LispEidTableMapDetailsReplyDump();
+ LispEidTableMapDetails detailFirst = new LispEidTableMapDetails();
+ detailFirst.vni = Long.valueOf(expectedVni).intValue();
+ detailFirst.dpTable = expectedTableId;
+
+ LispEidTableMapDetails detailSecond = new LispEidTableMapDetails();
+ detailSecond.vni = 13;
+ detailSecond.dpTable = 15;
+
+ reply.lispEidTableMapDetails = ImmutableList.of(detailFirst, detailSecond);
+
+ when(api.lispEidTableMapDump(any(LispEidTableMapDump.class)))
+ .thenReturn(future(reply));
+ }
+
+ protected void doReturnEmptyDataOnDump() {
+ LispEidTableMapDetailsReplyDump reply = new LispEidTableMapDetailsReplyDump();
+ reply.lispEidTableMapDetails = Collections.emptyList();
+ when(api.lispEidTableMapDump(any(LispEidTableMapDump.class)))
+ .thenReturn(future(reply));
+ }
+
+ protected void doThrowOnDump() {
+ when(api.lispEidTableMapDump(any(LispEidTableMapDump.class)))
+ .thenReturn(failedFuture());
+ }
+
+ protected void verifyLispEidTableMapDumpCalled(@Nonnull final MapLevel expectedLevel) {
+ verify(api, times(1)).lispEidTableMapDump(requestCaptor.capture());
+ assertEquals(expectedLevel.getValue(), requestCaptor.getValue().isL2);
+ }
+
+ protected void verifyLispEidTableMapDumpNotCalled() {
+ verify(api, times(1)).lispEidTableMapDump(any());
+ }
+}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/util/EidTranslatorTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/util/EidTranslatorTest.java
index 88ad10970..956a6cabf 100755
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/util/EidTranslatorTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/util/EidTranslatorTest.java
@@ -18,7 +18,7 @@ public class EidTranslatorTest implements EidTranslator {
@Test
public void testGetEidType() {
assertEquals(IPV4, getEidType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.EidBuilder()
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
.setAddress(
new Ipv4Builder().setIpv4(
new Ipv4Address("192.168.2.1"))
@@ -26,7 +26,7 @@ public class EidTranslatorTest implements EidTranslator {
.build()));
assertEquals(IPV6, getEidType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.EidBuilder()
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
.setAddress(
new Ipv6Builder().setIpv6(
new Ipv6Address("2001:0db8:0a0b:12f0:0000:0000:0000:0001"))
@@ -34,7 +34,7 @@ public class EidTranslatorTest implements EidTranslator {
.build()));
assertEquals(MAC, getEidType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.EidBuilder()
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
.setAddress(
new MacBuilder().setMac(
new MacAddress("aa:bb:cc:dd:ee:ff"))
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizerTest.java
index b32b0bbe2..30c84cc9f 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizerTest.java
@@ -4,37 +4,53 @@ import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsD
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import io.fd.honeycomb.lisp.context.util.EidMappingContext;
+import io.fd.honeycomb.translate.MappingContext;
import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
+import io.fd.vpp.jvpp.core.dto.LispAddDelAdjacency;
+import io.fd.vpp.jvpp.core.dto.LispAddDelAdjacencyReply;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
+import org.mockito.Mock;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.MacAfi;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.MacBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.Adjacencies;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.Adjacency;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.AdjacencyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.adjacency.LocalEidBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.adjacencies.grouping.adjacencies.adjacency.RemoteEidBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.RemoteMappings;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMapping;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.EidTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.Adjacencies;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.AdjacencyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.adjacency.LocalEidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.adjacencies.adjacency.RemoteEidBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispAddDelAdjacency;
-import io.fd.vpp.jvpp.core.dto.LispAddDelAdjacencyReply;
public class AdjacencyCustomizerTest extends WriterCustomizerTest {
@Captor
private ArgumentCaptor<LispAddDelAdjacency> requestCaptor;
+ @Mock
+ private EidMappingContext localMappingContext;
+
+ @Mock
+ private EidMappingContext remoteMappingContext;
+
private AdjacencyCustomizer customizer;
private InstanceIdentifier<Adjacency> emptyId;
@@ -46,58 +62,142 @@ public class AdjacencyCustomizerTest extends WriterCustomizerTest {
@Before
public void init() {
- customizer = new AdjacencyCustomizer(api);
+ customizer = new AdjacencyCustomizer(api, localMappingContext, remoteMappingContext);
emptyId = InstanceIdentifier.create(Adjacency.class);
validId = InstanceIdentifier.create(EidTable.class)
.child(VniTable.class, new VniTableKey(2L))
+ .child(BridgeDomainSubtable.class)
+ .child(RemoteMappings.class)
+ .child(RemoteMapping.class)
.child(Adjacencies.class)
.child(Adjacency.class);
emptyData = new AdjacencyBuilder().build();
invalidData = new AdjacencyBuilder().setId("ID").setLocalEid(
- new LocalEidBuilder().setAddress(new Ipv4Builder().setIpv4(new Ipv4Address("192.168.2.1")).build())
+ new LocalEidBuilder()
+ .setVirtualNetworkId(new InstanceIdType(12L))
+ .setAddressType(Ipv4Afi.class)
+ .setAddress(new Ipv4Builder().setIpv4(new Ipv4Address("192.168.2.1")).build())
.build()).setRemoteEid(
- new RemoteEidBuilder().setAddress(new MacBuilder().setMac(new MacAddress("aa:aa:aa:aa:aa:aa")).build())
+ new RemoteEidBuilder()
+ .setVirtualNetworkId(new InstanceIdType(12L))
+ .setAddressType(MacAfi.class)
+ .setAddress(new MacBuilder().setMac(new MacAddress("aa:aa:aa:aa:aa:aa")).build())
.build())
.build();
validData = new AdjacencyBuilder().setId("ID").setLocalEid(
- new LocalEidBuilder().setAddress(new Ipv4Builder().setIpv4(new Ipv4Address("192.168.2.1")).build())
+ new LocalEidBuilder()
+ .setVirtualNetworkId(new InstanceIdType(12L))
+ .setAddressType(Ipv4Afi.class)
+ .setAddress(new Ipv4Builder().setIpv4(new Ipv4Address("192.168.2.1")).build())
.build()).setRemoteEid(
new RemoteEidBuilder()
+ .setVirtualNetworkId(new InstanceIdType(12L))
+ .setAddressType(Ipv4Afi.class)
.setAddress(new Ipv4Builder().setIpv4(new Ipv4Address("192.168.5.2")).build()).build()).build();
when(api.lispAddDelAdjacency(any())).thenReturn(future(new LispAddDelAdjacencyReply()));
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void writeCurrentAttributesNoKey() throws Exception {
- customizer.writeCurrentAttributes(emptyId, emptyData, writeContext);
+ try {
+ customizer.writeCurrentAttributes(emptyId, emptyData, writeContext);
+ } catch (NullPointerException e) {
+ verify(api, times(0)).lispAddDelAdjacency(any());
+ return;
+ }
+
+ fail("Test should have failed while reading parent vni table id");
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void writeCurrentAttributesInvalidCombination() throws Exception {
- customizer.writeCurrentAttributes(emptyId, invalidData, writeContext);
+ try {
+ customizer.writeCurrentAttributes(emptyId, invalidData, writeContext);
+ } catch (NullPointerException e) {
+ verify(api, times(0)).lispAddDelAdjacency(any());
+ return;
+ }
+
+ fail("Test should have failed while reading parent vni table id");
}
+
@Test
public void writeCurrentAttributes() throws Exception {
+ when(localMappingContext.containsId(
+ any(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid.class),
+ any(
+ MappingContext.class))).thenReturn(true);
+
+ when(remoteMappingContext.containsId(
+ any(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid.class),
+ any(
+ MappingContext.class))).thenReturn(true);
+
customizer.writeCurrentAttributes(validId, validData, writeContext);
verify(api, times(1)).lispAddDelAdjacency(requestCaptor.capture());
verifyRequest(requestCaptor.getValue(), 1, new byte[]{-64, -88, 2, 1}, 32, new byte[]{-64, -88, 5, 2},
32, IPV4.getValue(), 2);
}
+ @Test
+ public void writeCurrentAttributesNonExistingLocalMapping() throws Exception {
+ when(localMappingContext.containsId(
+ any(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid.class),
+ any(MappingContext.class))).thenReturn(false);
+
+ when(remoteMappingContext.containsId(
+ any(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid.class),
+ any(MappingContext.class))).thenReturn(true);
+ try {
+ customizer.writeCurrentAttributes(validId, validData, writeContext);
+ } catch (IllegalStateException e) {
+ verify(api, times(0)).lispAddDelAdjacency(any());
+ return;
+ }
+
+ fail("Test should have failed while verifying local eid");
+ }
+
+ @Test
+ public void writeCurrentAttributesNonExistingRemoteMapping() throws Exception {
+ when(localMappingContext.containsId(
+ any(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid.class),
+ any(MappingContext.class))).thenReturn(true);
+
+ when(remoteMappingContext.containsId(
+ any(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid.class),
+ any(MappingContext.class))).thenReturn(false);
+ try {
+ customizer.writeCurrentAttributes(validId, validData, writeContext);
+ } catch (IllegalStateException e) {
+ verify(api, times(0)).lispAddDelAdjacency(any());
+ return;
+ }
+
+ fail("Test should have failed while verifying remote eid");
+ }
+
@Test(expected = UnsupportedOperationException.class)
public void updateCurrentAttributes() throws Exception {
customizer.updateCurrentAttributes(emptyId, emptyData, emptyData, writeContext);
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void deleteCurrentAttributesNoKey() throws Exception {
- customizer.deleteCurrentAttributes(emptyId, emptyData, writeContext);
+ try {
+ customizer.deleteCurrentAttributes(emptyId, emptyData, writeContext);
+ } catch (NullPointerException e) {
+ verify(api, times(0)).lispAddDelAdjacency(any());
+ return;
+ }
+
+ fail("Test should have failed while reading parent vni table id");
}
@Test(expected = IllegalArgumentException.class)
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainCustomizerTest.java
new file mode 100644
index 000000000..189570cb1
--- /dev/null
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainCustomizerTest.java
@@ -0,0 +1,92 @@
+package io.fd.honeycomb.lisp.translate.write;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import io.fd.honeycomb.lisp.translate.write.trait.SubtableWriterTestCase;
+import io.fd.honeycomb.translate.vpp.util.NamingContext;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.VppCallbackException;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.EidTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtableBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class BridgeDomainCustomizerTest extends SubtableWriterTestCase {
+
+ private BridgeDomainSubtableCustomizer customizer;
+ private InstanceIdentifier<BridgeDomainSubtable> validId;
+ private BridgeDomainSubtable validData;
+ private NamingContext bridgeDomainContext;
+
+ @Before
+ public void init() {
+ bridgeDomainContext = new NamingContext("br", "bridge-domain-context");
+ customizer = new BridgeDomainSubtableCustomizer(api, bridgeDomainContext);
+ validId = InstanceIdentifier.create(EidTable.class).child(VniTable.class, new VniTableKey(12L))
+ .child(BridgeDomainSubtable.class);
+ validData = new BridgeDomainSubtableBuilder().setBridgeDomainRef("br-domain").build();
+ defineMapping(mappingContext, "br-domain", 10, "bridge-domain-context");
+ }
+
+ @Test
+ public void testWriteSuccessfull() throws WriteFailedException {
+ whenAddDelEidTableAddDelMapSuccess();
+ customizer.writeCurrentAttributes(validId, validData, writeContext);
+ verifyAddDelEidTableAddDelMapInvokedCorrectly(1, 12, 10, 1);
+ }
+
+ @Test
+ public void testWriteFailed() throws WriteFailedException {
+ whenAddDelEidTableAddDelMapFail();
+
+ try {
+ customizer.writeCurrentAttributes(validId, validData, writeContext);
+ } catch (Exception e) {
+ assertTrue(e instanceof WriteFailedException);
+
+ final WriteFailedException realException = ((WriteFailedException) e);
+ assertEquals(validId, realException.getFailedId());
+ assertTrue(e.getCause() instanceof VppCallbackException);
+ return;
+ }
+
+ fail("Test should throw exception");
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void testUpdate() throws WriteFailedException {
+ customizer.updateCurrentAttributes(validId, validData, validData, writeContext);
+ }
+
+ @Test
+ public void testDeleteSuccessfull() throws WriteFailedException {
+ whenAddDelEidTableAddDelMapSuccess();
+ customizer.deleteCurrentAttributes(validId, validData, writeContext);
+ verifyAddDelEidTableAddDelMapInvokedCorrectly(0, 12, 10, 1);
+ }
+
+ @Test
+ public void testDeleteFailed() {
+ whenAddDelEidTableAddDelMapFail();
+
+ try {
+ customizer.deleteCurrentAttributes(validId, validData, writeContext);
+ } catch (Exception e) {
+ assertTrue(e instanceof WriteFailedException);
+
+ final WriteFailedException realException = ((WriteFailedException) e);
+ assertEquals(validId, realException.getFailedId());
+ assertTrue(e.getCause() instanceof VppCallbackException);
+ return;
+ }
+
+ fail("Test should throw exception");
+ }
+
+}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizerTest.java
index 8abd07e7e..e68c97674 100755
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizerTest.java
@@ -32,6 +32,7 @@ import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.Lisp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.lisp.feature.data.grouping.LispFeatureData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.locator.sets.grouping.LocatorSets;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.locator.sets.grouping.locator.sets.LocatorSet;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.locator.sets.grouping.locator.sets.LocatorSetKey;
@@ -58,6 +59,7 @@ public class InterfaceCustomizerTest extends WriterCustomizerTest implements Byt
defineMapping(mappingContext, interfaceName, 5, ifcCtxName);
id = InstanceIdentifier.builder(Lisp.class)
+ .child(LispFeatureData.class)
.child(LocatorSets.class)
.child(LocatorSet.class, new LocatorSetKey("Locator"))
.child(Interface.class, new InterfaceKey(interfaceName))
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java
new file mode 100644
index 000000000..97806c542
--- /dev/null
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java
@@ -0,0 +1,130 @@
+package io.fd.honeycomb.lisp.translate.write;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
+import io.fd.vpp.jvpp.VppCallbackException;
+import io.fd.vpp.jvpp.core.dto.LispAddDelMapRequestItrRlocs;
+import io.fd.vpp.jvpp.core.dto.LispAddDelMapRequestItrRlocsReply;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.itr.remote.locator.sets.grouping.ItrRemoteLocatorSet;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.itr.remote.locator.sets.grouping.ItrRemoteLocatorSetBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class ItrRemoteLocatorSetCustomizerTest extends WriterCustomizerTest implements ByteDataTranslator {
+
+ private static final String VALID_NAME = "loc-set";
+
+ @Captor
+ private ArgumentCaptor<LispAddDelMapRequestItrRlocs> requestCaptor;
+
+ private ItrRemoteLocatorSetCustomizer customizer;
+ private InstanceIdentifier<ItrRemoteLocatorSet> validId;
+ private ItrRemoteLocatorSet validData;
+
+ @Before
+ public void setUp() throws Exception {
+ initMocks(this);
+ customizer = new ItrRemoteLocatorSetCustomizer(api);
+ validId = InstanceIdentifier.create(ItrRemoteLocatorSet.class);
+ validData = new ItrRemoteLocatorSetBuilder().setRemoteLocatorSetName(VALID_NAME).build();
+ }
+
+ @Test
+ public void writeCurrentAttributesSuccess() throws Exception {
+ onWriteSuccess();
+ customizer.writeCurrentAttributes(validId, validData, writeContext);
+ verifyWriteInvoked(true, VALID_NAME);
+ }
+
+ @Test
+ public void writeCurrentAttributesFailed() {
+ onWriteThrow();
+
+ try {
+ customizer.writeCurrentAttributes(validId, validData, writeContext);
+ } catch (WriteFailedException e) {
+ assertTrue(e.getCause() instanceof VppCallbackException);
+ verifyWriteInvoked(true, VALID_NAME);
+ return;
+ }
+
+ fail("Test should have thrown exception");
+ }
+
+ @Test
+ public void updateCurrentAttributes() {
+ try {
+ customizer.updateCurrentAttributes(validId, validData, validData, writeContext);
+ } catch (WriteFailedException e) {
+ assertTrue(e.getCause() instanceof UnsupportedOperationException);
+ return;
+ }
+
+ fail("Test should have thrown exception");
+ }
+
+ @Test
+ public void deleteCurrentAttributesSuccess() throws Exception {
+ onWriteSuccess();
+ customizer.deleteCurrentAttributes(validId, validData, writeContext);
+ verifyWriteInvoked(false, VALID_NAME);
+ }
+
+ @Test
+ public void deleteCurrentAttributesFailed() throws Exception {
+ onWriteThrow();
+
+ try {
+ customizer.writeCurrentAttributes(validId, validData, writeContext);
+ } catch (WriteFailedException e) {
+ assertTrue(e.getCause() instanceof VppCallbackException);
+ verifyWriteInvoked(true, VALID_NAME);
+ return;
+ }
+
+ fail("Test should have thrown exception");
+ }
+
+ private void onWriteSuccess() {
+ when(api.lispAddDelMapRequestItrRlocs(any(LispAddDelMapRequestItrRlocs.class)))
+ .thenReturn(CompletableFuture.completedFuture(new LispAddDelMapRequestItrRlocsReply()));
+ }
+
+ private void onWriteThrow() {
+ when(api.lispAddDelMapRequestItrRlocs(any(LispAddDelMapRequestItrRlocs.class)))
+ .thenReturn(new CompletableFuture<LispAddDelMapRequestItrRlocsReply>() {
+ @Override
+ public LispAddDelMapRequestItrRlocsReply get(final long l, final TimeUnit timeUnit)
+ throws InterruptedException, ExecutionException, TimeoutException {
+ throw new ExecutionException(new VppCallbackException("lispAddDelMapRequestItrRlocs", 1, -2));
+ }
+ });
+ }
+
+ private void verifyWriteInvoked(final boolean add, final String name) {
+ verify(api, times(1)).lispAddDelMapRequestItrRlocs(requestCaptor.capture());
+
+ final LispAddDelMapRequestItrRlocs request = requestCaptor.getValue();
+ assertNotNull(request);
+ assertEquals(booleanToByte(add), request.isAdd);
+ assertEquals(name, toString(request.locatorSetName));
+ }
+} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizerTest.java
index 14867f049..4e24b3f3f 100755
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizerTest.java
@@ -36,18 +36,21 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.Lisp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.MappingId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.LocalMappings;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMappingBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMappingKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.Eid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.EidTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.LocalMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.LocalMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.LocalMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.local.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.local.mappings.local.mapping.EidBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.lisp.feature.data.grouping.LispFeatureData;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import io.fd.vpp.jvpp.core.dto.LispAddDelLocalEid;
import io.fd.vpp.jvpp.core.dto.LispAddDelLocalEidReply;
@@ -66,10 +69,12 @@ public class LocalMappingCustomizerTest extends WriterCustomizerTest implements
@Override
public void setUp() {
final Eid
- eid = new EidBuilder().setAddress(
- new Ipv4Builder().setIpv4(
- new Ipv4Address("192.168.2.1"))
- .build())
+ eid = new EidBuilder()
+ .setAddressType(Ipv4Afi.class)
+ .setAddress(
+ new Ipv4Builder().setIpv4(
+ new Ipv4Address("192.168.2.1"))
+ .build())
.build();
mapping = new LocalMappingBuilder()
@@ -78,8 +83,10 @@ public class LocalMappingCustomizerTest extends WriterCustomizerTest implements
.build();
id = InstanceIdentifier.builder(Lisp.class)
+ .child(LispFeatureData.class)
.child(EidTable.class)
.child(VniTable.class, new VniTableKey(25L))
+ .child(VrfSubtable.class)
.child(LocalMappings.class)
.child(LocalMapping.class, new LocalMappingKey(new MappingId("local")))
.build();
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizerTest.java
index 6afce0113..a1f0dc792 100755
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizerTest.java
@@ -29,28 +29,32 @@ import io.fd.honeycomb.lisp.context.util.EidMappingContext;
import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
+import io.fd.vpp.jvpp.core.dto.LispAddDelRemoteMapping;
+import io.fd.vpp.jvpp.core.dto.LispAddDelRemoteMappingReply;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.Lisp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.MapReplyAction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.MappingId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.RemoteMappings;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMappingBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.RemoteMappingKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.Eid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.NegativeMappingBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.negative.mapping.MapReplyBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.EidTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.RemoteMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.RemoteMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.EidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.remote.mappings.remote.mapping.locator.list.NegativeMappingBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.lisp.feature.data.grouping.LispFeatureData;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispAddDelRemoteMapping;
-import io.fd.vpp.jvpp.core.dto.LispAddDelRemoteMappingReply;
public class RemoteMappingCustomizerTest extends WriterCustomizerTest implements Ipv4Translator {
@@ -67,10 +71,12 @@ public class RemoteMappingCustomizerTest extends WriterCustomizerTest implements
@Override
public void setUp() {
- final Eid eid = new EidBuilder().setAddress(
- new Ipv4Builder().setIpv4(
- new Ipv4Address("192.168.2.1"))
- .build())
+ final Eid eid = new EidBuilder()
+ .setAddressType(Ipv4Afi.class)
+ .setAddress(
+ new Ipv4Builder().setIpv4(
+ new Ipv4Address("192.168.2.1"))
+ .build())
.build();
mappingId = new MappingId("REMOTE");
@@ -79,11 +85,15 @@ public class RemoteMappingCustomizerTest extends WriterCustomizerTest implements
intf = new RemoteMappingBuilder()
.setEid(
eid)
- .setLocatorList(new NegativeMappingBuilder().setMapReplyAction(MapReplyAction.Drop).build())
+ .setLocatorList(new NegativeMappingBuilder()
+ .setMapReply(new MapReplyBuilder().setMapReplyAction(MapReplyAction.Drop).build()).build())
.build();
- id = InstanceIdentifier.builder(Lisp.class).child(EidTable.class)
+ id = InstanceIdentifier.builder(Lisp.class)
+ .child(LispFeatureData.class)
+ .child(EidTable.class)
.child(VniTable.class, new VniTableKey(25L))
+ .child(VrfSubtable.class)
.child(RemoteMappings.class)
.child(RemoteMapping.class, key).build();
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizerTest.java
index 126498304..4df89dfa3 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizerTest.java
@@ -1,86 +1,87 @@
package io.fd.honeycomb.lisp.translate.write;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
+
+import static org.junit.Assert.fail;
import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+import com.google.common.base.Optional;
+import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
import org.junit.Before;
import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtableBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispEidTableAddDelMap;
-import io.fd.vpp.jvpp.core.dto.LispEidTableAddDelMapReply;
-
public class VniTableCustomizerTest extends WriterCustomizerTest {
- @Captor
- private ArgumentCaptor<LispEidTableAddDelMap> requestCaptor;
-
private VniTableCustomizer customizer;
- private InstanceIdentifier<VniTable> emptyId;
-
- private VniTable emptyData;
+ private InstanceIdentifier<VniTable> validId;
private VniTable validData;
@Before
public void init() {
+ initMocks(this);
customizer = new VniTableCustomizer(api);
- emptyId = InstanceIdentifier.create(VniTable.class);
-
- emptyData = new VniTableBuilder().build();
- validData = new VniTableBuilder().setTableId(2L).setVirtualNetworkIdentifier(3L).build();
+ validId = InstanceIdentifier.create(VniTable.class);
+ validData = new VniTableBuilder()
+ .setVrfSubtable(new VrfSubtableBuilder()
+ .build()).build();
+ }
- when(api.lispEidTableAddDelMap(any())).thenReturn(future(new LispEidTableAddDelMapReply()));
+ @Test
+ public void testWriteSuccessfull() {
+ whenReadAfterReturnValid();
+ try {
+ customizer.writeCurrentAttributes(validId, validData, writeContext);
+ } catch (Exception e) {
+ fail("Test should pass without exception");
+ }
}
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesEmptyData() throws Exception {
- customizer.writeCurrentAttributes(emptyId, emptyData, writeContext);
+ @Test(expected = IllegalStateException.class)
+ public void testWriteFailed() throws WriteFailedException {
+ whenReadAfterReturnInvalid();
+ customizer.writeCurrentAttributes(validId, validData, writeContext);
}
+ @Test(expected = UnsupportedOperationException.class)
+ public void testUpdate() throws WriteFailedException {
+ customizer.updateCurrentAttributes(validId, validData, validData, writeContext);
+ }
@Test
- public void testWriteCurrentAttributes() throws Exception {
- customizer.writeCurrentAttributes(emptyId, validData, writeContext);
- verify(api, times(1)).lispEidTableAddDelMap(requestCaptor.capture());
- verifyRequest(requestCaptor.getValue(), (byte) 1, 2L, 3L);
+ public void testDeleteSuccessfull() {
+ whenReadBeforeReturnValid();
+ try {
+ customizer.deleteCurrentAttributes(validId, validData, writeContext);
+ } catch (Exception e) {
+ fail("Test should pass without exception");
+ }
}
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdateCurrentAttributes() throws Exception {
- customizer.updateCurrentAttributes(emptyId, emptyData, emptyData, writeContext);
+ @Test(expected = IllegalStateException.class)
+ public void testDeleteFailed() throws WriteFailedException {
+ whenReadBeforeReturnInvalid();
+ customizer.deleteCurrentAttributes(validId, validData, writeContext);
}
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesEmptyData() throws Exception {
- customizer.deleteCurrentAttributes(emptyId, emptyData, writeContext);
+ private void whenReadBeforeReturnValid() {
+ when(writeContext.readBefore(validId)).thenReturn(Optional.of(validData));
}
- @Test
- public void testDeleteCurrentAttributes() throws Exception {
- customizer.deleteCurrentAttributes(emptyId, validData, writeContext);
- verify(api, times(1)).lispEidTableAddDelMap(requestCaptor.capture());
- verifyRequest(requestCaptor.getValue(), (byte) 0, 2L, 3L);
+ private void whenReadBeforeReturnInvalid() {
+ when(writeContext.readBefore(validId)).thenReturn(Optional.absent());
}
- private static void verifyRequest(final LispEidTableAddDelMap request, final byte isAdd,
- final long dpTable,
- final long vni) {
- assertNotNull(request);
- assertEquals(isAdd, request.isAdd);
- assertEquals(dpTable, request.dpTable);
- assertEquals(vni, request.vni);
-
+ private void whenReadAfterReturnValid() {
+ when(writeContext.readAfter(validId)).thenReturn(Optional.of(validData));
}
+ private void whenReadAfterReturnInvalid() {
+ when(writeContext.readAfter(validId)).thenReturn(Optional.absent());
+ }
} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizerTest.java
new file mode 100644
index 000000000..a6c530430
--- /dev/null
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizerTest.java
@@ -0,0 +1,89 @@
+package io.fd.honeycomb.lisp.translate.write;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import io.fd.honeycomb.lisp.translate.write.trait.SubtableWriterTestCase;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.VppCallbackException;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.EidTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtableBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class VrfSubtableCustomizerTest extends SubtableWriterTestCase {
+
+ private VrfSubtableCustomizer customizer;
+ private InstanceIdentifier<VrfSubtable> validId;
+ private VrfSubtable validData;
+
+ @Before
+ public void init() {
+ customizer = new VrfSubtableCustomizer(api);
+ validId = InstanceIdentifier.create(EidTable.class).child(VniTable.class, new VniTableKey(12L))
+ .child(VrfSubtable.class);
+ validData = new VrfSubtableBuilder().setTableId(10L).build();
+ }
+
+ @Test
+ public void testWriteSuccessfull() throws WriteFailedException {
+ whenAddDelEidTableAddDelMapSuccess();
+
+ customizer.writeCurrentAttributes(validId, validData, writeContext);
+ verifyAddDelEidTableAddDelMapInvokedCorrectly(1, 12, 10, 0);
+ }
+
+ @Test
+ public void testWriteFailed() {
+ whenAddDelEidTableAddDelMapFail();
+
+ try {
+ customizer.writeCurrentAttributes(validId, validData, writeContext);
+ } catch (Exception e) {
+ assertTrue(e instanceof WriteFailedException);
+
+ final WriteFailedException realException = ((WriteFailedException) e);
+ assertEquals(validId, realException.getFailedId());
+ assertTrue(e.getCause() instanceof VppCallbackException);
+ return;
+ }
+
+ fail("Test should throw exception");
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void testUpdate() throws WriteFailedException {
+ customizer.updateCurrentAttributes(validId, validData, validData, writeContext);
+ }
+
+ @Test
+ public void testDeleteSuccessfull() throws WriteFailedException {
+ whenAddDelEidTableAddDelMapSuccess();
+
+ customizer.deleteCurrentAttributes(validId, validData, writeContext);
+ verifyAddDelEidTableAddDelMapInvokedCorrectly(0, 12, 10, 0);
+ }
+
+ @Test
+ public void testDeleteFailed() {
+ whenAddDelEidTableAddDelMapFail();
+
+ try {
+ customizer.deleteCurrentAttributes(validId, validData, writeContext);
+ } catch (Exception e) {
+ assertTrue(e instanceof WriteFailedException);
+
+ final WriteFailedException realException = ((WriteFailedException) e);
+ assertEquals(validId, realException.getFailedId());
+ assertTrue(e.getCause() instanceof VppCallbackException);
+ return;
+ }
+
+ fail("Test should throw exception");
+ }
+}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriterTestCase.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriterTestCase.java
new file mode 100644
index 000000000..453add9f0
--- /dev/null
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriterTestCase.java
@@ -0,0 +1,43 @@
+package io.fd.honeycomb.lisp.translate.write.trait;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
+import io.fd.vpp.jvpp.core.dto.LispEidTableAddDelMap;
+import io.fd.vpp.jvpp.core.dto.LispEidTableAddDelMapReply;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
+import org.mockito.Mockito;
+
+public class SubtableWriterTestCase extends WriterCustomizerTest implements SubtableWriter {
+ @Captor
+ protected ArgumentCaptor<LispEidTableAddDelMap> requestCaptor;
+
+
+ protected void verifyAddDelEidTableAddDelMapInvokedCorrectly(final int addDel, final int vni, final int tableId,
+ final int isL2) {
+ verify(api, times(1)).lispEidTableAddDelMap(requestCaptor.capture());
+
+ final LispEidTableAddDelMap request = requestCaptor.getValue();
+ assertNotNull(request);
+ assertEquals(addDel, request.isAdd);
+ assertEquals(vni, request.vni);
+ assertEquals(tableId, request.dpTable);
+ assertEquals(isL2, request.isL2);
+ }
+
+ protected void whenAddDelEidTableAddDelMapSuccess() {
+ when(api.lispEidTableAddDelMap(Mockito.any(LispEidTableAddDelMap.class)))
+ .thenReturn(future(new LispEidTableAddDelMapReply()));
+ }
+
+ protected void whenAddDelEidTableAddDelMapFail() {
+ when(api.lispEidTableAddDelMap(Mockito.any(LispEidTableAddDelMap.class)))
+ .thenReturn(failedFuture());
+ }
+}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/EidMappingContextHelper.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/EidMappingContextHelper.java
new file mode 100644
index 000000000..436cd6c25
--- /dev/null
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/EidMappingContextHelper.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * 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.
+ */
+
+package io.fd.honeycomb.lisp.util;
+
+
+import static org.mockito.Mockito.doReturn;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.Lists;
+import io.fd.honeycomb.translate.MappingContext;
+import java.util.List;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.Contexts;
+import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.EidMappingContext;
+import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.EidMappingContextKey;
+import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.Mappings;
+import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.MappingsBuilder;
+import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.Mapping;
+import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.MappingBuilder;
+import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.MappingKey;
+import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.MappingId;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+
+/**
+ * Utility class to stub {@link EidMappingContext}
+ *
+ * TODO - HONEYCOMB-237 - generalize logic for naming context and eid mapping context helper utils if possible
+ */
+public interface EidMappingContextHelper {
+
+ /**
+ * Creates {@link Mapping} for given data.
+ *
+ * @param eid to be mapped
+ * @param id to be mapped @return eid to id mapping
+ */
+ default Optional<Mapping> mapping(@Nonnull final Eid eid, final MappingId id) {
+ return Optional.of(new MappingBuilder().setEid(eid).setId(id).build());
+ }
+
+ /**
+ * Creates {@link KeyedInstanceIdentifier} for {@link Mapping} in {@link EidMappingContext}.
+ *
+ * @param id identificator of the mapping
+ * @param mappingContextName identificator of the mapping context
+ * @return identifier for the mapping
+ */
+ default KeyedInstanceIdentifier<Mapping, MappingKey> mappingIid(@Nonnull final MappingId id,
+ @Nonnull final String mappingContextName) {
+ return InstanceIdentifier.create(Contexts.class).child(EidMappingContext.class,
+ new EidMappingContextKey(mappingContextName)).child(Mappings.class)
+ .child(Mapping.class, new MappingKey(id));
+ }
+
+ /**
+ * Stubs {@link MappingContext#read} to include given mapping in {@link EidMappingContext}.
+ *
+ * @param mappingContext mock instance of {@link MappingContext}
+ * @param eid name of the mapping
+ * @param mappingName index to be mapped
+ * @param namingContextName name of the naming context
+ */
+ default void defineMapping(@Nonnull final MappingContext mappingContext, @Nonnull final Eid eid,
+ final MappingId mappingName, @Nonnull final String namingContextName) {
+ final KeyedInstanceIdentifier<Mapping, MappingKey> mappingIid = mappingIid(mappingName, namingContextName);
+ final InstanceIdentifier<Mappings> mappingsIid = mappingIid.firstIdentifierOf(Mappings.class);
+
+ final Optional<Mapping> singleMapping = mapping(eid, mappingName);
+ final List<Mapping> list = Common.getMappingList(mappingContext, mappingsIid);
+ list.add(singleMapping.get());
+
+ doReturn(Optional.of(new MappingsBuilder().setMapping(list).build())).when(mappingContext).read(mappingsIid);
+ doReturn(singleMapping).when(mappingContext).read(mappingIid);
+ }
+
+ final class Common {
+ private static List<Mapping> getMappingList(@Nonnull final MappingContext mappingContext,
+ @Nonnull final InstanceIdentifier<Mappings> mappingsIid) {
+ final Optional<Mappings> previousMappings = mappingContext.read(mappingsIid);
+ final MappingsBuilder mappingsBuilder;
+ if (previousMappings != null && previousMappings.isPresent()) {
+ mappingsBuilder = new MappingsBuilder(previousMappings.get());
+ } else {
+ mappingsBuilder = new MappingsBuilder();
+ mappingsBuilder.setMapping(Lists.newArrayList());
+ }
+ return mappingsBuilder.getMapping();
+ }
+ }
+}
diff --git a/lisp/lisp_postman_collection.json b/lisp/lisp_postman_collection.json
index 52a877a45..0fc5769a2 100644
--- a/lisp/lisp_postman_collection.json
+++ b/lisp/lisp_postman_collection.json
@@ -1,84 +1,101 @@
{
- "id": "17f4a6ba-221a-60ea-e94b-68499db39690",
- "name": "Lisp Postman Collection",
+ "id": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
+ "name": "Lisp Postman Collection L2",
"description": "",
"order": [
- "3d0b585e-e0e4-c935-7fb5-5ae2a6249486",
- "a3e6ab59-b7db-3646-6a99-bc566b6fdff3",
- "5586f041-e6ce-4880-622d-97920eaf08d3",
- "9f33c6a8-a7dd-6a69-b0a1-168667358750",
- "b7ae8529-0473-f75b-a5ef-60464d24e9cc",
- "b137bb03-3021-f50d-1bd4-fa7a14432185",
- "1935c2b2-7294-cb2d-0a47-7158f96d04bd",
- "760a2208-cbd1-ebde-e900-20b2bb20bb6f",
- "9c0da9fd-91c8-8c7a-4363-abe42b0728e7",
- "64caad14-93fe-ab8c-0a36-7fd1882aeaed",
- "155f3189-b996-270f-7344-98f8191ac9ee",
- "3c2b4f63-0dc5-ec0d-c18a-c9b31b4de9d5",
- "850d41a3-f66c-a6e1-6725-ed153c38f907",
- "196548ef-9c47-84ca-24e8-76c6ce5105ac",
- "5751639f-bb9c-584d-9101-b2e16786d98f",
- "92b788cb-4508-8cdc-2333-3c9fb623c467",
- "648a0ad4-d191-9cf2-e927-575f1590ae9d",
- "d61b9cdb-21b3-ac08-39d7-3591be4bb4c4",
- "712d3b04-98a1-3bbf-8dc7-bc6ec9b9e536",
- "3ab69ec3-9def-11d4-8335-c5e982885380",
- "fea7fab5-62ff-47dd-3a71-f26ed6e59084",
- "fe15ad81-26e6-f3d8-3c2f-b0695f878b59",
- "ce6967cf-45de-132e-2568-895a96086604",
- "011a9d16-e89f-24f4-c3b2-0148a7791e37",
- "08527cdf-9029-7057-b19c-6ab12ca3523f",
- "ed5ae97a-6882-5d02-cdaf-ca5a70d04211",
- "a896bc27-8d6e-e7d6-fd87-d9a0fa96bb08"
+ "41e942ed-eea2-5c77-8e2d-c0adead79741",
+ "27153df9-e0d5-1d23-4eb5-62d412ed181b",
+ "706257fe-47ce-c0ca-ccd5-0e5cfdb1becb",
+ "b269cb03-c0fc-aa68-c730-b126274dde78",
+ "0025c271-1d7c-4fe7-6f98-803c6db92d19",
+ "fa912ebd-2381-1892-2b27-c01780ba1b9c",
+ "60d70464-6b98-fa69-f405-631c0c525be5",
+ "e6f90d4d-a68e-ab51-5b63-93e3c6f99bc1",
+ "f65b7beb-a746-dc7d-d27d-3b39fa95ea56",
+ "1b0fd1f1-17f3-8de6-acf7-d9cd7f2c0b70",
+ "d3dde4b1-56df-b489-53d9-a3edee6c4bd3",
+ "70ab7906-c783-ae9f-487e-28505dace49c",
+ "07e6f197-3b13-095e-9525-176167e3b5a4",
+ "1d57c0aa-a7bd-cb15-27c3-2f56c608d0ca",
+ "9efbb933-5389-bee4-8e2f-a82fcdc1151d",
+ "41798cf0-8fa1-ab54-815c-4ae37024aaf0",
+ "121017cd-63f8-231d-5676-f8e2d4f2961f",
+ "22132e1d-44aa-e5e5-8787-f82cfdac424f",
+ "4f3d5d14-e397-5dca-bcf3-c64585fab175",
+ "b5e76988-aee4-19d1-3781-8ab7784af1ab",
+ "b5e65290-0729-7089-ca3a-7de7454f58fa",
+ "107a0853-c530-eb1a-0a3c-bcc382f1bc60",
+ "577ba8a1-67b5-571f-903a-f44908c0d656",
+ "591d677e-7f6e-aed1-3097-7a913378f943",
+ "e67f634f-81b6-4bb4-a013-6516e7585804",
+ "b546cbd7-b598-b419-4dab-b747ea444f23",
+ "d75a1d9c-51cb-7e8a-a1cb-8ae77b42fdec",
+ "daf43527-613d-af9e-71f0-8e81f31ea832",
+ "2eb7f81a-9ebb-12f2-64ff-304fc204169a",
+ "799ee5a8-5ca6-b09a-da84-ebe7ee7dc34b",
+ "97ff7203-2730-c03f-8582-6fb89857dc72",
+ "39cdad3e-55e7-c091-835a-7b8956ad528b",
+ "9ed49bf2-8146-b344-be60-916d788357d5",
+ "1b24f085-9c39-896b-2644-575ae3c2747a",
+ "63ada212-fd75-3897-8df4-94530d9ec162",
+ "bc81a430-c93c-d9ca-8427-1c4f4a73fcf9",
+ "8dfbeb8c-f27c-48df-9022-cc34489eb0c3",
+ "0f796bd9-87c8-0004-a3e7-25555d648b7e",
+ "ca05036e-787a-5e8b-bbfd-9b6fce61a893",
+ "f0fc317e-801b-89bf-5821-317f5c835d97",
+ "5e529c91-698a-9186-50e4-ee2b718825f8",
+ "bf3ad99c-0fa6-a566-742a-92a9a8404b8c",
+ "583ae0f4-cce5-4084-098d-e85e9dcd1d2e",
+ "25674e1b-4a81-6723-fa5d-e4e014b1f1d7"
],
"folders": [],
- "timestamp": 0,
+ "timestamp": 1475131541292,
"owner": "658985",
"public": false,
"published": false,
"requests": [
{
- "id": "011a9d16-e89f-24f4-c3b2-0148a7791e37",
+ "id": "0025c271-1d7c-4fe7-6f98-803c6db92d19",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp/map-resolvers/map-resolver/192.168.2.1",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/locator-sets/locator-set/loc_1",
"preRequestScript": null,
"pathVariables": {},
- "method": "DELETE",
+ "method": "PUT",
"data": [],
"dataMode": "raw",
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474459112850,
- "name": "Delete map resolver",
- "description": "",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475138985879,
+ "name": "Negative Case - Locator set loc_1 as empty",
+ "description": "Add new locator set\n\nequivalent of \n \n lisp_add_del_locator_set is_add 1 locator_set_name loc_1\n \ncan be verified with \n\n lisp_locator_set_dump\n\nRequests to add empty locator-sets will be rejected",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"map-resolver\":{\r\n \"ip-address\":\"192.168.2.1\"\r\n }\r\n}"
+ "rawModeData": "{ \n \"locator-set\":{ \n \"name\":\"loc_1\"\n }\n}"
},
{
- "id": "08527cdf-9029-7057-b19c-6ab12ca3523f",
+ "id": "07e6f197-3b13-095e-9525-176167e3b5a4",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp/locator-sets/locator-set/loc_1/interfaces/interface/GigabitEthernet0%2F8%2F0",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/vrf-subtable",
"preRequestScript": null,
"pathVariables": {},
- "method": "DELETE",
+ "method": "GET",
"data": [],
"dataMode": "raw",
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474459178849,
- "name": "Delete Locator for GigabitEthernet0/8/0",
+ "time": 1475134410953,
+ "name": "Get Vrf Subtable 10 Config",
"description": "",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"interface\":{\r\n \"interface-ref\":\"GigabitEthernet0/8/0\",\r\n \"priority\":\"2\",\r\n \"weight\":\"3\"\r\n }\r\n}"
+ "rawModeData": "{\r\n \"vni-table\":{\r\n \"virtual-network-identifier\":\"12\",\r\n \"vrf-subtable\":{\r\n \t\"table-id\":10\r\n }\r\n }\r\n}"
},
{
- "id": "155f3189-b996-270f-7344-98f8191ac9ee",
+ "id": "0f796bd9-87c8-0004-a3e7-25555d648b7e",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp/eid-table/vni-table/12/remote-mappings/remote-mapping/remote_map_1",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/vrf-subtable/remote-mappings/remote-mapping/remote_map_1/adjacencies/adjacency/adj_1",
"preRequestScript": null,
"pathVariables": {},
"method": "PUT",
@@ -87,36 +104,36 @@
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474456385780,
- "name": "Add remote mapping - negative mapping",
- "description": "Adds new remote mapping with negative mapping\n\nequivalent of \n\n lisp_add_del_remote_mapping is_add 1 vni 12 action 0 eid_type 0 eid 192.168.2.1 eid_len 32\n\ncan be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_len 32 vni 12 eid_type 0 eid 192.168.2.1 filter 2",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475223086280,
+ "name": "Add adjacency",
+ "description": "Add new adjacency\nThere must be existing local/remote mappings to specified eid's\n\nequivalent of \n\n lisp_add_del_adjacency is_add 1 vni 12 eid_type 0 deid 192.168.2.1 seid 192.168.2.3 deid_len 32 seid_len 32\n\nright now no dump variant is existing in api",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.5\"\r\n },\r\n \"map-reply-action\":\"no-action\"\r\n }\r\n}"
+ "rawModeData": "{\r\n \"adjacency\":{\r\n \"id\":\"adj_1\",\r\n \"local-eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \"remote-eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.5\"\r\n }\r\n }\r\n}"
},
{
- "id": "1935c2b2-7294-cb2d-0a47-7158f96d04bd",
+ "id": "107a0853-c530-eb1a-0a3c-bcc382f1bc60",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp/eid-table/vni-table/12",
+ "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/lisp-feature-data/eid-table/vni-table/12/vrf-subtable/local-mappings/local-mapping/loc_map_1",
"preRequestScript": null,
"pathVariables": {},
- "method": "PUT",
+ "method": "GET",
"data": [],
"dataMode": "raw",
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474450418618,
- "name": "Add VNI Table 12",
- "description": "Adds new VNI to VRF mapping\n\nequivalent of\n\n lisp_eid_table_add_del_map is_add 1 vni 12 dp_subtable 10 is_l2 0\n \ncan be verified with\n\n lisp_eid_table_map_dump",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475137494203,
+ "name": "Get local mapping loc_map_1 Operational",
+ "description": "Get details about local mapping\n\nequivalent of\n \n lisp_eid_table_dump eid_set 1 prefix_length 32 vni 12 eid_type 0 eid 192.168.2.1 filter 1",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"vni-table\":{\r\n \"virtual-network-identifier\":\"12\",\r\n \"table-id\":\"10\"\r\n }\r\n}"
+ "rawModeData": "{\r\n \"local-mapping\":{\r\n \"id\":\"loc_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:mac-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"mac\":\"00:11:22:00:11:22\"\r\n },\r\n \"locator-set\":\"loc_1\"\r\n }\r\n}"
},
{
- "id": "196548ef-9c47-84ca-24e8-76c6ce5105ac",
+ "id": "121017cd-63f8-231d-5676-f8e2d4f2961f",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/eid-table/vni-table/12/remote-mappings/remote-mapping/remote_map_2",
+ "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/lisp-feature-data/eid-table/vni-table/12/bridge-domain-subtable",
"preRequestScript": null,
"pathVariables": {},
"method": "GET",
@@ -125,36 +142,36 @@
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474459033368,
- "name": "Get remote mapping - positive mapping",
- "description": "Reads data of remote mapping\n\nequivalent of \n\n lisp_eid_table_dump eid_set 1 prefix_len 32 vni 12 eid_type 0 eid 192.168.2.3 filter 2",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475134503510,
+ "name": "Get Bridge Domain Subtable 10 Operational",
+ "description": "",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_2\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \r\n \"rlocs\":{\r\n \"locator\":{\r\n \"address\":\"192.168.2.2\",\r\n \"priority\":1,\r\n \"weight\":1\r\n }\r\n }\r\n \r\n }\r\n}"
+ "rawModeData": "{\r\n \"vni-table\":{\r\n \"virtual-network-identifier\":\"12\",\r\n \"vrf-subtable\":{\r\n \t\"table-id\":10\r\n }\r\n }\r\n}"
},
{
- "id": "3ab69ec3-9def-11d4-8335-c5e982885380",
+ "id": "1b0fd1f1-17f3-8de6-acf7-d9cd7f2c0b70",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp/pitr-cfg",
+ "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/lisp-feature-data/locator-sets/locator-set/loc_1/interface/GigabitEthernet0%2F8%2F0",
"preRequestScript": null,
"pathVariables": {},
- "method": "DELETE",
+ "method": "GET",
"data": [],
"dataMode": "raw",
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474459049747,
- "name": "Delete Pitr-cfg ",
- "description": "",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475133840119,
+ "name": "Get Locator for GigabitEthernet0/8/0",
+ "description": "Reads data of specified locator\n\nequivalent of\n\n lisp_locator_dump locator_set_index INDEX",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\n \"pitr-cfg\": {\n \"locator-set\": \"N/A\"\n } \n}"
+ "rawModeData": "{\r\n \"locator-set\":{\r\n \"name\":\"loc_1\"\r\n }\r\n}"
},
{
- "id": "3c2b4f63-0dc5-ec0d-c18a-c9b31b4de9d5",
+ "id": "1b24f085-9c39-896b-2644-575ae3c2747a",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/eid-table/vni-table/12/remote-mappings/remote-mapping/remote_map_1",
+ "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/lisp-feature-data/eid-table/vni-table/12/vrf-subtable/remote-mappings/remote-mapping/remote_map_3",
"preRequestScript": null,
"pathVariables": {},
"method": "GET",
@@ -163,15 +180,72 @@
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474459026088,
- "name": "Get remote mapping - negative mapping",
+ "time": 1475219335615,
+ "name": "Get remote positive mapping - Operational - Vrf",
"description": "can be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_len 32 vni 12 eid_type 0 eid 192.168.2.1 filter 2",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
"rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \r\n \"negative-mapping\":{\r\n \"map-reply-action\":\"no-action\"\r\n }\r\n \r\n }\r\n}"
},
{
- "id": "3d0b585e-e0e4-c935-7fb5-5ae2a6249486",
+ "id": "1d57c0aa-a7bd-cb15-27c3-2f56c608d0ca",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+ "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/lisp-feature-data/eid-table/vni-table/12/vrf-subtable",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "GET",
+ "data": [],
+ "dataMode": "raw",
+ "tests": null,
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1475134928876,
+ "name": "Get Vrf Subtable 10 Operational",
+ "description": "",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
+ "responses": [],
+ "rawModeData": "{\r\n \"vni-table\":{\r\n \"virtual-network-identifier\":\"12\",\r\n \"vrf-subtable\":{\r\n \t\"table-id\":10\r\n }\r\n }\r\n}"
+ },
+ {
+ "id": "22132e1d-44aa-e5e5-8787-f82cfdac424f",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "GET",
+ "data": [],
+ "dataMode": "raw",
+ "tests": null,
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1475136614423,
+ "name": "Get VNI Table 12 Config",
+ "description": "",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
+ "responses": [],
+ "rawModeData": "{\r\n \"vni-table\":{\r\n \"virtual-network-identifier\":\"12\"\r\n }\r\n}"
+ },
+ {
+ "id": "25674e1b-4a81-6723-fa5d-e4e014b1f1d7",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "DELETE",
+ "data": [],
+ "dataMode": "raw",
+ "tests": null,
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1474459135535,
+ "name": "Delete Lisp",
+ "description": "",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
+ "responses": [],
+ "rawModeData": "{\r\n \"lisp\":{\r\n \"enable\":\"true\",\r\n \"eid-table\": {\r\n \"vni-table\": [\r\n {\r\n \"virtual-network-identifier\": 0,\r\n \"remote-mappings\": {},\r\n \"table-id\": 0,\r\n \"local-mappings\": {},\r\n \"adjacencies\": {}\r\n }\r\n ]\r\n },\r\n \"pitr-cfg\":{\r\n \"locator-set\":\"N/A\"\r\n }\r\n } \r\n}"
+ },
+ {
+ "id": "27153df9-e0d5-1d23-4eb5-62d412ed181b",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
"url": "http://localhost:8183/restconf/config/lisp:lisp",
"preRequestScript": null,
@@ -182,17 +256,17 @@
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474450386064,
+ "time": 1475133618453,
"name": "Enable Lisp",
"description": "Enables Lisp feature\n\nequivalent of \n\n lisp_enable_disable is_en 1\n\ncan be verified with \n\n show_lisp_status",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"lisp\":{\r\n \"enable\":\"true\",\r\n \"eid-table\": {\r\n \"vni-table\": [\r\n {\r\n \"virtual-network-identifier\": 0,\r\n \"remote-mappings\": {},\r\n \"table-id\": 0,\r\n \"local-mappings\": {},\r\n \"adjacencies\": {}\r\n }\r\n ]\r\n },\r\n \"pitr-cfg\":{\r\n \"locator-set\":\"N/A\"\r\n }\r\n } \r\n}"
+ "rawModeData": "{\r\n \"lisp\":{\r\n \"enable\":\"true\"\r\n } \r\n}"
},
{
- "id": "5586f041-e6ce-4880-622d-97920eaf08d3",
+ "id": "2eb7f81a-9ebb-12f2-64ff-304fc204169a",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp/locator-sets/locator-set/loc_1",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/bridge-domain-subtable/remote-mappings/remote-mapping/remote_map_2",
"preRequestScript": null,
"pathVariables": {},
"method": "PUT",
@@ -201,17 +275,17 @@
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474455633364,
- "name": "Add Locator set loc_1 with locator for local0",
- "description": "Add new locator set\n\nequivalent of \n \n lisp_add_del_locator_set is_add 1 locator_set_name loc_1\n \ncan be verified with \n\n lisp_locator_set_dump\n\nRequests to add empty locator-sets will be rejected",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475227732347,
+ "name": "Add remote negative mapping - Bridge Domain",
+ "description": "Adds new remote mapping with negative mapping\n\nequivalent of \n\n lisp_add_del_remote_mapping is_add 1 vni 12 action 0 eid_type 0 eid 192.168.2.1 eid_len 32\n\ncan be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_len 32 vni 12 eid_type 0 eid 192.168.2.1 filter 2",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"locator-set\":{\r\n \"name\":\"loc_1\",\r\n \"interface\":{\r\n \"interface-ref\":\"local0\",\r\n \"priority\":\"2\",\r\n \"weight\":\"3\"\r\n }\r\n }\r\n}"
+ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_2\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:mac-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"mac\":\"aa:bb:aa:aa:aa:aa\"\r\n },\r\n \"map-reply\":{\r\n \t\"map-reply-action\":\"no-action\"\r\n }\r\n }\r\n}"
},
{
- "id": "5751639f-bb9c-584d-9101-b2e16786d98f",
+ "id": "39cdad3e-55e7-c091-835a-7b8956ad528b",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp/eid-table/vni-table/12/adjacencies/adjacency/adj_1",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/vrf-subtable/remote-mappings/remote-mapping/remote_map_3",
"preRequestScript": null,
"pathVariables": {},
"method": "PUT",
@@ -220,17 +294,17 @@
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474459038881,
- "name": "Add adjacency",
- "description": "Add new adjacency\nThere must be existing local/remote mappings to specified eid's\n\nequivalent of \n\n lisp_add_del_adjacency is_add 1 vni 12 eid_type 0 deid 192.168.2.1 seid 192.168.2.3 deid_len 32 seid_len 32\n\nright now no dump variant is existing in api",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475219301934,
+ "name": "Add remote positive mapping - VrfSubtable",
+ "description": "Adds new remote mapping with positive mapping\n\nequivalent of \n\n lisp_add_del_remote_mapping is_add 1 vni 12 rloc_num NR_OF_LOCATORS rlocs BINARY_DATA eid_type 0 eid 192.168.2.3 eid_len 32\n \nbinary data of remote locators should be in format\n\n [1 byte(ipv4/ipv6), 1 byte(priority), 1 byte(weight), 16 byte(address),...]\n\ncan be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_len 32 vni 12 eid_type 0 eid 192.168.2.3 filter 2",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"adjacency\":{\r\n \"id\":\"adj_1\",\r\n \"local-eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \"remote-eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.3\"\r\n }\r\n }\r\n}"
+ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_3\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.3\"\r\n },\r\n \r\n \"rlocs\":{\r\n \"locator\":{\r\n \"address\":\"192.168.2.2\",\r\n \"priority\":1,\r\n \"weight\":1\r\n }\r\n }\r\n \r\n }\r\n}"
},
{
- "id": "648a0ad4-d191-9cf2-e927-575f1590ae9d",
+ "id": "41798cf0-8fa1-ab54-815c-4ae37024aaf0",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/map-resolvers/map-resolver/192.168.2.1",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/bridge-domain-subtable",
"preRequestScript": null,
"pathVariables": {},
"method": "GET",
@@ -239,17 +313,36 @@
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474450398449,
- "name": "Get map resolver",
- "description": "Reads data of map resolver\n\nequivalent of \n\n lisp_map_resolver_dump",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475134484420,
+ "name": "Get Bridge Domain Subtable 10 Config",
+ "description": "",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"map-resolver\":{\r\n \"ip-address\":\"192.168.2.1\"\r\n }\r\n}"
+ "rawModeData": "{\r\n \"vni-table\":{\r\n \"virtual-network-identifier\":\"12\",\r\n \"vrf-subtable\":{\r\n \t\"table-id\":10\r\n }\r\n }\r\n}"
+ },
+ {
+ "id": "41e942ed-eea2-5c77-8e2d-c0adead79741",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+ "url": "http://localhost:8183/restconf/operational/eid-mapping-context:contexts",
+ "preRequestScript": "",
+ "pathVariables": {},
+ "method": "GET",
+ "data": [],
+ "dataMode": "raw",
+ "tests": "",
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1475218811779,
+ "name": "Eid mapping Context Read",
+ "description": "",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
+ "responses": [],
+ "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}"
},
{
- "id": "64caad14-93fe-ab8c-0a36-7fd1882aeaed",
+ "id": "4f3d5d14-e397-5dca-bcf3-c64585fab175",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/eid-table/vni-table/12/local-mappings/local-mapping/loc_map_1",
+ "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/lisp-feature-data/eid-table/vni-table/12",
"preRequestScript": null,
"pathVariables": {},
"method": "GET",
@@ -258,17 +351,36 @@
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474450479391,
- "name": "Get local mapping loc_map_1 ",
- "description": "Get details about local mapping\n\nequivalent of\n \n lisp_eid_table_dump eid_set 1 prefix_length 32 vni 12 eid_type 0 eid 192.168.2.1 filter 1",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475136655292,
+ "name": "Get VNI Table 12 Operational",
+ "description": "",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"local-mapping\":{\r\n \"id\":\"loc_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:mac-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"mac\":\"00:11:22:00:11:22\"\r\n },\r\n \"locator-set\":\"loc_1\"\r\n }\r\n}"
+ "rawModeData": "{\r\n \"vni-table\":{\r\n \"virtual-network-identifier\":\"12\"\r\n }\r\n}"
},
{
- "id": "712d3b04-98a1-3bbf-8dc7-bc6ec9b9e536",
+ "id": "577ba8a1-67b5-571f-903a-f44908c0d656",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/pitr-cfg",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/bridge-domain-subtable/local-mappings/local-mapping/loc_map_2",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "PUT",
+ "data": [],
+ "dataMode": "raw",
+ "tests": null,
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1475148700293,
+ "name": "Add local mapping loc_map_2 - Bridge Domain",
+ "description": "Adds new local mapping\n\nequivalent of \n\n lisp_add_del_local_eid is_add 1 eid_type 0 eid 192.168.2.1 prefix_len 32 vni 12 locator_set_name loc_1\n \ncan be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_length 32 vni 12 eid_type 0 eid 192.168.2.1 filter 1\n \n",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
+ "responses": [],
+ "rawModeData": "{\r\n \"local-mapping\":{\r\n \"id\":\"loc_map_2\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:mac-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"mac\":\"aa:aa:aa:aa:aa:aa\"\r\n },\r\n \"locator-set\":\"loc_1\"\r\n }\r\n}"
+ },
+ {
+ "id": "583ae0f4-cce5-4084-098d-e85e9dcd1d2e",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+ "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/lisp-feature-data/pitr-cfg",
"preRequestScript": null,
"pathVariables": {},
"method": "GET",
@@ -277,17 +389,55 @@
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474454986768,
+ "time": 1475225553971,
"name": "Get Pitr-cfg ",
"description": "Reads Pitr feature status\n\nequivalent of\n\n show_lisp_pitr",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
"rawModeData": "{\n \"pitr-cfg\": {\n \"locator-set\": \"N/A\"\n } \n}"
},
{
- "id": "760a2208-cbd1-ebde-e900-20b2bb20bb6f",
+ "id": "591d677e-7f6e-aed1-3097-7a913378f943",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/bridge-domain-subtable/local-mappings/local-mapping/loc_map_2",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "GET",
+ "data": [],
+ "dataMode": "raw",
+ "tests": null,
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1475150573935,
+ "name": "Add local mapping loc_map_2 Config",
+ "description": "Adds new local mapping\n\nequivalent of \n\n lisp_add_del_local_eid is_add 1 eid_type 0 eid 192.168.2.1 prefix_len 32 vni 12 locator_set_name loc_1\n \ncan be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_length 32 vni 12 eid_type 0 eid 192.168.2.1 filter 1\n \n",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
+ "responses": [],
+ "rawModeData": "{\r\n \"local-mapping\":{\r\n \"id\":\"loc_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \"locator-set\":\"loc_1\"\r\n }\r\n}"
+ },
+ {
+ "id": "5e529c91-698a-9186-50e4-ee2b718825f8",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+ "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/lisp-feature-data/map-resolvers/map-resolver/192.168.2.1",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "GET",
+ "data": [],
+ "dataMode": "raw",
+ "tests": null,
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1475223688546,
+ "name": "Get map resolver - Operational",
+ "description": "Reads data of map resolver\n\nequivalent of \n\n lisp_map_resolver_dump",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
+ "responses": [],
+ "rawModeData": "{\r\n \"map-resolver\":{\r\n \"ip-address\":\"192.168.2.1\"\r\n }\r\n}"
+ },
+ {
+ "id": "60d70464-6b98-fa69-f405-631c0c525be5",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/eid-table/vni-table/12",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/locator-sets/locator-set/loc_1",
"preRequestScript": null,
"pathVariables": {},
"method": "GET",
@@ -296,17 +446,17 @@
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474450424782,
- "name": "Get VNI Table 12 ",
- "description": "Reads mapping for VNI 12\n\nequivalent of \n\n lisp_eid_table_map_dump",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475133885528,
+ "name": "Get Locator set loc_1 Config",
+ "description": "Add new locator set\n\nequivalent of \n \n lisp_add_del_locator_set is_add 1 locator_set_name loc_1\n \ncan be verified with \n\n lisp_locator_set_dump\n\nRequests to add empty locator-sets will be rejected",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"vni-table\":{\r\n \"virtual-network-identifier\":\"12\",\r\n \"table-id\":\"10\"\r\n }\r\n}"
+ "rawModeData": "{ \n \"locator-set\":{ \n \"name\":\"loc_1\",\n \"interface\":{ \n \"interface-ref\":\"local0\",\n \"priority\":\"2\",\n \"weight\":\"3\"\n }\n }\n}"
},
{
- "id": "850d41a3-f66c-a6e1-6725-ed153c38f907",
+ "id": "63ada212-fd75-3897-8df4-94530d9ec162",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp/eid-table/vni-table/12/remote-mappings/remote-mapping/remote_map_2",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/bridge-domain-subtable/remote-mappings/remote-mapping/remote_map_4",
"preRequestScript": null,
"pathVariables": {},
"method": "PUT",
@@ -315,36 +465,36 @@
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474452045506,
- "name": "Add remote mapping - positive mapping",
+ "time": 1475222635853,
+ "name": "Add remote positive mapping - Bridge Domain",
"description": "Adds new remote mapping with positive mapping\n\nequivalent of \n\n lisp_add_del_remote_mapping is_add 1 vni 12 rloc_num NR_OF_LOCATORS rlocs BINARY_DATA eid_type 0 eid 192.168.2.3 eid_len 32\n \nbinary data of remote locators should be in format\n\n [1 byte(ipv4/ipv6), 1 byte(priority), 1 byte(weight), 16 byte(address),...]\n\ncan be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_len 32 vni 12 eid_type 0 eid 192.168.2.3 filter 2",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_2\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.3\"\r\n },\r\n \r\n \"rlocs\":{\r\n \"locator\":{\r\n \"address\":\"192.168.2.2\",\r\n \"priority\":1,\r\n \"weight\":1\r\n }\r\n }\r\n \r\n }\r\n}"
+ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_4\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:mac-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"mac\":\"aa:bb:cc:aa:bb:cc\"\r\n },\r\n \r\n \"rlocs\":{\r\n \"locator\":{\r\n \"address\":\"192.168.2.3\",\r\n \"priority\":1,\r\n \"weight\":2\r\n }\r\n }\r\n \r\n }\r\n}"
},
{
- "id": "92b788cb-4508-8cdc-2333-3c9fb623c467",
+ "id": "706257fe-47ce-c0ca-ccd5-0e5cfdb1becb",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp/map-resolvers/map-resolver/192.168.2.1",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp",
"preRequestScript": null,
"pathVariables": {},
- "method": "PUT",
+ "method": "GET",
"data": [],
"dataMode": "raw",
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474448341758,
- "name": "Add map resolver",
- "description": "Adds new map resolver\n\nequivalent of\n\n lisp_add_del_map_resolver is_add 1 is_ipv6 0 ip_address 192.168.2.1\n\ncan be verified with\n \n lisp_map_resolver_dump",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475133788195,
+ "name": "Get Lisp Config",
+ "description": "",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"map-resolver\":{\r\n \"ip-address\":\"192.168.2.1\"\r\n }\r\n}"
+ "rawModeData": "{\r\n \"lisp\":{\r\n \"enable\":\"true\"\r\n } \r\n}"
},
{
- "id": "9c0da9fd-91c8-8c7a-4363-abe42b0728e7",
+ "id": "70ab7906-c783-ae9f-487e-28505dace49c",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp/eid-table/vni-table/12/local-mappings/local-mapping/loc_map_1",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/vrf-subtable",
"preRequestScript": null,
"pathVariables": {},
"method": "PUT",
@@ -353,17 +503,17 @@
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474450452811,
- "name": "Add local mapping loc_map_1 to vni table 12",
- "description": "Adds new local mapping\n\nequivalent of \n\n lisp_add_del_local_eid is_add 1 eid_type 0 eid 192.168.2.1 prefix_len 32 vni 12 locator_set_name loc_1\n \ncan be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_length 32 vni 12 eid_type 0 eid 192.168.2.1 filter 1\n \n",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475137137792,
+ "name": "Add Vrf Subtable 10",
+ "description": "",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"local-mapping\":{\r\n \"id\":\"loc_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \"locator-set\":\"loc_1\"\r\n }\r\n}"
+ "rawModeData": "{\r\n \"vrf-subtable\":{\r\n \t\"table-id\":10\r\n }\r\n}"
},
{
- "id": "9f33c6a8-a7dd-6a69-b0a1-168667358750",
+ "id": "799ee5a8-5ca6-b09a-da84-ebe7ee7dc34b",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/locator-sets",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/bridge-domain-subtable/remote-mappings/remote-mapping/remote_map_2",
"preRequestScript": null,
"pathVariables": {},
"method": "GET",
@@ -372,15 +522,91 @@
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474455042636,
- "name": "Get Locator set loc_1with locator for local0",
- "description": "Reads data of locator set \n\nequivalent of \n \n lisp_locator_set_dump",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475219098376,
+ "name": "Get remote negative mapping Config - Bridge Domain",
+ "description": "",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"lisp\":{\r\n \"enable\":\"true\"\r\n } \r\n}"
+ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_2\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:mac-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"mac\":\"aa:bb:aa:aa:aa:aa\"\r\n },\r\n \"map-reply-action\":\"no-action\"\r\n \r\n }\r\n}"
+ },
+ {
+ "id": "8dfbeb8c-f27c-48df-9022-cc34489eb0c3",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+ "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/lisp-feature-data/eid-table/vni-table/12/bridge-domain-subtable/remote-mappings/remote-mapping/remote_map_4",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "GET",
+ "data": [],
+ "dataMode": "raw",
+ "tests": null,
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1475222738545,
+ "name": "Get remote positive mapping - Operational - Bridge Domain",
+ "description": "can be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_len 32 vni 12 eid_type 0 eid 192.168.2.1 filter 2",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
+ "responses": [],
+ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \r\n \"negative-mapping\":{\r\n \"map-reply-action\":\"no-action\"\r\n }\r\n \r\n }\r\n}"
},
{
- "id": "a3e6ab59-b7db-3646-6a99-bc566b6fdff3",
+ "id": "97ff7203-2730-c03f-8582-6fb89857dc72",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+ "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/lisp-feature-data/eid-table/vni-table/12/bridge-domain-subtable/remote-mappings/remote-mapping/remote_map_2",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "GET",
+ "data": [],
+ "dataMode": "raw",
+ "tests": null,
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1475219116319,
+ "name": "Get remote negative mapping Operational - Bridge Domain",
+ "description": "",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
+ "responses": [],
+ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_2\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:mac-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"mac\":\"aa:bb:aa:aa:aa:aa\"\r\n },\r\n \"map-reply-action\":\"no-action\"\r\n \r\n }\r\n}"
+ },
+ {
+ "id": "9ed49bf2-8146-b344-be60-916d788357d5",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/vrf-subtable/remote-mappings/remote-mapping/remote_map_3",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "GET",
+ "data": [],
+ "dataMode": "raw",
+ "tests": null,
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1475219307858,
+ "name": "Get remote positive mapping - Config - Vrf",
+ "description": "can be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_len 32 vni 12 eid_type 0 eid 192.168.2.1 filter 2",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
+ "responses": [],
+ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \r\n \"negative-mapping\":{\r\n \"map-reply-action\":\"no-action\"\r\n }\r\n \r\n }\r\n}"
+ },
+ {
+ "id": "9efbb933-5389-bee4-8e2f-a82fcdc1151d",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/bridge-domain-subtable",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "PUT",
+ "data": [],
+ "dataMode": "raw",
+ "tests": null,
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1475137154754,
+ "name": "Add Bridge Domain Subtable testBD",
+ "description": "",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
+ "responses": [],
+ "rawModeData": "{\r\n\r\n \"bridge-domain-subtable\":{\r\n \t\"bridge-domain-ref\":testBD\r\n }\r\n}"
+ },
+ {
+ "id": "b269cb03-c0fc-aa68-c730-b126274dde78",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
"url": "http://localhost:8183/restconf/operational/lisp:lisp-state",
"preRequestScript": null,
@@ -392,35 +618,35 @@
"currentHelper": "normal",
"helperAttributes": {},
"time": 1474450438453,
- "name": "Get Lisp status",
+ "name": "Get Lisp Operational",
"description": "Reads status of lisp feature\n\nequivalent of \n\n show_lisp_status",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
"rawModeData": "{\r\n \"lisp\":{\r\n \"enable\":\"true\"\r\n } \r\n}"
},
{
- "id": "a896bc27-8d6e-e7d6-fd87-d9a0fa96bb08",
+ "id": "b546cbd7-b598-b419-4dab-b747ea444f23",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/vrf-subtable/remote-mappings/remote-mapping/remote_map_1",
"preRequestScript": null,
"pathVariables": {},
- "method": "DELETE",
+ "method": "PUT",
"data": [],
"dataMode": "raw",
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474459135535,
- "name": "Delete Lisp",
- "description": "",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475226601650,
+ "name": "Add remote negative mapping - Vrf",
+ "description": "Adds new remote mapping with negative mapping\n\nequivalent of \n\n lisp_add_del_remote_mapping is_add 1 vni 12 action 0 eid_type 0 eid 192.168.2.1 eid_len 32\n\ncan be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_len 32 vni 12 eid_type 0 eid 192.168.2.1 filter 2",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"lisp\":{\r\n \"enable\":\"true\",\r\n \"eid-table\": {\r\n \"vni-table\": [\r\n {\r\n \"virtual-network-identifier\": 0,\r\n \"remote-mappings\": {},\r\n \"table-id\": 0,\r\n \"local-mappings\": {},\r\n \"adjacencies\": {}\r\n }\r\n ]\r\n },\r\n \"pitr-cfg\":{\r\n \"locator-set\":\"N/A\"\r\n }\r\n } \r\n}"
+ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.5\"\r\n },\r\n \"map-reply\":{\r\n \t\"map-reply-action\":\"no-action\"\r\n }\r\n \r\n }\r\n}"
},
{
- "id": "b137bb03-3021-f50d-1bd4-fa7a14432185",
+ "id": "b5e65290-0729-7089-ca3a-7de7454f58fa",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/locator-sets/locator-set/loc_1/interface/GigabitEthernet0%2F8%2F0",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/vrf-subtable/local-mappings/local-mapping/loc_map_1",
"preRequestScript": null,
"pathVariables": {},
"method": "GET",
@@ -429,17 +655,17 @@
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474458949473,
- "name": "Get Locator for GigabitEthernet0/8/0",
- "description": "Reads data of specified locator\n\nequivalent of\n\n lisp_locator_dump locator_set_index INDEX",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475137503248,
+ "name": "Get local mapping loc_map_1 Config",
+ "description": "Get details about local mapping\n\nequivalent of\n \n lisp_eid_table_dump eid_set 1 prefix_length 32 vni 12 eid_type 0 eid 192.168.2.1 filter 1",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"locator-set\":{\r\n \"name\":\"loc_1\"\r\n }\r\n}"
+ "rawModeData": "{\r\n \"local-mapping\":{\r\n \"id\":\"loc_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:mac-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"mac\":\"00:11:22:00:11:22\"\r\n },\r\n \"locator-set\":\"loc_1\"\r\n }\r\n}"
},
{
- "id": "b7ae8529-0473-f75b-a5ef-60464d24e9cc",
+ "id": "b5e76988-aee4-19d1-3781-8ab7784af1ab",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp/locator-sets/locator-set/loc_1/interface/GigabitEthernet0%2F8%2F0",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/vrf-subtable/local-mappings/local-mapping/loc_map_1",
"preRequestScript": null,
"pathVariables": {},
"method": "PUT",
@@ -448,36 +674,36 @@
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474458942665,
- "name": "Add Locator for GigabitEthernet0/8/0",
- "description": "Add locator under locator-set\n\nequivalent of \n\n lisp_add_del_locator is_add 1 locator_set_name loc_1 sw_if_index INDEX priority 2 weight 3\n\ncan be verified with \n\n lisp_locator_dump locator_set_index INDEX ",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475137444102,
+ "name": "Add local mapping loc_map_1 - Vrf ",
+ "description": "Adds new local mapping\n\nequivalent of \n\n lisp_add_del_local_eid is_add 1 eid_type 0 eid 192.168.2.1 prefix_len 32 vni 12 locator_set_name loc_1\n \ncan be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_length 32 vni 12 eid_type 0 eid 192.168.2.1 filter 1\n \n",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"interface\":{\r\n \"interface-ref\":\"GigabitEthernet0/8/0\",\r\n \"priority\":\"2\",\r\n \"weight\":\"3\"\r\n }\r\n}"
+ "rawModeData": "{\r\n \"local-mapping\":{\r\n \"id\":\"loc_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \"locator-set\":\"loc_1\"\r\n }\r\n}"
},
{
- "id": "ce6967cf-45de-132e-2568-895a96086604",
+ "id": "bc81a430-c93c-d9ca-8427-1c4f4a73fcf9",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp/eid-table/vni-table/12/remote-mappings/remote-mapping/remote_map_2",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/bridge-domain-subtable/remote-mappings/remote-mapping/remote_map_4",
"preRequestScript": null,
"pathVariables": {},
- "method": "DELETE",
+ "method": "GET",
"data": [],
"dataMode": "raw",
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474459106266,
- "name": "Delete remote mapping - positive mapping",
- "description": "",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475222704179,
+ "name": "Get remote positive mapping - Config - Bridge Domain",
+ "description": "can be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_len 32 vni 12 eid_type 0 eid 192.168.2.1 filter 2",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_2\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \r\n \"rlocs\":{\r\n \"locator\":{\r\n \"address\":\"192.168.2.2\",\r\n \"priority\":1,\r\n \"weight\":1\r\n }\r\n }\r\n \r\n }\r\n}"
+ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \r\n \"negative-mapping\":{\r\n \"map-reply-action\":\"no-action\"\r\n }\r\n \r\n }\r\n}"
},
{
- "id": "d61b9cdb-21b3-ac08-39d7-3591be4bb4c4",
+ "id": "bf3ad99c-0fa6-a566-742a-92a9a8404b8c",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp/pitr-cfg",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/pitr-cfg",
"preRequestScript": null,
"pathVariables": {},
"method": "PUT",
@@ -486,69 +712,183 @@
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474457078258,
+ "time": 1475225530771,
"name": "Add Pitr-cfg",
"description": "Enable Pitr feature \n\nequivalent of \n\n lisp_pitr_set_locator_set is_add 1 ls_name loc_1\n \ncan be verified with\n\n show_lisp_pitr",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
"rawModeData": "{\n \"pitr-cfg\": {\n \"locator-set\": \"loc_1\"\n } \n}"
},
{
- "id": "ed5ae97a-6882-5d02-cdaf-ca5a70d04211",
+ "id": "ca05036e-787a-5e8b-bbfd-9b6fce61a893",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp/locator-sets/locator-set/loc_1",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/map-resolvers/map-resolver/192.168.2.1",
"preRequestScript": null,
"pathVariables": {},
- "method": "DELETE",
+ "method": "PUT",
"data": [],
"dataMode": "raw",
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474459130845,
- "name": "Delete Locator set loc_1",
- "description": "",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475224352204,
+ "name": "Add map resolver",
+ "description": "Reads data of map resolver\n\nequivalent of \n\n lisp_map_resolver_dump",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"locator-set\":{\r\n \"name\":\"loc_1\"\r\n }\r\n}"
+ "rawModeData": "{\r\n \"map-resolver\":{\r\n \"ip-address\":\"192.168.2.1\"\r\n }\r\n}"
},
{
- "id": "fe15ad81-26e6-f3d8-3c2f-b0695f878b59",
+ "id": "d3dde4b1-56df-b489-53d9-a3edee6c4bd3",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/eid-table/vni-table/12/remote-mappings/remote-mapping/remote_map_1",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12",
"preRequestScript": null,
"pathVariables": {},
- "method": "DELETE",
+ "method": "PUT",
"data": [],
"dataMode": "raw",
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474459069495,
- "name": "Delete remote mapping - negative mapping",
- "description": "",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475134063440,
+ "name": "Negative Case - Add VNI Table 12",
+ "description": "Adding empty vni reference is disallowed/not possible.\nIt can be added only if vrf-subtable/bridge-domain-subtable",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
- "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \r\n \"negative-mapping\":{\r\n \"map-reply-action\":\"no-action\"\r\n }\r\n \r\n }\r\n}"
+ "rawModeData": "{\r\n \"vni-table\":{\r\n \"virtual-network-identifier\":\"12\"\r\n }\r\n}"
},
{
- "id": "fea7fab5-62ff-47dd-3a71-f26ed6e59084",
+ "id": "d75a1d9c-51cb-7e8a-a1cb-8ae77b42fdec",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp/eid-table/vni-table/12/local-mappings/local-mapping/loc_map_1",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/vrf-subtable/remote-mappings/remote-mapping/remote_map_1",
"preRequestScript": null,
"pathVariables": {},
- "method": "DELETE",
+ "method": "GET",
"data": [],
"dataMode": "raw",
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
- "time": 1474459060636,
- "name": "Delete local mapping loc_map_1 ",
- "description": "",
- "collectionId": "17f4a6ba-221a-60ea-e94b-68499db39690",
+ "time": 1475150713113,
+ "name": "Get remote negative mapping Config - Vrf",
+ "description": "Reads data of remote mapping\n\nequivalent of \n\n lisp_eid_table_dump eid_set 1 prefix_len 32 vni 12 eid_type 0 eid 192.168.2.3 filter 2",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
+ "responses": [],
+ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_2\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \r\n \"rlocs\":{\r\n \"locator\":{\r\n \"address\":\"192.168.2.2\",\r\n \"priority\":1,\r\n \"weight\":1\r\n }\r\n }\r\n \r\n }\r\n}"
+ },
+ {
+ "id": "daf43527-613d-af9e-71f0-8e81f31ea832",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+ "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/lisp-feature-data/eid-table/vni-table/12/vrf-subtable/remote-mappings/remote-mapping/remote_map_1",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "GET",
+ "data": [],
+ "dataMode": "raw",
+ "tests": null,
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1475150722513,
+ "name": "Get remote negative mapping Operational - Vrf",
+ "description": "Reads data of remote mapping\n\nequivalent of \n\n lisp_eid_table_dump eid_set 1 prefix_len 32 vni 12 eid_type 0 eid 192.168.2.3 filter 2",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
+ "responses": [],
+ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_2\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \r\n \"rlocs\":{\r\n \"locator\":{\r\n \"address\":\"192.168.2.2\",\r\n \"priority\":1,\r\n \"weight\":1\r\n }\r\n }\r\n \r\n }\r\n}"
+ },
+ {
+ "id": "e67f634f-81b6-4bb4-a013-6516e7585804",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/vrf-subtable/local-mappings/local-mapping/loc_map_1",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "GET",
+ "data": [],
+ "dataMode": "raw",
+ "tests": null,
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1475138892237,
+ "name": "Add local mapping loc_map_2 Operational",
+ "description": "Adds new local mapping\n\nequivalent of \n\n lisp_add_del_local_eid is_add 1 eid_type 0 eid 192.168.2.1 prefix_len 32 vni 12 locator_set_name loc_1\n \ncan be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_length 32 vni 12 eid_type 0 eid 192.168.2.1 filter 1\n \n",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
"responses": [],
"rawModeData": "{\r\n \"local-mapping\":{\r\n \"id\":\"loc_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \"locator-set\":\"loc_1\"\r\n }\r\n}"
+ },
+ {
+ "id": "e6f90d4d-a68e-ab51-5b63-93e3c6f99bc1",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+ "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/lisp-feature-data/locator-sets",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "GET",
+ "data": [],
+ "dataMode": "raw",
+ "tests": null,
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1475133715227,
+ "name": "Get Locator set loc_1 Operational",
+ "description": "Reads data of locator set \n\nequivalent of \n \n lisp_locator_set_dump",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
+ "responses": [],
+ "rawModeData": "{\r\n \"lisp\":{\r\n \"enable\":\"true\"\r\n } \r\n}"
+ },
+ {
+ "id": "f0fc317e-801b-89bf-5821-317f5c835d97",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+ "url": "http://localhost:8183/restconf/state/lisp:lisp/lisp-feature-data/map-resolvers/map-resolver/192.168.2.1",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "GET",
+ "data": [],
+ "dataMode": "raw",
+ "tests": null,
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1475224400772,
+ "name": "Get map resolver - Config",
+ "description": "Adds new map resolver\n\nequivalent of\n\n lisp_add_del_map_resolver is_add 1 is_ipv6 0 ip_address 192.168.2.1\n\ncan be verified with\n \n lisp_map_resolver_dump",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
+ "responses": [],
+ "rawModeData": "{\r\n \"map-resolver\":{\r\n \"ip-address\":\"192.168.2.1\"\r\n }\r\n}"
+ },
+ {
+ "id": "f65b7beb-a746-dc7d-d27d-3b39fa95ea56",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/locator-sets/locator-set/loc_1/interface/GigabitEthernet0%2F8%2F0",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "PUT",
+ "data": [],
+ "dataMode": "raw",
+ "tests": null,
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1475133834259,
+ "name": "Add Locator for GigabitEthernet0/8/0",
+ "description": "Add locator under locator-set\n\nequivalent of \n\n lisp_add_del_locator is_add 1 locator_set_name loc_1 sw_if_index INDEX priority 2 weight 3\n\ncan be verified with \n\n lisp_locator_dump locator_set_index INDEX ",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
+ "responses": [],
+ "rawModeData": "{\r\n \"interface\":{\r\n \"interface-ref\":\"GigabitEthernet0/8/0\",\r\n \"priority\":\"2\",\r\n \"weight\":\"3\"\r\n }\r\n}"
+ },
+ {
+ "id": "fa912ebd-2381-1892-2b27-c01780ba1b9c",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+ "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/locator-sets/locator-set/loc_1",
+ "preRequestScript": null,
+ "pathVariables": {},
+ "method": "PUT",
+ "data": [],
+ "dataMode": "raw",
+ "tests": null,
+ "currentHelper": "normal",
+ "helperAttributes": {},
+ "time": 1475133686078,
+ "name": "Add Locator set loc_1 with locator for local0",
+ "description": "Add new locator set\n\nequivalent of \n \n lisp_add_del_locator_set is_add 1 locator_set_name loc_1\n \ncan be verified with \n\n lisp_locator_set_dump\n\nRequests to add empty locator-sets will be rejected",
+ "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
+ "responses": [],
+ "rawModeData": "{ \n \"locator-set\":{ \n \"name\":\"loc_1\",\n \"interface\":{ \n \"interface-ref\":\"local0\",\n \"priority\":\"2\",\n \"weight\":\"3\"\n }\n }\n}"
}
]
-} \ No newline at end of file
+}
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/AddressTranslator.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/AddressTranslator.java
index c716dd6f1..bb096d198 100644
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/AddressTranslator.java
+++ b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/AddressTranslator.java
@@ -39,7 +39,7 @@ public interface AddressTranslator extends Ipv4Translator, Ipv6Translator, MacTr
}
/**
- * Converts array bytes to {@link IpAddress}
+ * Converts array bytes to {@link IpAddress}.
*/
@Nonnull
default IpAddress arrayToIpAddress(boolean isIpv6, byte[] ip) {
@@ -50,6 +50,18 @@ public interface AddressTranslator extends Ipv4Translator, Ipv6Translator, MacTr
}
}
+ /**
+ * Converts array bytes to {@link IpAddress}
+ */
+ @Nonnull
+ default IpAddress arrayToIpAddressReversed(boolean isIpv6, byte[] ip) {
+ if (isIpv6) {
+ return new IpAddress(arrayToIpv6AddressNoZoneReversed(ip));
+ } else {
+ return new IpAddress(arrayToIpv4AddressNoZoneReversed(ip));
+ }
+ }
+
default IpAddress reverseAddress(@Nonnull final IpAddress address) {
//arrayToIpAdddress internaly reverts order
return arrayToIpAddress(isIpv6(address), ipAddressToArray(address));
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/MacTranslator.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/MacTranslator.java
index af26b11b2..a947f95c6 100644
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/MacTranslator.java
+++ b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/MacTranslator.java
@@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.Splitter;
+import java.util.Arrays;
import java.util.List;
import java.util.function.BiConsumer;
import javax.annotation.Nonnull;
@@ -64,17 +65,17 @@ public interface MacTranslator {
* Converts byte array to address string ,not separated with ":"
*/
default String byteArrayToMacUnseparated(byte[] address) {
- checkArgument(address.length == 6, "Illegal array length");
- return Hex.encodeHexString(address);
+ checkArgument(address.length >= 6, "Illegal array length");
+ return Hex.encodeHexString(Arrays.copyOf(address, 6));
}
/**
* Converts byte array to address string ,separated with ":"
*/
default String byteArrayToMacSeparated(byte[] address) {
- checkArgument(address.length == 6, "Illegal array length");
+ checkArgument(address.length >= 6, "Illegal array length");
- String unseparatedAddress = Hex.encodeHexString(address);
+ String unseparatedAddress = Hex.encodeHexString(Arrays.copyOf(address, 6));
String separated = "";
for (int i = 0; i < unseparatedAddress.length(); i = i + 2) {