summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaros Marsalek <mmarsale@cisco.com>2016-11-10 12:22:28 +0100
committerMaros Marsalek <mmarsale@cisco.com>2016-11-10 12:47:24 +0100
commit8e0c7007906730fe4547b0265a895ad8a322a7dc (patch)
treedbc3310da5c7b7083cc6b9ecffee633d2cf5cd7f
parentaa7e652e6105a6972d6c41ff0738cd9e31ce0188 (diff)
Remove hc2vpp codebase
Moved to a dedicated hc2vpp project in fd.io Change-Id: I03dc3b3029f21b127a00c69a86bcd8e467896241 Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
-rw-r--r--infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/cache/DumpCacheManagerTest.java (renamed from vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/cache/DumpCacheManagerTest.java)37
-rw-r--r--ioam/api/asciidoc/Readme.adoc3
-rw-r--r--ioam/api/pom.xml38
-rw-r--r--ioam/api/src/main/yang/ioam-sb-trace.yang184
-rw-r--r--ioam/asciidoc/Readme.adoc11
-rw-r--r--ioam/impl/asciidoc/Readme.adoc3
-rw-r--r--ioam/impl/pom.xml123
-rwxr-xr-xioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/VppIoamModule.java63
-rwxr-xr-xioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/config/IoamTraceWriterCustomizer.java134
-rwxr-xr-xioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/config/VppIoamWriterFactory.java49
-rwxr-xr-xioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/util/FutureJVppIoamCustomizer.java45
-rwxr-xr-xioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/util/JVppIoamProvider.java62
-rw-r--r--ioam/impl/src/test/java/io/fd/honeycomb/vppioam/impl/VppIoamModuleTest.java90
-rw-r--r--ioam/impl/src/test/java/io/fd/honeycomb/vppioam/impl/config/IoamTraceWriterCustomizerTest.java186
-rw-r--r--ioam/ioam_trace_postman_collection.json34
-rw-r--r--ioam/pom.xml56
-rw-r--r--lisp/api/asciidoc/Readme.adoc3
-rwxr-xr-xlisp/api/pom.xml56
-rw-r--r--lisp/api/src/main/yang/adjacencies-identification-context.yang65
-rw-r--r--lisp/api/src/main/yang/eid-mapping-context.yang44
-rwxr-xr-xlisp/api/src/main/yang/ietf-lisp-address-types.yang677
-rwxr-xr-xlisp/api/src/main/yang/lisp.yang353
-rwxr-xr-xlisp/asciidoc/Readme.adoc3
-rw-r--r--lisp/lisp2vpp/asciidoc/Readme.adoc3
-rwxr-xr-xlisp/lisp2vpp/pom.xml118
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/LispModule.java87
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/cfgattrs/LispConfiguration.java59
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/AdjacenciesMappingContext.java174
-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.java227
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizer.java192
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizer.java104
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizer.java147
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java82
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LispStateCustomizer.java100
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java181
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizer.java136
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java125
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizer.java83
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java301
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java125
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizer.java98
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/LocatorDumpParams.java47
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/MappingsDumpParams.java191
-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.java101
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/EidTableReaderFactory.java183
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LispStateReaderFactory.java83
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LocatorSetsReaderFactory.java71
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/MapResolversReaderFactory.java58
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorReader.java46
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorSetReader.java41
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducer.java72
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReader.java90
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java57
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidMetadataProvider.java68
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidTranslator.java343
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizer.java183
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainSubtableCustomizer.java97
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizer.java122
-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/LispCustomizer.java97
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizer.java141
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java107
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/MapResolverCustomizer.java99
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizer.java104
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizer.java236
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizer.java83
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizer.java82
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/AbstractLispWriterFactoryBase.java94
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LispWriterFactory.java82
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LocatorSetsWriterFactory.java64
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/MapResolversWriterFactory.java55
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/VniTableWriterFactory.java158
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriter.java82
-rw-r--r--lisp/lisp2vpp/src/main/resources/honeycomb-minimal-resources/config/lisp.json2
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/LispModuleTest.java101
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/AdjacenciesMappingContextTest.java184
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/EidMappingContextTest.java108
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/AdjacencyData.java59
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizerTest.java145
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizerTest.java118
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizerTest.java118
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizerTest.java164
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LispStateCustomizerTest.java68
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizerTest.java144
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizerTest.java96
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizerTest.java102
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizerTest.java77
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizerTest.java241
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizerTest.java121
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizerTest.java121
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducerTest.java186
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReaderTest.java95
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReaderTestCase.java97
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/util/EidTranslatorTest.java60
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizerTest.java243
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainCustomizerTest.java108
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizerTest.java160
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java146
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LispCustomizerTest.java111
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizerTest.java163
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizerTest.java148
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/MapResolverCustomizerTest.java103
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizerTest.java117
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizerTest.java155
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizerTest.java103
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizerTest.java105
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriterTestCase.java59
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/AdjacencyMappingContextTestHelper.java126
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/EidMappingContextHelper.java116
-rw-r--r--lisp/lisp2vpp/src/test/resources/adjacencies-identification-context.json29
-rw-r--r--lisp/lisp_postman_collection.json955
-rwxr-xr-xlisp/pom.xml58
-rw-r--r--nat/asciidoc/Readme.adoc12
-rw-r--r--nat/nat-api/asciidoc/Readme.adoc11
-rw-r--r--nat/nat-api/pom.xml61
-rw-r--r--nat/nat-api/src/main/yang/ietf-nat.yang1074
-rw-r--r--nat/nat-api/src/main/yang/interface-nat.yang44
-rw-r--r--nat/nat-api/src/main/yang/nat-context.yang64
-rw-r--r--nat/nat2vpp/asciidoc/Readme.adoc3
-rw-r--r--nat/nat2vpp/pom.xml126
-rw-r--r--nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/NatModule.java72
-rwxr-xr-xnat/nat2vpp/src/main/java/io/fd/honeycomb/nat/jvpp/JVppSnatProvider.java60
-rw-r--r--nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ExternalIpPoolCustomizer.java150
-rw-r--r--nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/MappingEntryCustomizer.java171
-rw-r--r--nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/NatInstanceCustomizer.java114
-rw-r--r--nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/NatReaderFactory.java90
-rw-r--r--nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ifc/AbstractInterfaceNatCustomizer.java75
-rw-r--r--nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ifc/IfcNatReaderFactory.java96
-rw-r--r--nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ifc/InterfaceInboundNatCustomizer.java95
-rw-r--r--nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ifc/InterfaceOutboundNatCustomizer.java86
-rw-r--r--nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/util/MappingEntryContext.java210
-rw-r--r--nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ExternalIpPoolCustomizer.java92
-rw-r--r--nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/MappingEntryCustomizer.java182
-rw-r--r--nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/NatInstaceCustomizer.java53
-rw-r--r--nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/NatWriterFactory.java73
-rw-r--r--nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ifc/AbstractInterfaceNatCustomizer.java105
-rw-r--r--nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ifc/IfcNatWriterFactory.java62
-rw-r--r--nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ifc/InterfaceInboundNatCustomizer.java44
-rw-r--r--nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ifc/InterfaceOutboundNatCustomizer.java44
-rw-r--r--nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/NatModuleTest.java123
-rw-r--r--nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/read/ifc/InterfaceInboundNatCustomizerTest.java107
-rw-r--r--nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/read/ifc/InterfaceOutboundNatCustomizerTest.java94
-rw-r--r--nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/util/MappingEntryContextTest.java198
-rw-r--r--nat/nat2vpp/src/test/resources/nat.json3
-rw-r--r--nat/pom.xml56
-rw-r--r--nat/postman_rest_collection.json222
-rw-r--r--nsh/api/asciidoc/Readme.adoc3
-rw-r--r--nsh/api/pom.xml59
-rw-r--r--nsh/api/src/main/yang/vpp-nsh.yang303
-rw-r--r--nsh/asciidoc/Readme.adoc14
-rw-r--r--nsh/impl/asciidoc/Readme.adoc3
-rw-r--r--nsh/impl/pom.xml130
-rwxr-xr-xnsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/VppNshModule.java73
-rwxr-xr-xnsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshEntryWriterCustomizer.java151
-rwxr-xr-xnsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshMapWriterCustomizer.java138
-rwxr-xr-xnsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/VppNshWriterFactory.java81
-rwxr-xr-xnsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizer.java214
-rwxr-xr-xnsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshMapReaderCustomizer.java205
-rwxr-xr-xnsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/VppNshReaderFactory.java78
-rwxr-xr-xnsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/util/FutureJVppNshCustomizer.java44
-rwxr-xr-xnsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/util/JVppNshProvider.java60
-rw-r--r--nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/VppNshModuleTest.java111
-rw-r--r--nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/config/NshEntryWriterCustomizerTest.java185
-rw-r--r--nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/config/NshMapWriterCustomizerTest.java181
-rw-r--r--nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizerTest.java154
-rw-r--r--nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/oper/NshMapReaderCustomizerTest.java146
-rw-r--r--nsh/nsh_postman_collection.json343
-rw-r--r--nsh/pom.xml56
-rw-r--r--packaging/deb/.gitignore5
-rwxr-xr-xpackaging/deb/common/debuild.sh8
-rwxr-xr-xpackaging/deb/common/prepare.sh45
-rw-r--r--packaging/deb/trusty/debian/compat1
-rw-r--r--packaging/deb/trusty/debian/control14
-rw-r--r--packaging/deb/trusty/debian/copyright23
-rwxr-xr-xpackaging/deb/trusty/debian/rules32
-rw-r--r--packaging/deb/trusty/debian/source/format1
-rwxr-xr-xpackaging/deb/trusty/debuild.sh7
-rw-r--r--packaging/deb/trusty/honeycomb.conf8
-rw-r--r--packaging/deb/xenial/debian/control14
-rwxr-xr-xpackaging/deb/xenial/debian/rules32
-rwxr-xr-xpackaging/deb/xenial/debuild.sh8
-rw-r--r--packaging/deb/xenial/honeycomb.service10
-rw-r--r--packaging/rpm/.gitignore6
-rw-r--r--packaging/rpm/honeycomb.service10
-rw-r--r--packaging/rpm/honeycomb.spec66
-rwxr-xr-xpackaging/rpm/release2
-rwxr-xr-xpackaging/rpm/rpmbuild.sh13
-rwxr-xr-xpackaging/rpm/version2
-rw-r--r--pom.xml8
-rw-r--r--release-notes/pom.xml8
-rw-r--r--release-notes/src/main/asciidoc/devel_guide/devel_guide.adoc3
-rw-r--r--release-notes/src/main/asciidoc/devel_guide/devel_plugin_vpp_tutorial.adoc617
-rw-r--r--release-notes/src/main/asciidoc/install_guide/install_from_available_archives.adoc14
-rw-r--r--release-notes/src/main/asciidoc/install_guide/install_from_available_binary_packages.adoc66
-rw-r--r--release-notes/src/main/asciidoc/install_guide/install_guide.adoc23
-rw-r--r--release-notes/src/main/asciidoc/install_guide/install_manual_build.adoc206
-rw-r--r--release-notes/src/main/asciidoc/release_notes.adoc16
-rw-r--r--release-notes/src/main/asciidoc/user_guide/user_guide.adoc54
-rw-r--r--release-notes/src/main/asciidoc/user_guide/user_honeycomb_and_ODL.adoc76
-rw-r--r--release-notes/src/main/asciidoc/user_guide/user_running_honeycomb.adoc119
-rw-r--r--release-notes/src/main/asciidoc/user_guide/user_troubleshooting.adoc20
-rw-r--r--routing/asciidoc/Readme.adoc3
-rw-r--r--routing/pom.xml60
-rw-r--r--routing/routing-api/asciidoc/Readme.adoc8
-rw-r--r--routing/routing-api/pom.xml70
-rw-r--r--routing/routing-api/src/main/yang/ietf-ipv4-unicast-routing.yang421
-rw-r--r--routing/routing-api/src/main/yang/ietf-ipv6-unicast-routing.yang822
-rw-r--r--routing/routing-api/src/main/yang/ietf-routing.yang1030
-rw-r--r--routing/routing-api/src/main/yang/vpp-routing.yang59
-rw-r--r--v3po/api/asciidoc/Readme.adoc3
-rw-r--r--v3po/api/pom.xml58
-rw-r--r--v3po/api/src/main/yang/dot1q-types.yang237
-rw-r--r--v3po/api/src/main/yang/ietf-access-control-list.yang208
-rw-r--r--v3po/api/src/main/yang/ietf-acl-context.yang67
-rw-r--r--v3po/api/src/main/yang/ietf-ip.yang742
-rw-r--r--v3po/api/src/main/yang/ietf-packet-fields.yang180
-rw-r--r--v3po/api/src/main/yang/pbb-types.yang81
-rw-r--r--v3po/api/src/main/yang/v3po-context.yang29
-rw-r--r--v3po/api/src/main/yang/v3po.yang716
-rw-r--r--v3po/api/src/main/yang/vpp-acl.yang160
-rw-r--r--v3po/api/src/main/yang/vpp-classifier-context.yang68
-rw-r--r--v3po/api/src/main/yang/vpp-classifier.yang215
-rw-r--r--v3po/api/src/main/yang/vpp-pbb.yang32
-rw-r--r--v3po/api/src/main/yang/vpp-vlan.yang443
-rw-r--r--v3po/asciidoc/Readme.adoc7
-rw-r--r--v3po/pom.xml56
-rw-r--r--v3po/postman_rest_collection.json2065
-rw-r--r--v3po/v3po2vpp/asciidoc/Readme.adoc103
-rw-r--r--v3po/v3po2vpp/pom.xml122
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/AclWriterFactory.java58
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/DisabledInterfacesManager.java106
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/EgressIetfAClWriterProvider.java39
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/IngressIetfAClWriterProvider.java39
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesStateReaderFactory.java187
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesWriterFactory.java245
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/SubinterfaceAugmentationWriterFactory.java158
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/SubinterfaceStateAugmentationReaderFactory.java118
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/V3poModule.java92
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppClassifierHoneycombWriterFactory.java66
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppClassifierReaderFactory.java60
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppHoneycombWriterFactory.java81
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppStateHoneycombReaderFactory.java90
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/cfgattrs/V3poConfiguration.java24
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/EthernetCustomizer.java58
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/GreCustomizer.java166
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterconnectionWriteUtils.java159
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceCustomizer.java121
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/L2Customizer.java89
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/LoopbackCustomizer.java112
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ProxyArpCustomizer.java108
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizer.java136
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizer.java122
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizer.java193
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceL2Customizer.java100
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/TapCustomizer.java182
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizer.java157
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanCustomizer.java192
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanGpeCustomizer.java194
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/IetfAclWriter.java106
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AbstractIetfAclWriter.java251
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceEthWriter.java85
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIp4Writer.java94
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIp6Writer.java99
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIpAndEthWriter.java129
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceWriter.java54
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AclTableContextManager.java53
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AclTableContextManagerImpl.java68
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AclTranslator.java74
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/IetfAclWriter.java47
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/Ip4AclTranslator.java149
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/Ip6AclTranslator.java182
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/L2AclTranslator.java90
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/PortPair.java126
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/EgressIetfAclWriter.java120
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/IetfAclCustomizer.java85
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/SubInterfaceIetfAclCustomizer.java105
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AclCustomizer.java83
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AclWriter.java73
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclCustomizer.java89
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IngressIetfAclWriter.java118
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizer.java93
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceIetfAclCustomizer.java108
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizer.java151
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4Customizer.java56
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4NeighbourCustomizer.java126
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4Writer.java108
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv6Customizer.java55
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java131
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/subnet/validation/SubnetValidationException.java50
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/subnet/validation/SubnetValidator.java80
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/pbb/PbbRewriteCustomizer.java130
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/EthernetCustomizer.java108
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/GreCustomizer.java157
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterconnectionReadUtils.java125
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizer.java232
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceDataTranslator.java287
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/L2Customizer.java116
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ProxyArpCustomizer.java79
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/RewriteCustomizer.java147
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizer.java264
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceL2Customizer.java93
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/TapCustomizer.java143
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VhostUserCustomizer.java154
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanCustomizer.java162
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanGpeCustomizer.java168
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/AclCustomizer.java118
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/AclReader.java60
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/SubInterfaceAclCustomizer.java120
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4AddressCustomizer.java166
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4Customizer.java59
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4NeighbourCustomizer.java73
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4Reader.java84
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv6Customizer.java66
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizer.java143
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/dump/params/AddressDumpParams.java44
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/pbb/PbbRewriteStateCustomizer.java57
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducer.java163
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizer.java118
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizer.java137
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizer.java129
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionReader.java207
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriter.java165
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableReader.java171
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriter.java149
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppClassifierContextManager.java106
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppClassifierContextManagerImpl.java181
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeReader.java45
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeWriter.java79
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/BridgeDomainCustomizer.java181
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizer.java165
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java82
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/vpp/util/SubInterfaceUtils.java52
-rw-r--r--v3po/v3po2vpp/src/main/resources/honeycomb-minimal-resources/config/v3po.json2
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/DisabledInterfacesManagerTest.java109
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/V3poModuleTest.java96
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/AclCustomizerTest.java156
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/GreCustomizerTest.java197
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceCustomizerTest.java116
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceTypeTestUtils.java40
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/L2CustomizerTest.java150
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/LoopbackCustomizerTest.java105
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ProxyArpCustomizerTest.java97
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizerTest.java198
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizerTest.java97
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizerTest.java258
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceL2CustomizerTest.java109
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/TapCustomizerTest.java129
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizerTest.java205
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanCustomizerTest.java227
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanGpeCustomizerTest.java218
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/AclWriterTest.java103
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceEthWriterTest.java94
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIp4WriterTest.java189
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIp6WriterTest.java201
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIpAndEthWriterTest.java123
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIpWriterTestUtils.java34
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AclTableContextManagerImplTest.java62
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/PortPairTest.java114
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/EgressIetfAclWriterTest.java151
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/IetfAclCustomizerTest.java114
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/SubInterfaceIetfAclCustomizerTest.java130
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclCustomizerTest.java205
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizerTest.java140
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceIetfAclCustomizerTest.java154
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizerTest.java338
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4NeighbourCustomizerTest.java120
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizerTest.java144
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/subnet/validation/SubnetValidatorTest.java88
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/pbb/PbbRewriteCustomizerTest.java312
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/EthernetCustomizerTest.java90
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/GreCustomizerTest.java131
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizerTest.java201
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceDataTranslatorTest.java55
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/L2CustomizerTest.java145
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/RewriteCustomizerTest.java114
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizerTest.java129
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceL2CustomizerTest.java80
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/TapCustomizerTest.java98
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/VhostUserCustomizerTest.java115
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanCustomizerTest.java133
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanGpeCustomizerTest.java278
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/AclCustomizerTest.java99
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/SubInterfaceAclCustomizerTest.java108
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4AddressCustomizerTest.java284
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4CustomizerTest.java44
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizerTest.java247
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/pbb/PbbRewriteStateCustomizerTest.java35
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducerTest.java112
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java171
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java276
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizerTest.java190
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionReaderTest.java116
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriterTest.java179
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableReaderTest.java126
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriterTest.java181
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppClassifierContextManagerImplTest.java163
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/BridgeDomainCustomizerTest.java47
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizerTest.java124
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizerTest.java60
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VppStateTest.java326
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/vpp/util/SubinterfaceUtilsTest.java32
-rw-r--r--vpp-common/asciidoc/Readme.adoc3
-rw-r--r--vpp-common/naming-context-api/asciidoc/Readme.adoc3
-rw-r--r--vpp-common/naming-context-api/pom.xml31
-rw-r--r--vpp-common/naming-context-api/src/main/yang/naming-context.yang44
-rw-r--r--vpp-common/naming-context-impl/asciidoc/Readme.adoc3
-rw-r--r--vpp-common/naming-context-impl/pom.xml50
-rw-r--r--vpp-common/naming-context-impl/src/main/java/io/fd/honeycomb/vpp/context/ContextsReaderFactory.java45
-rw-r--r--vpp-common/pom.xml61
-rw-r--r--vpp-common/vpp-common-integration/asciidoc/Readme.adoc3
-rw-r--r--vpp-common/vpp-common-integration/pom.xml116
-rw-r--r--vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/ContextsReaderFactoryProvider.java40
-rw-r--r--vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/JVppCoreProvider.java61
-rw-r--r--vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/JVppRegistryProvider.java72
-rw-r--r--vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/VppCommonModule.java44
-rw-r--r--vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/VppConfigAttributes.java28
-rw-r--r--vpp-common/vpp-common-integration/src/main/resources/honeycomb-minimal-resources/config/jvpp.json3
-rw-r--r--vpp-common/vpp-common-integration/src/test/java/io/fd/honeycomb/vpp/common/integration/VppCommonModuleTest.java53
-rw-r--r--vpp-common/vpp-common-integration/src/test/resources/jvpp.json3
-rw-r--r--vpp-common/vpp-impl-parent/asciidoc/Readme.adoc3
-rw-r--r--vpp-common/vpp-impl-parent/pom.xml56
-rw-r--r--vpp-common/vpp-translate-test/asciidoc/Readme.adoc3
-rw-r--r--vpp-common/vpp-translate-test/pom.xml74
-rw-r--r--vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/read/JvppDumpExecutorTest.java91
-rw-r--r--vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/read/ListReaderCustomizerTest.java60
-rw-r--r--vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/read/ReaderCustomizerTest.java106
-rw-r--r--vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/util/FutureProducer.java63
-rw-r--r--vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/util/InterfaceDumpHelper.java45
-rw-r--r--vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/util/NamingContextHelper.java119
-rw-r--r--vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/write/WriterCustomizerTest.java63
-rw-r--r--vpp-common/vpp-translate-utils/asciidoc/Readme.adoc3
-rw-r--r--vpp-common/vpp-translate-utils/pom.xml97
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/AbstractInterfaceTypeCustomizer.java100
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/AddressTranslator.java85
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/ByteDataTranslator.java79
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/FutureJVppCustomizer.java44
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/Ipv4AddressRange.java121
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/Ipv4Translator.java137
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/Ipv6Translator.java158
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/JvppReplyConsumer.java194
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/MacTranslator.java110
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/NamingContext.java179
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/ReadTimeoutException.java33
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/TagRewriteOperation.java88
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/VppStatusListener.java46
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/WriteTimeoutException.java33
-rw-r--r--vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/AddressTranslatorTest.java36
-rw-r--r--vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/ByteDataTranslatorTest.java52
-rw-r--r--vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/Ipv4AddressRangeTest.java57
-rw-r--r--vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/Ipv4TranslatorTest.java49
-rw-r--r--vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/Ipv6TranslatorTest.java56
-rw-r--r--vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/JvppReplyConsumerTest.java76
-rw-r--r--vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/MacTranslatorTest.java89
-rw-r--r--vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/VppStatusListenerTest.java37
-rw-r--r--vpp-integration/asciidoc/Readme.adoc3
-rw-r--r--vpp-integration/minimal-distribution/asciidoc/Readme.adoc3
-rw-r--r--vpp-integration/minimal-distribution/pom.xml107
-rw-r--r--vpp-integration/pom.xml56
461 files changed, 43 insertions, 55475 deletions
diff --git a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/cache/DumpCacheManagerTest.java b/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/cache/DumpCacheManagerTest.java
index 81a47e8a2..3639439ce 100644
--- a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/cache/DumpCacheManagerTest.java
+++ b/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/cache/DumpCacheManagerTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.fd.honeycomb.translate.vpp.util.cache;
+package io.fd.honeycomb.translate.util.read.cache;
import static io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor.NO_PARAMS;
import static org.junit.Assert.assertEquals;
@@ -23,13 +23,9 @@ import static org.mockito.Mockito.when;
import com.google.common.base.Optional;
import io.fd.honeycomb.translate.ModificationCache;
import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.util.read.cache.CacheKeyFactory;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpPostProcessingFunction;
-import io.fd.honeycomb.translate.util.read.cache.IdentifierCacheKeyFactory;
-import io.fd.vpp.jvpp.core.dto.IpDetails;
-import io.fd.vpp.jvpp.core.dto.IpDetailsReplyDump;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
@@ -149,4 +145,29 @@ public class DumpCacheManagerTest {
return modified;
};
}
+
+ private static final class IpDetailsReplyDump {
+ List<IpDetails> ipDetails = new ArrayList<>();
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final IpDetailsReplyDump that = (IpDetailsReplyDump) o;
+ return Objects.equals(ipDetails, that.ipDetails);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(ipDetails);
+ }
+ }
+
+ private static final class IpDetails {
+ int swIfIndex;
+ }
} \ No newline at end of file
diff --git a/ioam/api/asciidoc/Readme.adoc b/ioam/api/asciidoc/Readme.adoc
deleted file mode 100644
index fe70e0a4a..000000000
--- a/ioam/api/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= vppioam-api
-
-Overview of vppioam-api
diff --git a/ioam/api/pom.xml b/ioam/api/pom.xml
deleted file mode 100644
index ebdadea05..000000000
--- a/ioam/api/pom.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>api-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../../common/api-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.vppioam</groupId>
- <artifactId>vppioam-api</artifactId>
- <name>${project.artifactId}</name>
- <version>1.16.12-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-interfaces</artifactId>
- </dependency>
- </dependencies>
-</project>
diff --git a/ioam/api/src/main/yang/ioam-sb-trace.yang b/ioam/api/src/main/yang/ioam-sb-trace.yang
deleted file mode 100644
index 731fda96d..000000000
--- a/ioam/api/src/main/yang/ioam-sb-trace.yang
+++ /dev/null
@@ -1,184 +0,0 @@
-module ioam-sb-trace {
- yang-version 1;
- namespace "urn:cisco:params:xml:ns:yang:ioam-sb-trace";
- prefix ioam-sb-trace;
-
- import ietf-interfaces { prefix ietf-if; }
-
- organization "Cisco Systems, Inc.";
-
- contact
- "Author: Srihari Raghavan
- srihari@cisco.com";
-
- description
- "This YANG module defines a component that describing the
- configuration of in-band OAM device configuration for
- trace elements.
- ";
-
- revision 2016-05-12 {
- description
- "Base model for in-band OAM trace device configuration.";
- reference
- "";
- }
-
- container ioam-trace-config {
- description
- "Device specific configuration for in-band OAM trace.";
-
- list trace-config {
- key "trace-config-name";
- ordered-by system;
- description
- "Set of ioam trace configurations that group parameters
- required to enable iOAM6 tracing at a service node";
-
- leaf trace-config-name {
- type string {
- length "0..255";
- }
- mandatory true;
- description
- "Unique identifier for each node tracing configuration";
- }
-
- leaf acl-name {
- type string;
- description
- "The ACL name associated to classify and apply this
- trace config";
- }
-
- leaf trace-type {
- type uint8 {
- range "3|7|9|17|25|31";
- }
-
- mandatory true;
- description
- "Trace type that defines the trace element variant. Moving
- from LSB to MSB, each bit represents node_id, ingress_if_id,
- egress_if_id, timestamp, app_data and others are undefined.
- Currently, the supported values are 0x03, 0x07, 0x09,
- 0x11, 0x19 and 0x1f.";
- }
-
- leaf trace-num-elt {
- type uint8;
-
- mandatory true;
- description
- "Number of trace elements to be inserted in the tracing
- options.";
- }
-
- leaf trace-tsp {
- type enumeration {
- enum seconds {
- value 0;
- description "Timestamp in seconds.";
- }
- enum milliseconds {
- value 1;
- description "Timestamp in milli seconds.";
- }
- enum microseconds {
- value 2;
- description "Timestamp in micro seconds.";
- }
- enum nanoseconds {
- value 3;
- description "Timestamp in nano seconds.";
- }
- }
-
- mandatory true;
- description
- "This field depicts the delay domain of the trace path,
- whether it is in seconds, milliseconds, microseconds
- or nanoseconds.";
- }
-
- leaf trace-op {
- type enumeration {
- enum add {
- value 0;
- description "Add new and fill trace information.";
- }
- enum update {
- value 1;
- description "Update existing trace information.";
- }
- enum remove {
- value 2;
- description "Decap or remove existing trace information.";
- }
- }
-
- mandatory true;
- description
- "The type of trace element operation that the service node
- handling this profile should do. The options are to add the
- trace elements, update the trace elements or to remove the
- trace elements.";
- }
-
- leaf trace-app-data {
- type uint32;
- description
- "Application specific data to be added by the node";
- }
-
- leaf node-id {
- type uint32;
- mandatory true;
- description
- "iOAM Service Node id assigned to this node";
- }
-
- list node-interfaces {
- key "index";
- ordered-by system;
- description
- "List of node's interfaces on which the trace configuration
- need to be applied. Typically this is to all interfaces
- but can be filtered.";
-
- leaf index {
- type uint32;
- mandatory true;
- description
- "Index for the interfaces list";
- }
-
- leaf intf-name {
- type ietf-if:interface-ref;
- mandatory true;
- description
- "Instance of ietf-interfaces:interface-ref";
- }
- }
-
- /*** links to ioam-sb-data-export ***/
- leaf data-export-profile-name {
- type string;
- description
- "The data export profile name with server information to
- send data to.";
- }
-
- /*** Transport encap profiles. Not used currently ***/
- leaf transport-encap-profile-name {
- type string;
- description
- "The transport encap profile name with sub configurations for
- handling transport encap.";
- }
-/*** list: end ***/
- }
-/*** container: end ***/
- }
-/*** module: end ***/
-}
diff --git a/ioam/asciidoc/Readme.adoc b/ioam/asciidoc/Readme.adoc
deleted file mode 100644
index c0e30bd70..000000000
--- a/ioam/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,11 +0,0 @@
-= ioam
-
-This is a Honeycomb plugin providing mapping code between HC and iOAM Plugin APIs.
-
-== Usage
-
-Refer to ioam_postman_collection.json for sample requests.
-
-In order to make HC iOAM plugin work, need to start vpp and load ioam plugin first.
-
-At this point in time, iOAM trace plugin configurations are supported.
diff --git a/ioam/impl/asciidoc/Readme.adoc b/ioam/impl/asciidoc/Readme.adoc
deleted file mode 100644
index 6660fc457..000000000
--- a/ioam/impl/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= vppioam-impl
-
-Overview of vppioam-impl
diff --git a/ioam/impl/pom.xml b/ioam/impl/pom.xml
deleted file mode 100644
index dd106d003..000000000
--- a/ioam/impl/pom.xml
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>impl-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../../common/impl-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.vppioam</groupId>
- <artifactId>vppioam-impl</artifactId>
- <name>${project.artifactId}</name>
- <version>1.16.12-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <properties>
- <ioam.version>1.0-SNAPSHOT</ioam.version>
- <jvpp.version>16.12-SNAPSHOT</jvpp.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>vppioam-api</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- </dependency>
- <dependency>
- <groupId>net.jmob</groupId>
- <artifactId>guice.conf</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-multibindings</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-testlib</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-all</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>translate-impl</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>translate-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>notification-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>cfg-init</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.vpp</groupId>
- <artifactId>jvpp-registry</artifactId>
- <version>${jvpp.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.vpp</groupId>
- <artifactId>jvpp-ioam-trace</artifactId>
- <version>${ioam.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-translate-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-translate-test</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>minimal-distribution</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/ioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/VppIoamModule.java b/ioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/VppIoamModule.java
deleted file mode 100755
index 34975d71d..000000000
--- a/ioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/VppIoamModule.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.vppioam.impl;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.inject.AbstractModule;
-import com.google.inject.Singleton;
-import com.google.inject.multibindings.Multibinder;
-import com.google.inject.name.Names;
-import com.google.inject.Provider;
-import io.fd.honeycomb.data.init.DataTreeInitializer;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import io.fd.honeycomb.vppioam.impl.config.VppIoamWriterFactory;
-import io.fd.honeycomb.vppioam.impl.util.JVppIoamProvider;
-import io.fd.vpp.jvpp.ioamtrace.future.FutureJVppIoamtrace;
-import io.fd.vpp.jvpp.ioamtrace.future.FutureJVppIoamtraceFacade;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Glue code necessary for Honeycomb distribution to pick up the plugin classes
- */
-public final class VppIoamModule extends AbstractModule {
-
- private static final Logger LOG = LoggerFactory.getLogger(VppIoamModule.class);
- private final Class<? extends Provider<FutureJVppIoamtraceFacade>> jvppIoamProviderClass;
-
- public VppIoamModule() {
- this(JVppIoamProvider.class);
- }
-
- @VisibleForTesting
- VppIoamModule(Class<? extends Provider<FutureJVppIoamtraceFacade>> jvppIoamProvider) {
- this.jvppIoamProviderClass = jvppIoamProvider;
- }
-
- @Override
- protected void configure() {
- LOG.debug("Installing iOAM module");
-
- // Bind to Plugin's JVPP.
- bind(FutureJVppIoamtrace.class).toProvider(jvppIoamProviderClass).in(Singleton.class);
-
- // Below are classes picked up by HC framework
- Multibinder.newSetBinder(binder(), WriterFactory.class).addBinding().to(VppIoamWriterFactory.class);
-
- LOG.debug("Module iOAM successfully configured");
- }
-}
diff --git a/ioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/config/IoamTraceWriterCustomizer.java b/ioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/config/IoamTraceWriterCustomizer.java
deleted file mode 100755
index 8a45e87df..000000000
--- a/ioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/config/IoamTraceWriterCustomizer.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * 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.vppioam.impl.config;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-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.honeycomb.vppioam.impl.util.FutureJVppIoamCustomizer;
-
-import io.fd.vpp.jvpp.ioamtrace.dto.TraceProfileAdd;
-import io.fd.vpp.jvpp.ioamtrace.dto.TraceProfileAddReply;
-import io.fd.vpp.jvpp.ioamtrace.dto.TraceProfileDel;
-import io.fd.vpp.jvpp.ioamtrace.dto.TraceProfileDelReply;
-import io.fd.vpp.jvpp.ioamtrace.future.FutureJVppIoamtrace;
-
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.IoamTraceConfig;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.ioam.trace.config.TraceConfig;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.ioam.trace.config.TraceConfig.TraceOp;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.ioam.trace.config.trace.config.NodeInterfaces;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.ioam.trace.config.TraceConfigKey;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.ioam.trace.config.trace.config.NodeInterfaces;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Writer customizer responsible for Ioam Trace create/delete.
- */
-public class IoamTraceWriterCustomizer extends FutureJVppIoamCustomizer
- implements ListWriterCustomizer<TraceConfig, TraceConfigKey>, ByteDataTranslator, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(IoamTraceWriterCustomizer.class);
-
- public IoamTraceWriterCustomizer(@Nonnull final FutureJVppIoamtrace futureJVppIoam) {
- super(futureJVppIoam);
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<TraceConfig> id,
- @Nonnull final TraceConfig dataCurr,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
-
- try {
- addTraceConfig(dataCurr, writeContext, id);
- } catch (Exception exCreate) {
- LOG.error("Add Trace Configuration failed", exCreate);
- throw new WriteFailedException.CreateFailedException(id, dataCurr, exCreate);
- }
-
- LOG.debug("Trace config added iid={}, added {}", id, dataCurr);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<TraceConfig> id,
- @Nonnull final TraceConfig dataBefore,
- @Nonnull final TraceConfig dataAfter,
- @Nonnull final WriteContext ctx) throws WriteFailedException {
- try {
- deleteTraceConfig(dataBefore, id);
- addTraceConfig(dataAfter, ctx, id);
- } catch (Exception exUpdate) {
- LOG.error("Update Trace Configuration failed", exUpdate);
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, exUpdate);
- }
-
- LOG.debug("Trace config updated {}", dataAfter);
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<TraceConfig> id,
- @Nonnull final TraceConfig dataBefore,
- @Nonnull final WriteContext ctx) throws WriteFailedException {
- try {
- deleteTraceConfig(dataBefore, id);
- } catch (Exception exDelete) {
- LOG.error("Delete Trace Configuration failed", exDelete);
- throw new WriteFailedException.DeleteFailedException(id, exDelete);
- }
-
- LOG.debug("Trace config deleted:iid={} dataBefore={}", id, dataBefore);
- }
-
- public TraceProfileAddReply addTraceConfig(TraceConfig traceConfig,
- WriteContext ctx,
- final InstanceIdentifier<TraceConfig> id) throws Exception {
-
- TraceProfileAdd traceProfileAdd = new TraceProfileAdd();
- traceProfileAdd.traceType = (byte) traceConfig.getTraceType().byteValue(); //trace type
- traceProfileAdd.numElts = (byte) traceConfig.getTraceNumElt().byteValue(); //num of elts
- traceProfileAdd.traceTsp = (byte) traceConfig.getTraceTsp().getIntValue(); // tsp
- traceProfileAdd.appData = (int) traceConfig.getTraceAppData().intValue(); // appdata
- traceProfileAdd.nodeId = (int) traceConfig.getNodeId().intValue(); // nodeid
-
- /* Write to VPP */
- final TraceProfileAddReply reply = getReplyForWrite((getFutureJVppIoam().
- traceProfileAdd(traceProfileAdd).
- toCompletableFuture()), id);
- return reply;
- }
-
- public TraceProfileDelReply deleteTraceConfig(TraceConfig dataBefore,
- final InstanceIdentifier<TraceConfig> id) throws Exception {
- TraceProfileDel del = new TraceProfileDel();
-
- /* Write to VPP */
- TraceProfileDelReply reply = getReplyForWrite((getFutureJVppIoam().
- traceProfileDel(del).toCompletableFuture()), id);
-
- return reply;
- }
-}
diff --git a/ioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/config/VppIoamWriterFactory.java b/ioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/config/VppIoamWriterFactory.java
deleted file mode 100755
index 40311cd8c..000000000
--- a/ioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/config/VppIoamWriterFactory.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.vppioam.impl.config;
-
-import com.google.common.collect.Sets;
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import io.fd.honeycomb.translate.impl.write.GenericListWriter;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-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.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.IoamTraceConfig;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.ioam.trace.config.TraceConfig;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.ioamtrace.future.FutureJVppIoamtrace;
-
-public class VppIoamWriterFactory implements WriterFactory {
-
- @Nonnull
- private final FutureJVppIoamtrace jvppIoam;
-
- @Inject
- public VppIoamWriterFactory(@Nonnull final FutureJVppIoamtrace jvppIoam) {
- this.jvppIoam = jvppIoam;
- }
-
- @Override
- public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
- // TraceConfig
- final InstanceIdentifier<TraceConfig> trId =
- InstanceIdentifier.create(IoamTraceConfig.class).child(TraceConfig.class);
- registry.add(new GenericListWriter<>(trId, new IoamTraceWriterCustomizer(jvppIoam)));
- }
-}
diff --git a/ioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/util/FutureJVppIoamCustomizer.java b/ioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/util/FutureJVppIoamCustomizer.java
deleted file mode 100755
index b60581a1b..000000000
--- a/ioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/util/FutureJVppIoamCustomizer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.vppioam.impl.util;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import io.fd.vpp.jvpp.ioamtrace.future.FutureJVppIoamtrace;
-import javax.annotation.Nonnull;
-
-/**
- * Abstract utility to hold the IoamApi reference.
- */
-@Beta
-public abstract class FutureJVppIoamCustomizer {
-
- private final FutureJVppIoamtrace futureJVppIoam;
-
- public FutureJVppIoamCustomizer(@Nonnull final FutureJVppIoamtrace futureJVppIoam) {
- this.futureJVppIoam = Preconditions.checkNotNull(futureJVppIoam,
- "futureJVppIoam should not be null");
- }
-
- /**
- * Get IoamApi reference
- *
- * @return IoamApi reference
- */
- public FutureJVppIoamtrace getFutureJVppIoam() {
- return futureJVppIoam;
- }
-}
diff --git a/ioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/util/JVppIoamProvider.java b/ioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/util/JVppIoamProvider.java
deleted file mode 100755
index d95266457..000000000
--- a/ioam/impl/src/main/java/io/fd/honeycomb/vppioam/impl/util/JVppIoamProvider.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and 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.vppioam.impl.util;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import io.fd.honeycomb.infra.distro.ProviderTrait;
-import java.io.IOException;
-import io.fd.vpp.jvpp.JVppRegistry;
-import io.fd.vpp.jvpp.ioamtrace.future.FutureJVppIoamtrace;
-import io.fd.vpp.jvpp.ioamtrace.future.FutureJVppIoamtraceFacade;
-import io.fd.vpp.jvpp.ioamtrace.JVppIoamtraceImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Provides future API for jvpp-ioam plugin. Must be a singleton due to shutdown hook usage.
- * Registers shutdown hook to free plugin's resources on shutdown.
- */
-public final class JVppIoamProvider extends ProviderTrait<FutureJVppIoamtraceFacade> {
-
- private static final Logger LOG = LoggerFactory.getLogger(JVppIoamProvider.class);
-
- @Inject
- private JVppRegistry registry;
-
- @Override
- protected FutureJVppIoamtraceFacade create() {
- try {
- final JVppIoamtraceImpl jVppIoamTr = new JVppIoamtraceImpl();
- // Free jvpp-ioam plugin's resources on shutdown
- Runtime.getRuntime().addShutdownHook(new Thread() {
- @Override
- public void run() {
- LOG.info("Unloading jvpp-ioam plugin");
- jVppIoamTr.close();
- LOG.info("Successfully unloaded jvpp-ioam plugin");
- }
- });
-
- LOG.debug("Successfully loaded jvpp-ioam plugin");
- return new FutureJVppIoamtraceFacade(registry, jVppIoamTr);
- } catch (IOException e) {
- throw new IllegalStateException("Unable to open VPP management connection", e);
- }
- }
-}
-
diff --git a/ioam/impl/src/test/java/io/fd/honeycomb/vppioam/impl/VppIoamModuleTest.java b/ioam/impl/src/test/java/io/fd/honeycomb/vppioam/impl/VppIoamModuleTest.java
deleted file mode 100644
index d9176d39d..000000000
--- a/ioam/impl/src/test/java/io/fd/honeycomb/vppioam/impl/VppIoamModuleTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.vppioam.impl;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.Matchers.empty;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import com.google.inject.Guice;
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.google.inject.name.Named;
-import com.google.inject.testing.fieldbinder.Bind;
-import com.google.inject.testing.fieldbinder.BoundFieldModule;
-import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import java.util.HashSet;
-import java.util.Set;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-
-import io.fd.vpp.jvpp.ioamtrace.future.FutureJVppIoamtraceFacade;
-import io.fd.vpp.jvpp.JVppRegistry;
-
-
-public class VppIoamModuleTest {
-
- @Named("honeycomb-context")
- @Bind
- @Mock
- private DataBroker honeycombContext;
-
- @Named("honeycomb-initializer")
- @Bind
- @Mock
- private DataBroker honeycombInitializer;
-
- @Bind
- @Mock
- private JVppRegistry registry;
-
- @Inject
- private Set<WriterFactory> writerFactories = new HashSet<>();
-
- @Before
- public void setUp() throws Exception {
-
- initMocks(this);
-
- Guice.createInjector(new VppIoamModule(MockJVppIoamProvider.class), BoundFieldModule.of(this)).injectMembers(this);
- }
-
- @Test
- public void testWriterFactories() throws Exception {
- assertThat(writerFactories, is(not(empty())));
-
- final FlatWriterRegistryBuilder registryBuilder = new FlatWriterRegistryBuilder();
- writerFactories.forEach(factory -> factory.init(registryBuilder));
- assertNotNull(registryBuilder.build());
- }
-
- private static final class MockJVppIoamProvider implements Provider<FutureJVppIoamtraceFacade> {
-
- @Override
- public FutureJVppIoamtraceFacade get() {
- return mock(FutureJVppIoamtraceFacade.class);
- }
- }
-}
-
diff --git a/ioam/impl/src/test/java/io/fd/honeycomb/vppioam/impl/config/IoamTraceWriterCustomizerTest.java b/ioam/impl/src/test/java/io/fd/honeycomb/vppioam/impl/config/IoamTraceWriterCustomizerTest.java
deleted file mode 100644
index 8c182dd01..000000000
--- a/ioam/impl/src/test/java/io/fd/honeycomb/vppioam/impl/config/IoamTraceWriterCustomizerTest.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * 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.vppioam.impl.config;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-import io.fd.vpp.jvpp.ioamtrace.dto.TraceProfileAdd;
-import io.fd.vpp.jvpp.ioamtrace.dto.TraceProfileAddReply;
-import io.fd.vpp.jvpp.ioamtrace.dto.TraceProfileDel;
-import io.fd.vpp.jvpp.ioamtrace.dto.TraceProfileDelReply;
-import io.fd.vpp.jvpp.ioamtrace.future.FutureJVppIoamtrace;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.VppCallbackException;
-
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.IoamTraceConfig;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.ioam.trace.config.TraceConfig;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.ioam.trace.config.TraceConfig.TraceTsp;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.ioam.trace.config.TraceConfigBuilder;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.ioam.trace.config.TraceConfig.TraceOp;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.ioam.trace.config.trace.config.NodeInterfaces;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.ioam.trace.config.TraceConfigKey;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.ioam.trace.config.trace.config.NodeInterfaces;
-
-
-public class IoamTraceWriterCustomizerTest extends WriterCustomizerTest {
-
- private static final String TRACE_NAME = "trace_test";
-
- @Mock
- protected FutureJVppIoamtrace jvppIoam;
-
- private IoamTraceWriterCustomizer customizer;
-
- @Override
- public void setUp() throws Exception {
- customizer = new IoamTraceWriterCustomizer(jvppIoam);
- }
-
- private static TraceConfig generateTraceConfig(final String name) {
- final TraceConfigBuilder builder = new TraceConfigBuilder();
- builder.setTraceConfigName(name);
- builder.setKey(new TraceConfigKey(name));
- builder.setAclName(name);
- builder.setTraceType(new Short("31"));
- builder.setTraceNumElt(new Short("4"));
- builder.setTraceTsp(TraceTsp.Milliseconds);
- builder.setTraceOp(TraceOp.Add);
- builder.setTraceAppData(new Long("123"));
- builder.setNodeId(new Long("1"));
-
- return builder.build();
- }
-
- private static InstanceIdentifier<TraceConfig> getTraceConfigId(final String name) {
- return InstanceIdentifier.create(IoamTraceConfig.class)
- .child(TraceConfig.class, new TraceConfigKey(name));
- }
-
- private void whenTraceAddThenSuccess() {
- final TraceProfileAddReply reply = new TraceProfileAddReply();
- reply.context = 1;
- doReturn(future(reply)).when(jvppIoam).traceProfileAdd(any(TraceProfileAdd.class));
- }
-
- private void whenTraceAddThenFailure() {
- doReturn(failedFuture()).when(jvppIoam).traceProfileAdd(any(TraceProfileAdd.class));
- }
-
- private void whenTraceDelThenSuccess() {
- final TraceProfileDelReply reply = new TraceProfileDelReply();
- reply.context = 1;
- doReturn(future(reply)).when(jvppIoam).traceProfileDel(any(TraceProfileDel.class));
- }
-
- private void whenTraceDelThenFailure() {
- doReturn(failedFuture()).when(jvppIoam).traceProfileDel(any(TraceProfileDel.class));
- }
-
- private static TraceProfileAdd generateTraceProfileAdd() {
- final TraceProfileAdd request = new TraceProfileAdd();
- request.traceType = 0x1f;
- request.numElts = 4;
- request.nodeId = 1;
- request.traceTsp = 1;
- request.appData = 123;
-
- return request;
- }
-
- private static TraceProfileDel generateTraceProfileDel() {
- final TraceProfileDel request = new TraceProfileDel();
-
- return request;
- }
-
- @Test
- public void testCreate() throws Exception {
- final TraceConfig traceConfig = generateTraceConfig(TRACE_NAME);
- final InstanceIdentifier<TraceConfig> id = getTraceConfigId(TRACE_NAME);
-
- whenTraceAddThenSuccess();
-
- customizer.writeCurrentAttributes(id, traceConfig, writeContext);
-
- verify(jvppIoam).traceProfileAdd(generateTraceProfileAdd());
- }
-
- @Test
- public void testCreateFailed() throws Exception {
- final TraceConfig traceConfig = generateTraceConfig(TRACE_NAME);
- final InstanceIdentifier<TraceConfig> id = getTraceConfigId(TRACE_NAME);
-
- whenTraceAddThenFailure();
-
- try {
- customizer.writeCurrentAttributes(id, traceConfig, writeContext);
- } catch (WriteFailedException e) {
- //assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(jvppIoam).traceProfileAdd(generateTraceProfileAdd());
-
- return;
- }
- fail("WriteFailedException.CreateFailedException was expected");
- }
-
- @Test
- public void testDelete() throws Exception {
-
- final TraceConfig traceConfig = generateTraceConfig(TRACE_NAME);
- final InstanceIdentifier<TraceConfig> id = getTraceConfigId(TRACE_NAME);
-
- whenTraceDelThenSuccess();
-
- customizer.deleteCurrentAttributes(id, traceConfig, writeContext);
-
- verify(jvppIoam).traceProfileDel(generateTraceProfileDel());
- }
-
- @Test
- public void testDeleteFailed() throws Exception {
-
- final TraceConfig traceConfig = generateTraceConfig(TRACE_NAME);
- final InstanceIdentifier<TraceConfig> id = getTraceConfigId(TRACE_NAME);
-
- whenTraceDelThenFailure();
-
- try {
- customizer.deleteCurrentAttributes(id, traceConfig, writeContext);
- } catch (WriteFailedException e) {
- //assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(jvppIoam).traceProfileDel(generateTraceProfileDel());
-
- return;
- }
- fail("WriteFailedException.DeleteFailedException was expected");
-
- customizer.deleteCurrentAttributes(id, traceConfig, writeContext);
- }
-}
diff --git a/ioam/ioam_trace_postman_collection.json b/ioam/ioam_trace_postman_collection.json
deleted file mode 100644
index d5248139a..000000000
--- a/ioam/ioam_trace_postman_collection.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "id": "7d81e8b0-274e-1f22-de94-d40cb78a389d",
- "name": "Honeycomb RESTCONF calls for iOAM Trace",
- "description": "To enable iOAM trace on VPP management nodes.",
- "order": [
- "f5a5aaea-2d61-a57f-191a-7cc81286f605"
- ],
- "folders": [],
- "timestamp": 1478073563257,
- "owner": 0,
- "public": false,
- "requests": [
- {
- "id": "f5a5aaea-2d61-a57f-191a-7cc81286f605",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8181/restconf/config/ioam-sb-trace:ioam-trace-config/",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1478077673476,
- "name": "iaom trace",
- "description": "",
- "collectionId": "7d81e8b0-274e-1f22-de94-d40cb78a389d",
- "responses": [],
- "rawModeData": "{\n\"trace-config\":{\n \"trace-config-name\":\"trace\",\n \"acl-name\":\"testAcl\",\n \"trace-type\":31,\n \"trace-num-elt\":3,\n \"trace-tsp\":\"milliseconds\",\n \"trace-op\":\"add\",\n \"trace-app-data\":1234,\n \"data-export-profile-name\":\"dataProfileName\",\n \"transport-encap-profile-name\":\"transProfileName\",\n \"node-id\":1,\n \"node-interfaces\":[\n {\n \"index\":5,\n \"intf-name\":\"GigabitEthernetb/0/0\"\n }\n ]\n }\n}\n"
- }
- ]
-} \ No newline at end of file
diff --git a/ioam/pom.xml b/ioam/pom.xml
deleted file mode 100644
index 2708114ce..000000000
--- a/ioam/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>honeycomb-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../common/honeycomb-parent</relativePath>
- </parent>
-
- <groupId>io.fd.honeycomb.ioam</groupId>
- <artifactId>vppioam-aggregator</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <name>${project.artifactId}</name>
- <packaging>pom</packaging>
- <modelVersion>4.0.0</modelVersion>
- <description>Aggregator for Honeycomb iOAM plugin</description>
-
- <modules>
- <module>api</module>
- <module>impl</module>
- </modules>
- <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/lisp/api/asciidoc/Readme.adoc b/lisp/api/asciidoc/Readme.adoc
deleted file mode 100644
index 191cab363..000000000
--- a/lisp/api/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= lisp-api
-
-Overview of lisp-api \ No newline at end of file
diff --git a/lisp/api/pom.xml b/lisp/api/pom.xml
deleted file mode 100755
index b16aaea59..000000000
--- a/lisp/api/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>api-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../../common/api-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.lisp</groupId>
- <artifactId>lisp-api</artifactId>
- <name>${project.artifactId}</name>
- <version>1.16.12-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <properties>
- <project.translate.groupId>io.fd.honeycomb</project.translate.groupId>
- <naming.context.version>1.16.12-SNAPSHOT</naming.context.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-interfaces</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-inet-types-2013-07-15</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>yang-ext</artifactId>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>naming-context-api</artifactId>
- <version>${naming.context.version}</version>
- </dependency>
- </dependencies>
-</project> \ No newline at end of file
diff --git a/lisp/api/src/main/yang/adjacencies-identification-context.yang b/lisp/api/src/main/yang/adjacencies-identification-context.yang
deleted file mode 100644
index ae05f83f5..000000000
--- a/lisp/api/src/main/yang/adjacencies-identification-context.yang
+++ /dev/null
@@ -1,65 +0,0 @@
-module adjacencies-identification-context {
- yang-version 1;
- namespace "urn:honeycomb:params:xml:ns:yang:adjacencies:identification:context";
- prefix "adjacencies-identification-context";
-
- description
- "This module contains mappings between adjacency identificator and actual unique combination of
- remote and local eid in vpp";
-
- revision "2016-08-01" {
- description
- "Initial revision.";
- }
-
- import lisp {prefix "lisp";}
- import ietf-lisp-address-types {prefix "lisp-types";}
- import yang-ext {prefix "ext";}
- import naming-context { prefix "nc";}
-
- grouping adjacencies-identification-context-attributes{
-
- container adjacencies-identification-contexts {
-
- list adjacencies-identification {
-
- key "name";
-
- leaf name {
- type string;
- }
-
- container mappings{
- list mapping {
-
- key "id";
-
- leaf id {
- type string;
- description "Id that uniquely identifies adjacency";
- }
-
- container eid-identificator-pair{
- leaf local-eid-id {
- type lisp:mapping-id;
- description "Local EID identifier";
- mandatory true;
- }
-
- leaf remote-eid-id {
- type lisp:mapping-id;
- description "Remote EID identifier";
- mandatory true;
- }
- }
- }
- }
- }
- }
- }
-
- augment /nc:contexts {
- ext:augment-identifier "adjacencies-identification-ctx-augmentation";
- uses adjacencies-identification-context-attributes;
- }
-} \ No newline at end of file
diff --git a/lisp/api/src/main/yang/eid-mapping-context.yang b/lisp/api/src/main/yang/eid-mapping-context.yang
deleted file mode 100644
index 3fb6d893a..000000000
--- a/lisp/api/src/main/yang/eid-mapping-context.yang
+++ /dev/null
@@ -1,44 +0,0 @@
-module eid-mapping-context {
- yang-version 1;
- namespace "urn:honeycomb:params:xml:ns:yang:eid:mapping:context";
- prefix "eid-mapping-context";
-
- description
- "This module contains mappings stored for local-mappings id to actual eid";
-
- revision "2016-08-01" {
- description
- "Initial revision.";
- }
-
- import lisp {prefix "lisp";}
- import ietf-lisp-address-types {prefix "lisp-types";}
-
- container contexts {
- list eid-mapping-context {
-
- key "name";
-
- leaf name {
- type string;
- }
-
- container mappings{
- list mapping {
-
- key "id";
-
- leaf id {
- type lisp:mapping-id;
- description "Id that uniquely identifies a mapping";
- }
-
- container eid {
- uses lisp-types:lisp-address;
- description "EID address";
- }
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/lisp/api/src/main/yang/ietf-lisp-address-types.yang b/lisp/api/src/main/yang/ietf-lisp-address-types.yang
deleted file mode 100755
index 2a3a1d31d..000000000
--- a/lisp/api/src/main/yang/ietf-lisp-address-types.yang
+++ /dev/null
@@ -1,677 +0,0 @@
-module ietf-lisp-address-types {
- namespace "urn:ietf:params:xml:ns:yang:ietf-lisp-address-types";
- prefix laddr;
- import ietf-inet-types {
- prefix inet;
- revision-date 2013-07-15;
- }
- import ietf-yang-types {
- prefix yang;
- revision-date 2013-07-15;
- }
- organization
- "IETF LISP (Locator/ID Separation Protocol) Working Group";
- contact
- "lisp@ietf.org";
- description
- "This YANG module defines the LISP Canonical Address Formats
- (LCAF) for LISP. The module can be extended by vendors to
- define vendor-specific parameters.
-
- Copyright (c) 2014 IETF Trust and the persons identified as
- authors of the code. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, is permitted pursuant to, and subject
- to the license terms contained in, the Simplified BSD License
- set forth in Section 4.c of the IETF Trust's Legal Provisions
- Relating to IETF Documents
- (http://trustee.ietf.org/license-info).
-
- This version of this YANG module is part of RFC 6338; see
- the RFC itself for full legal notices.
-
- ";
- revision 2015-11-05 {
- description
- "Initial revision.";
- reference
- "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10";
- }
- identity lisp-address-family {
- description
- "Base identity from which identities describing LISP address
- families are derived.";
- }
- identity no-address-afi {
- base lisp-address-family;
- description
- "IANA Reserved.";
- }
- identity ipv4-afi {
- base lisp-address-family;
- description
- "IANA IPv4 address family.";
- }
- identity ipv4-prefix-afi {
- base lisp-address-family;
- description
- "IANA IPv4 address family prefix.";
- }
- identity ipv6-afi {
- base lisp-address-family;
- description
- "IANA IPv6 address family.";
- }
- identity ipv6-prefix-afi {
- base lisp-address-family;
- description
- "IANA IPv6 address family prefix.";
- }
- identity mac-afi {
- base lisp-address-family;
- description
- "IANA MAC address family.";
- }
- identity distinguished-name-afi {
- base lisp-address-family;
- description
- "IANA Distinguished Name address family.";
- }
- identity as-number-afi {
- base lisp-address-family;
- description
- "IANA AS Number address family.";
- }
- identity lcaf {
- base lisp-address-family;
- description
- "IANA LISP Canonical Address Format address family.";
- }
- identity null-address-lcaf {
- base lcaf;
- description
- "Null body LCAF type.";
- }
- identity afi-list-lcaf {
- base lcaf;
- description
- "AFI-List LCAF type.";
- }
- identity instance-id-lcaf {
- base lcaf;
- description
- "Instance-ID LCAF type.";
- }
- identity as-number-lcaf {
- base lcaf;
- description
- "AS Number LCAF type.";
- }
- identity application-data-lcaf {
- base lcaf;
- description
- "Application Data LCAF type.";
- }
- identity geo-coordinates-lcaf {
- base lcaf;
- description
- "Geo-coordinates LCAF type.";
- }
- identity opaque-key-lcaf {
- base lcaf;
- description
- "Opaque Key LCAF type.";
- }
- identity nat-traversal-lcaf {
- base lcaf;
- description
- "NAT-Traversal LCAF type.";
- }
- identity nonce-locator-lcaf {
- base lcaf;
- description
- "Nonce-Locator LCAF type.";
- }
- identity multicast-info-lcaf {
- base lcaf;
- description
- "Multicast Info LCAF type.";
- }
- identity explicit-locator-path-lcaf {
- base lcaf;
- description
- "Explicit Locator Path LCAF type.";
- }
- identity security-key-lcaf {
- base lcaf;
- description
- "Security Key LCAF type.";
- }
- identity source-dest-key-lcaf {
- base lcaf;
- description
- "Source/Dest LCAF type.";
- }
- identity replication-list-lcaf {
- base lcaf;
- description
- "Replication-List LCAF type.";
- }
- identity json-data-model-lcaf {
- base lcaf;
- description
- "JSON Data Model LCAF type.";
- }
- identity key-value-address-lcaf {
- base lcaf;
- description
- "Key/Value Address LCAF type.";
- }
- identity encapsulation-format-lcaf {
- base lcaf;
- description
- "Encapsulation Format LCAF type.";
- }
- identity service-path-lcaf {
- base lcaf;
- description
- "Service Path LCAF type.";
- }
- typedef instance-id-type {
- type uint32 {
- range "0..16777215";
- }
- description
- "Defines the range of values for an Instance ID.";
- }
- typedef service-path-id-type {
- type uint32 {
- range "0..16777215";
- }
- description
- "Defines the range of values for a Service Path ID.";
- }
- typedef distinguished-name-type {
- type string;
- description
- "Distinguished Name address.";
- reference
- "http://www.iana.org/assignments/address-family-numbers/
- address-family-numbers.xhtml";
- }
- typedef simple-address {
- type union {
- type inet:ip-address;
- type inet:ip-prefix;
- type yang:mac-address;
- type distinguished-name-type;
- type inet:as-number;
- }
- description
- "Union of address types that can be part of LCAFs.";
- }
-
- typedef lisp-address-family-ref {
- type identityref {
- base lisp-address-family;
- }
- description
- "LISP address family reference.";
- }
- typedef lcaf-ref {
- type identityref {
- base lcaf;
- }
- description
- "LCAF types reference.";
- }
-
- grouping lisp-address {
- description
- "Generic LISP address.";
- leaf address-type {
- type lisp-address-family-ref;
- mandatory true;
- description
- "Type of the LISP address.";
- }
- leaf virtual-network-id {
- type instance-id-type;
- description
- "Virtual Network Identifier (instance-id) of the address.";
- }
- choice address {
- description
- "Various LISP address types, including IP, MAC, and LCAF.";
-
- leaf no-address {
- when "../address-type = 'laddr:no-addr-afi'" {
- description
- "When AFI is 0.";
- }
- type empty;
- description
- "No address.";
- }
- leaf ipv4 {
- when "../address-type = 'laddr:ipv4-afi'" {
- description
- "When AFI is IPv4.";
- }
- type inet:ipv4-address;
- description
- "IPv4 address.";
- }
- leaf ipv4-prefix {
- when "../address-type = 'laddr:ipv4-prefix-afi'" {
- description
- "When AFI is IPv4.";
- }
- type inet:ipv4-prefix;
- description
- "IPv4 prefix.";
- }
- leaf ipv6 {
- when "../address-type = 'laddr:ipv6-afi'" {
- description
- "When AFI is IPv6.";
- }
- type inet:ipv6-address;
- description
- "IPv6 address.";
- }
- leaf ipv6-prefix {
- when "../address-type = 'laddr:ipv6-prefix-afi'" {
- description
- "When AFI is IPv6.";
- }
- type inet:ipv6-prefix;
- description
- "IPv6 address.";
- }
- leaf mac {
- when "../address-type = 'laddr:mac-afi'" {
- description
- "When AFI is MAC.";
- }
- type yang:mac-address;
- description
- "MAC address.";
- }
- leaf distinguished-name {
- when "../address-type = 'laddr:distinguished-name-afi'" {
- description
- "When AFI is distinguished-name.";
- }
- type distinguished-name-type;
- description
- "Distinguished Name address.";
- }
- leaf as-number {
- when "../address-type = 'laddr:as-number-afi'" {
- description
- "When AFI is as-number.";
- }
- type inet:as-number;
- description
- "AS Number.";
- }
- container null-address {
- when "../address-type = 'laddr:null-address-lcaf'" {
- description
- "When LCAF type is null.";
- }
- description
- "Null body LCAF type";
- leaf address {
- type empty;
- description
- "AFI address.";
- }
- }
- container afi-list {
- when "../address-type = 'laddr:afi-list-lcaf'" {
- description
- "When LCAF type is AFI-List.";
- }
- description
- "AFI-List LCAF type.";
- reference
- "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10
- #section-4.16.1";
- leaf-list address-list {
- type simple-address;
- description
- "List of AFI addresses.";
- }
- }
- container instance-id {
- when "../address-type = 'laddr:instance-id-lcaf'" {
- description
- "When LCAF type is Instance-ID";
- }
- description
- "Instance ID LCAF type.";
- reference
- "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10
- #section-4.2";
- leaf iid {
- type instance-id-type;
- description
- "Instance ID value.";
- }
- leaf mask-length {
- type uint8;
- description
- "Mask length.";
- }
- leaf address {
- type simple-address;
- description
- "AFI address.";
- }
- }
- container as-number-lcaf {
- when "../address-type = 'laddr:as-number-lcaf'" {
- description
- "When LCAF type is AS-Number.";
- }
- description
- "AS Number LCAF type.";
- reference
- "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10
- #section-4.3";
- leaf as {
- type inet:as-number;
- description
- "AS number.";
- }
- leaf address {
- type simple-address;
- description
- "AFI address.";
- }
- }
- container application-data {
- when "../address-type = 'laddr:application-data-lcaf'" {
- description
- "When LCAF type is Application Data.";
- }
- description
- "Application Data LCAF type.";
- reference
- "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10
- #section-4.4";
- leaf address {
- type simple-address;
- description
- "AFI address.";
- }
- leaf protocol {
- type uint8;
- description
- "Protocol number.";
- }
- leaf ip-tos {
- type int32;
- description
- "Type of service field.";
- }
- leaf local-port-low {
- type inet:port-number;
- description
- "Low end of local port range.";
- }
- leaf local-port-high {
- type inet:port-number;
- description
- "High end of local port range.";
- }
- leaf remote-port-low {
- type inet:port-number;
- description
- "Low end of remote port range.";
- }
- leaf remote-port-high {
- type inet:port-number;
- description
- "High end of remote port range.";
- }
- }
- container geo-coordinates {
- when "../address-type = 'laddr:geo-coordinates-lcaf'" {
- description
- "When LCAF type is Geo-coordinates.";
- }
- description
- "Geo-coordinates LCAF type.";
- reference
- "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10
- #section-4.5";
- leaf latitude {
- type bits {
- bit N {
- description
- "Latitude bit.";
- }
- }
- description
- "Bit that selects between North and South latitude.";
- }
- leaf latitude-degrees {
- type uint8 {
- range "0 .. 90";
- }
- description
- "Degrees of latitude.";
- }
- leaf latitude-minutes {
- type uint8 {
- range "0..59";
- }
- description
- "Minutes of latitude.";
- }
- leaf latitude-seconds {
- type uint8 {
- range "0..59";
- }
- description
- "Seconds of latitude.";
- }
- leaf longitude {
- type bits {
- bit E {
- description
- "Longitude bit.";
- }
- }
- description
- "Bit that selects between East and West longitude.";
- }
- leaf longitude-degrees {
- type uint16 {
- range "0 .. 180";
- }
- description
- "Degrees of longitude.";
- }
- leaf longitude-minutes {
- type uint8 {
- range "0..59";
- }
- description
- "Minutes of longitude.";
- }
- leaf longitude-seconds {
- type uint8 {
- range "0..59";
- }
- description
- "Seconds of longitude.";
- }
- leaf altitude {
- type int32;
- description
- "Height relative to sea level in meters.";
- }
- leaf address {
- type simple-address;
- description
- "AFI address.";
- }
- }
- container nat-traversal {
- when "../address-type = 'laddr:nat-traversal-lcaf'" {
- description
- "When LCAF type is NAT-Traversal.";
- }
- description
- "NAT-Traversal LCAF type.";
- reference
- "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10
- #section-4.6";
- leaf ms-udp-port {
- type uint16;
- description
- "Map-Server UDP port (set to 4342).";
- }
- leaf etr-udp-port {
- type uint16;
- description
- "ETR UDP port.";
- }
- leaf global-etr-rloc {
- type simple-address;
- description
- "Global ETR RLOC address.";
- }
- leaf ms-rloc {
- type simple-address;
- description
- "Map-Server RLOC address.";
- }
- leaf private-etr-rloc {
- type simple-address;
- description
- "Private ETR RLOC address.";
- }
- leaf-list rtr-rlocs {
- type simple-address;
- description
- "List of RTR RLOC addresses.";
- }
- }
- container explicit-locator-path {
- when "../address-type = 'laddr:explicit-locator-path-lcaf'" {
- description
- "When LCAF type type is Explicit Locator Path.";
- }
- description
- "Explicit Locator Path LCAF type.";
- reference
- "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10
- #section-4.9";
- list hop {
- key "hop-id";
- ordered-by user;
- description
- "List of locator hops forming the explicit path.";
- leaf hop-id {
- type string {
- length "1..64";
- }
- description
- "Unique identifier for the hop.";
- }
- leaf address {
- type simple-address;
- description
- "AFI address.";
- }
- leaf lrs-bits {
- type bits{
- bit lookup {
- description
- "Lookup bit.";
- }
- bit rloc-probe {
- description
- "RLOC-probe bit.";
- }
- bit strict {
- description
- "Strict bit.";
- }
- }
- description
- "Flag bits per hop.";
- }
- }
- }
- container source-dest-key {
- when "../address-type = 'laddr:source-dest-key-lcaf'" {
- description
- "When LCAF type type is Source/Dest.";
- }
- description
- "Source/Dest LCAF type.";
- reference
- "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10
- #section-4.11";
- leaf source {
- type simple-address;
- description
- "Source address.";
- }
- leaf dest {
- type simple-address;
- description
- "Destination address.";
- }
- }
- container key-value-address {
- when "../address-type = 'laddr:key-value-address-lcaf'" {
- description
- "When LCAF type type is Key/Value Address.";
- }
- description
- "Key/Value Address LCAF type.";
- reference
- "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-10
- #section-4.11";
- leaf key {
- type simple-address;
- description
- "Address as Key.";
- }
- leaf value {
- type simple-address;
- description
- "Address as Value.";
- }
- }
- container service-path {
- when "../address-type = 'laddr:service-path-lcaf'" {
- description
- "When LCAF type service path identifier.";
- }
- description
- "Service Path LCAF type.";
- reference
- "http://tools.ietf.org/html/draft-ermagan-lisp-nsh-00";
- leaf service-path-id {
- type service-path-id-type;
- description
- "Service path identifier for the path for NSH header";
- }
- leaf service-index {
- type uint8;
- description
- "Service path index for NSH header";
- }
- }
- }
- }
-}
diff --git a/lisp/api/src/main/yang/lisp.yang b/lisp/api/src/main/yang/lisp.yang
deleted file mode 100755
index f104bd84e..000000000
--- a/lisp/api/src/main/yang/lisp.yang
+++ /dev/null
@@ -1,353 +0,0 @@
-//TODO mandatory statements
-module lisp {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:lisp";
- prefix "lisp";
- import ietf-interfaces {
- prefix "if";
- }
- import ietf-inet-types {
- prefix "inet";
- }
- import ietf-lisp-address-types {
- prefix "lisp-types";
- }
- organization
- "FD.io Overlay Forwarding Engine (ONE) project";
- contact
- "Florin Coras <fcoras@cisco.com>
- Vina Ermagan <vermagan@cisco.com>
- ONE list <one@lists.fd.io>";
-
- description
- "This YANG module defines the generic configuration and
- operational data for LISP in VPP";
-
- revision 2016-12-14 {
- description
- "This revision adds support for L2 features, by adding vrf-subtable/bridge-domain-subtable
- containers under vni-table. Both contains mandatory reference to index(vrf-subtable)
- or name(bridge-domain-subtable) of respective kind of table.";
-
- reference
- "https://tools.ietf.org/html/rfc6830";
- }
-
- revision "2016-05-20" {
- description
- "Initial revision of LISP model";
- reference
- "https://tools.ietf.org/html/rfc6830";
- }
-
- typedef locator-set-ref {
- type leafref {
- path "/lisp/lisp-feature-data/locator-sets/locator-set/name";
- }
- description "Locator-set reference";
- }
-
- typedef mapping-id {
- type string;
- description "Mapping ID";
- }
-
- typedef map-reply-action {
- type enumeration {
- enum no-action {
- value 0;
- description
- "Mapping is kept alive and no encapsulation occurs.";
- }
- enum natively-forward {
- value 1;
- description
- "Matching packets are not encapsulated or dropped but
- natively forwarded.";
- }
- enum send-map-request {
- value 2;
- description
- "Matching packets invoke Map-Requests.";
- }
- enum drop {
- value 3;
- description
- "Matching packets are dropped.";
- }
- }
- description
- "Defines the lisp map-cache ACT type";
- reference
- "https://tools.ietf.org/html/rfc6830#section-6.1.4";
- }
- grouping locator-properties-grouping {
- description
- "Properties of a RLOC";
- leaf priority {
- type uint8;
- description
- "Locator priority.";
- }
- leaf weight {
- type uint8;
- description
- "Locator weight.";
- }
- }
-
- grouping locator-sets-grouping {
- // NOTE: to be used only for local locators
- // lisp_add_del_locator_set locator-set <ls_name> [del]
- // lisp_add_del_locator locator-set <ls_name> iface <iface_name>
- // p <val> w <val> [del]
- container locator-sets {
- list locator-set {
- key "name";
- leaf name {
- type string;
- description "Locator-set name";
- }
- list interface {
- key "interface-ref";
- leaf interface-ref {
- type if:interface-ref;
- description "Interface reference";
- }
- uses locator-properties-grouping;
- description "List of interfaces part of the locator-set";
- }
- description "Locator-set";
- }
- description "Locator-sets";
- }
- description "Grouping for locator-sets";
- }
-
- grouping adjacencies-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";
- }
- 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 <eid> seid
- // <seid> [action <action>] rloc
- // <ip-addr> [rloc <ip-addr> ..]
- // 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.";
- }
- }
- 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";
- }
- description
- "List of locators for a positive mapping.";
- }
- }
- }
- uses adjacencies-grouping;
- description "List of remote mappings";
- }
- description "Map-cache/remote mappings cache";
- }
- description "Data path subtable (VRF/bridge domain) grouping";
- }
-
- 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 {
- presence "Enable L3 mapping";
- leaf table-id {
- type uint32;
- description "table-id";
- mandatory true;
- }
-
- uses dp-subtable-grouping;
- description "VRF subtable";
- }
- container bridge-domain-subtable {
- presence "Enable L2 mapping";
- leaf bridge-domain-ref {
- type string;
- description "Name reference to existing bridge domain";
- mandatory true;
- }
-
- uses dp-subtable-grouping;
- description "Bridge domain subtable";
- }
- description "VNI tables";
- }
- description "EID table";
- }
- description "EID table grouping";
- }
- grouping map-resolvers-grouping {
- container map-resolvers {
- // lisp_add_del_map_resolver <ip>
- list map-resolver {
- key ip-address;
- leaf ip-address {
- type inet:ip-address;
- description "Map-resolver IP address";
- }
- description "List of map-resolvers";
- }
- description "Map-resolvers configured";
- }
- description "Map-Resolver grouping";
- }
- grouping pitr-cfg-grouping {
- // lisp_pitr_set_locator_set <ip>
- container pitr-cfg {
- leaf locator-set {
- type locator-set-ref;
- description "Locator-set reference";
- }
- description "Proxy-ITR configuration";
- }
- 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";
- }
- uses lisp-feature-data-grouping;
- description "LISP configuration";
- }
-
- container lisp-state {
-
- // lisp_enable_disable / lisp_enable_disable_status_dump
- leaf enable {
- type boolean;
- description "Enable/disable LISP feature";
- }
- uses lisp-feature-data-grouping;
- description "LISP state";
- }
-}
diff --git a/lisp/asciidoc/Readme.adoc b/lisp/asciidoc/Readme.adoc
deleted file mode 100755
index b3a01c6d3..000000000
--- a/lisp/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= Honeycomb translation layer SPI implementation for VPP's LISP APIs
-
-Provides customizers translating lisp.yang model into VPP's LISP API calls \ No newline at end of file
diff --git a/lisp/lisp2vpp/asciidoc/Readme.adoc b/lisp/lisp2vpp/asciidoc/Readme.adoc
deleted file mode 100644
index 88c43fd4b..000000000
--- a/lisp/lisp2vpp/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= lisp2vpp
-
-Overview of lisp2vpp \ No newline at end of file
diff --git a/lisp/lisp2vpp/pom.xml b/lisp/lisp2vpp/pom.xml
deleted file mode 100755
index b612acc32..000000000
--- a/lisp/lisp2vpp/pom.xml
+++ /dev/null
@@ -1,118 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-impl-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../../vpp-common/vpp-impl-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.lisp</groupId>
- <artifactId>lisp2vpp</artifactId>
- <name>${project.artifactId}</name>
- <version>1.16.12-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <properties>
- <project.vpp.groupId>io.fd.honeycomb.vpp</project.vpp.groupId>
- <project.honeycomb.groupId>io.fd.honeycomb</project.honeycomb.groupId>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>${project.honeycomb.groupId}</groupId>
- <artifactId>translate-spi</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.vpp.groupId}</groupId>
- <artifactId>vpp-translate-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>lisp-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.honeycomb.groupId}</groupId>
- <artifactId>translate-impl</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.honeycomb.groupId}</groupId>
- <artifactId>cfg-init</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.vpp</groupId>
- <artifactId>jvpp-core</artifactId>
- </dependency>
-
- <!-- DI -->
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- </dependency>
- <dependency>
- <groupId>net.jmob</groupId>
- <artifactId>guice.conf</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-multibindings</artifactId>
- </dependency>
-
- <!-- Testing Dependencies -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-testlib</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-all</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-translate-test</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.infra</groupId>
- <artifactId>test-tools</artifactId>
- <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
deleted file mode 100644
index db5557f0d..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/LispModule.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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;
-
-
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.LOCAL_MAPPING_CONTEXT;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.LOCATOR_SET_CONTEXT;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.LOCATOR_SET_CONTEXT_PREFIX;
-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.lisp.cfgattrs.LispConfiguration;
-import io.fd.honeycomb.lisp.context.util.AdjacenciesMappingContext;
-import io.fd.honeycomb.lisp.context.util.ContextsReaderFactoryProvider;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.translate.read.factory.LispStateReaderFactory;
-import io.fd.honeycomb.lisp.translate.write.factory.LispWriterFactory;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import net.jmob.guice.conf.core.ConfigurationModule;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LispModule extends AbstractModule {
-
- private static final Logger LOG = LoggerFactory.getLogger(LispModule.class);
-
- @Override
- protected void configure() {
- LOG.info("Configuring module Lisp");
- install(ConfigurationModule.create());
- requestInjection(LispConfiguration.class);
-
- LOG.info("Binding Naming context[{}]", LOCATOR_SET_CONTEXT);
- bind(NamingContext.class)
- .annotatedWith(Names.named(LOCATOR_SET_CONTEXT))
- .toInstance(new NamingContext(LOCATOR_SET_CONTEXT_PREFIX, LOCATOR_SET_CONTEXT));
-
- LOG.info("Binding Eid context[{}]", LOCAL_MAPPING_CONTEXT);
- bind(EidMappingContext.class)
- .annotatedWith(Names.named(LOCAL_MAPPING_CONTEXT))
- .toInstance(new EidMappingContext(LOCAL_MAPPING_CONTEXT));
-
- LOG.info("Binding Eid context[{}]", REMOTE_MAPPING_CONTEXT);
- bind(EidMappingContext.class)
- .annotatedWith(Names.named(REMOTE_MAPPING_CONTEXT))
- .toInstance(new EidMappingContext(REMOTE_MAPPING_CONTEXT));
-
- LOG.info("Binding Adjacencies context");
- bind(AdjacenciesMappingContext.class)
- .annotatedWith(Names.named(LispConfiguration.ADJACENCIES_IDENTIFICATION_CONTEXT))
- .toInstance(new AdjacenciesMappingContext(LispConfiguration.ADJACENCIES_IDENTIFICATION_CONTEXT));
-
- LOG.info("Binding reader factories");
- final Multibinder<ReaderFactory> readerFactoryBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class);
- readerFactoryBinder.addBinding().to(LispStateReaderFactory.class);
- LOG.info("Reader factories binded");
-
- LOG.info("Binding writer factories");
- final Multibinder<WriterFactory> writerFactoryBinder = Multibinder.newSetBinder(binder(), WriterFactory.class);
- writerFactoryBinder.addBinding().to(LispWriterFactory.class);
- LOG.info("Writer factories 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
deleted file mode 100644
index 177f650c9..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/cfgattrs/LispConfiguration.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.cfgattrs;
-
-import net.jmob.guice.conf.core.BindConfig;
-import net.jmob.guice.conf.core.Syntax;
-
-/**
- * Class containing static configuration for Lisp module,<br>
- * either loaded from property file or statically typed.
- */
-@BindConfig(value = "lisp", syntax = Syntax.JSON)
-public class LispConfiguration {
-
- //TODO HONEYCOMB-176 - this constant should be part of V3po plugin
- /**
- * Interface index to name mapping.
- */
- public static final String INTERFACE_CONTEXT = "interface-context";
-
- /**
- * Locator set index to name mapping.
- */
- public static final String LOCATOR_SET_CONTEXT = "locator-set-context";
-
- /**
- * Local mappings's eid to name mapping.
- */
- public static final String LOCAL_MAPPING_CONTEXT = "local-mapping-context";
-
- /**
- * Remote mappings's eid to name mapping.
- */
- public static final String REMOTE_MAPPING_CONTEXT = "remote-mapping-context";
-
- /**
- * Unique prefix for naming context of locator sets.
- **/
- public static final String LOCATOR_SET_CONTEXT_PREFIX = "locator-set-";
-
- /**
- * Adjacency id to eid pair mapping
- * */
- public static final String ADJACENCIES_IDENTIFICATION_CONTEXT = "adjacencies-identification-context";
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/AdjacenciesMappingContext.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/AdjacenciesMappingContext.java
deleted file mode 100644
index 557dc2771..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/AdjacenciesMappingContext.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * 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 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.translate.MappingContext;
-import io.fd.honeycomb.translate.util.RWUtils;
-import java.util.stream.Collector;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.AdjacenciesIdentificationContexts;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.AdjacenciesIdentification;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.AdjacenciesIdentificationKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.Mappings;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.Mapping;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.MappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.MappingKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.mapping.EidIdentificatorPair;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.mapping.EidIdentificatorPairBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-
-public class AdjacenciesMappingContext {
-
- private static final Collector<Mapping, ?, Mapping> SINGLE_ITEM_COLLECTOR = RWUtils.singleItemCollector();
-
- private final KeyedInstanceIdentifier<AdjacenciesIdentification, AdjacenciesIdentificationKey>
- namingContextIid;
-
- /**
- * Create new naming context
- *
- * @param instanceName name of this context instance. Will be used as list item identifier within context data tree
- */
- public AdjacenciesMappingContext(@Nonnull final String instanceName) {
- namingContextIid = InstanceIdentifier.create(AdjacenciesIdentificationContexts.class).child(
- AdjacenciesIdentification.class, new AdjacenciesIdentificationKey(instanceName));
- }
-
- /**
- * Retrieve name for mapping stored provided mappingContext instance.
- *
- * @param localEidId {@code MappingId} for local eid
- * @param remoteEidId {@code MappingId} for remote eid
- * @param mappingContext mapping context providing context data for current transaction
- * @return name mapped to provided index
- */
- @Nonnull
- public synchronized String getAdjacencyId(
- @Nonnull final String localEidId,
- @Nonnull final String remoteEidId,
- @Nonnull final MappingContext mappingContext) {
-
- final Optional<Mappings> read = mappingContext.read(namingContextIid.child(Mappings.class));
- checkState(read.isPresent(), "No adjacencies mappings stored");
-
- return read.get().getMapping().stream()
- .filter(mapping -> isSame(pairForCombination(localEidId, remoteEidId), mapping))
- .collect(SINGLE_ITEM_COLLECTOR).getId();
- }
-
- private boolean isSame(final EidIdentificatorPair currentPair, final Mapping mapping) {
- // EidIdentificatorPair is container so it needs to be compared like this
- final EidIdentificatorPair mappingPair = mapping.getEidIdentificatorPair();
- return currentPair.getLocalEidId().equals(mappingPair.getLocalEidId())
- && currentPair.getRemoteEidId().equals(mappingPair.getRemoteEidId());
- }
-
- private EidIdentificatorPair pairForCombination(final @Nonnull String localEidId,
- final @Nonnull String remoteEidId) {
- return new EidIdentificatorPairBuilder()
- .setLocalEidId(new MappingId(localEidId))
- .setRemoteEidId(new MappingId(remoteEidId))
- .build();
- }
-
- /**
- * Check whether mapping is present for index.
- *
- * @param localEidId {@code MappingId} for local eid
- * @param remoteEidId {@code MappingId} for remote eid
- * @param mappingContext mapping context providing context data for current transaction
- * @return true if present, false otherwise
- */
- public synchronized boolean containsId(
- @Nonnull final String localEidId,
- @Nonnull final String remoteEidId,
- @Nonnull final MappingContext mappingContext) {
- final Optional<Mappings> read = mappingContext.read(namingContextIid.child(Mappings.class));
-
- return read.isPresent() &&
- read.get().getMapping()
- .stream()
- .anyMatch(mapping -> isSame(pairForCombination(localEidId, remoteEidId), mapping));
- }
-
- /**
- * Add mapping to current context
- *
- * @param index index of a mapped item
- * @param localEidId {@code MappingId} for local eid
- * @param remoteEidId {@code MappingId} for remote eid
- * @param mappingContext mapping context providing context data for current transaction
- */
- public synchronized void addEidPair(
- @Nonnull final String index,
- @Nonnull final String localEidId,
- @Nonnull final String remoteEidId,
- final MappingContext mappingContext) {
-
- final KeyedInstanceIdentifier<Mapping, MappingKey> mappingIid = getMappingIid(index);
- mappingContext.put(mappingIid, new MappingBuilder().setId(index).setEidIdentificatorPair(
- pairForCombination(localEidId, remoteEidId)).build());
- }
-
- private KeyedInstanceIdentifier<Mapping, MappingKey> getMappingIid(final String index) {
- return namingContextIid.child(Mappings.class).child(Mapping.class, new MappingKey(index));
- }
-
-
- /**
- * Remove mapping from current context
- *
- * @param index identificator of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- */
- public synchronized void removeForIndex(@Nonnull final String index, final MappingContext mappingContext) {
- mappingContext.delete(getMappingIid(index));
- }
-
- /**
- * Returns index value associated with the given name.
- *
- * @param index index whitch should value sits on
- * @param mappingContext mapping context providing context data for current transaction
- * @return integer index value matching supplied name
- * @throws IllegalArgumentException if name was not found
- */
- public synchronized EidIdentificatorPair getEidPair(@Nonnull final String index,
- final MappingContext mappingContext) {
- final Optional<Mapping> read = mappingContext.read(getMappingIid(index));
- checkArgument(read.isPresent(), "No mapping stored for index: %s", index);
- return read.get().getEidIdentificatorPair();
- }
-
- /**
- * Check whether mapping is present for name.
- *
- * @param index index of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- * @return true if present, false otherwise
- */
- public synchronized boolean containsEidPairForIndex(@Nonnull final String index,
- @Nonnull final MappingContext mappingContext) {
- return mappingContext.read(getMappingIid(index)).isPresent();
- }
-}
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
deleted file mode 100644
index 29a5e3fd4..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/ContextsReaderFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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
deleted file mode 100644
index d023b3e9f..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/ContextsReaderFactoryProvider.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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
deleted file mode 100644
index 8f5dab7c9..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/EidMappingContext.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * 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 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;
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.util.RWUtils;
-import java.util.stream.Collector;
-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.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.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.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.EidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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>
- namingContextIid;
-
- /**
- * Create new naming context
- *
- * @param instanceName name of this context instance. Will be used as list item identifier within context data tree
- */
- public EidMappingContext(@Nonnull final String instanceName) {
- namingContextIid = InstanceIdentifier.create(Contexts.class).child(
- org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.EidMappingContext.class,
- new EidMappingContextKey(instanceName));
- }
-
- /**
- * Retrieve name for mapping stored provided mappingContext instance.
- *
- * @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.rev161214.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);
-
- 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();
- }
-
- /**
- * Retrieve name for mapping stored provided mappingContext instance.
- *
- * @param eid 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.rev161214.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);
-
- return read.get().getMapping().stream()
- .filter(mapping -> compareEids(mapping.getEid(), eid))
- .collect(SINGLE_ITEM_COLLECTOR).getId();
- }
-
- /**
- * Check whether mapping is present for index.
- *
- * @param eid eid of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- * @return true if present, false otherwise
- */
- public synchronized boolean containsId(
- @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid eid,
- @Nonnull final MappingContext mappingContext) {
- final Optional<Mappings> read = mappingContext.read(namingContextIid.child(Mappings.class));
-
- return read.isPresent() &&
- read.get().getMapping()
- .stream()
- .anyMatch(mapping -> compareEids(mapping.getEid(), eid));
- }
-
- /**
- * Check whether mapping is present for index.
- *
- * @param eid eid of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- * @return true if present, false otherwise
- */
- public synchronized boolean containsId(
- @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid eid,
- @Nonnull final MappingContext mappingContext) {
- final Optional<Mappings> read = mappingContext.read(namingContextIid.child(Mappings.class));
-
- return read.isPresent() &&
- read.get().getMapping()
- .stream()
- .anyMatch(mapping -> compareEids(mapping.getEid(), eid));
- }
-
-
- /**
- * Add mapping to current context
- *
- * @param index index of a mapped item
- * @param eid eid data
- * @param mappingContext mapping context providing context data for current transaction
- */
- public synchronized void addEid(
- @Nonnull final MappingId index,
- @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid eid,
- final MappingContext mappingContext) {
-
- final KeyedInstanceIdentifier<Mapping, MappingKey> mappingIid = getMappingIid(index);
- mappingContext.put(mappingIid, new MappingBuilder().setId(index).setEid(copyEid(eid)).build());
- }
-
- /**
- * Add mapping to current context
- *
- * @param index index of a mapped item
- * @param eid eid data
- * @param mappingContext mapping context providing context data for current transaction
- */
- public synchronized void addEid(
- @Nonnull final MappingId index,
- @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid eid,
- final MappingContext mappingContext) {
-
- final KeyedInstanceIdentifier<Mapping, MappingKey> mappingIid = getMappingIid(index);
- mappingContext.put(mappingIid, new MappingBuilder().setId(index).setEid(copyEid(eid)).build());
- }
-
- private KeyedInstanceIdentifier<Mapping, MappingKey> getMappingIid(final MappingId index) {
- return namingContextIid.child(Mappings.class).child(Mapping.class, new MappingKey(index));
- }
-
- private Eid copyEid(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid eid) {
- return new EidBuilder().setAddress(eid.getAddress()).setAddressType(eid.getAddressType())
- .setVirtualNetworkId(eid.getVirtualNetworkId()).build();
- }
-
- /**
- * Remove mapping from current context
- *
- * @param index identificator of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- */
- public synchronized void removeEid(@Nonnull final MappingId index, final MappingContext mappingContext) {
- mappingContext.delete(getMappingIid(index));
- }
-
- /**
- * Returns index value associated with the given name.
- *
- * @param index index whitch should value sits on
- * @param mappingContext mapping context providing context data for current transaction
- * @return integer index value matching supplied name
- * @throws IllegalArgumentException if name was not found
- */
- 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 read.get().getEid();
- }
-
- /**
- * Check whether mapping is present for name.
- *
- * @param index index of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- * @return true if present, false otherwise
- */
- public synchronized boolean containsEid(@Nonnull final MappingId index,
- @Nonnull final MappingContext mappingContext) {
- return mappingContext.read(getMappingIid(index)).isPresent();
- }
-}
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
deleted file mode 100755
index d7003c802..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizer.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * 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.translate.read;
-
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.lisp.context.util.AdjacenciesMappingContext;
-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.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.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispAdjacenciesGet;
-import io.fd.vpp.jvpp.core.dto.LispAdjacenciesGetReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import io.fd.vpp.jvpp.core.types.LispAdjacency;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.mapping.EidIdentificatorPair;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.mapping.EidIdentificatorPairBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.AdjacenciesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.AdjacencyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.AdjacencyKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class AdjacencyCustomizer extends FutureJVppCustomizer
- implements ListReaderCustomizer<Adjacency, AdjacencyKey, AdjacencyBuilder>, JvppReplyConsumer, EidTranslator {
-
- private final DumpCacheManager<LispAdjacenciesGetReply, AdjacencyDumpParams> dumpCacheManager;
- private final AdjacenciesMappingContext adjacenciesMappingContext;
- private final EidPairProducer eidPairProducer;
-
-
- public AdjacencyCustomizer(@Nonnull final FutureJVppCore futureJvpp,
- @Nonnull final EidMappingContext localMappingContext,
- @Nonnull final EidMappingContext remoteMappingContext,
- @Nonnull final AdjacenciesMappingContext adjacenciesMappingContext) {
- super(futureJvpp);
- dumpCacheManager = new DumpCacheManager.DumpCacheManagerBuilder<LispAdjacenciesGetReply, AdjacencyDumpParams>()
- .withExecutor(createExecutor())
- .build();
-
- this.adjacenciesMappingContext =
- checkNotNull(adjacenciesMappingContext, "Adjacencies mapping context cannot be null");
- this.eidPairProducer = new EidPairProducer(localMappingContext, remoteMappingContext);
- }
-
- @Nonnull
- @Override
- public List<AdjacencyKey> getAllIds(@Nonnull final InstanceIdentifier<Adjacency> id,
- @Nonnull final ReadContext context) throws ReadFailedException {
-
- final int vni = id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier().intValue();
-
- final Optional<LispAdjacenciesGetReply> optionalDump =
- dumpCacheManager.getDump(id, context.getModificationCache(), new AdjacencyDumpParams(vni));
-
-
- if (optionalDump.isPresent()) {
- return Arrays.stream(optionalDump.get().adjacencies)
- .map(lispAdjacency -> eidPairProducer.createPair(lispAdjacency, vni, context.getMappingContext()))
- .map(pair -> adjacenciesMappingContext
- .getAdjacencyId(pair.getLocalEidId().getValue(), pair.getRemoteEidId().getValue(),
- context.getMappingContext()))
- .map(AdjacencyKey::new)
- .collect(Collectors.toList());
- }
-
- //does not throw exception to not disturb lisp state reading
- return Collections.emptyList();
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder, @Nonnull final List<Adjacency> readData) {
- ((AdjacenciesBuilder) builder).setAdjacency(readData);
- }
-
- @Nonnull
- @Override
- public AdjacencyBuilder getBuilder(@Nonnull final InstanceIdentifier<Adjacency> id) {
- return new AdjacencyBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Adjacency> id,
- @Nonnull final AdjacencyBuilder builder, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
-
- final int vni = id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier().intValue();
-
- final Optional<LispAdjacenciesGetReply> optionalDump = dumpCacheManager
- .getDump(id, ctx.getModificationCache(), new AdjacencyDumpParams(vni));
-
- if (!optionalDump.isPresent() || optionalDump.get().adjacencies.length == 0) {
- return;
- }
-
- final String currentAdjacencyId = id.firstKeyOf(Adjacency.class).getId();
- final EidIdentificatorPair currentAdjacencyIdentificationPair =
- adjacenciesMappingContext.getEidPair(currentAdjacencyId, ctx.getMappingContext());
-
- final LispAdjacency currentAdjacency = Arrays.stream(optionalDump.get().adjacencies)
- .filter(lispAdjacency -> Objects.equals(currentAdjacencyIdentificationPair,
- eidPairProducer.createPair(lispAdjacency, vni, ctx.getMappingContext())))
- .collect(RWUtils.singleItemCollector());
-
- builder.setId(currentAdjacencyId)
- .setKey(new AdjacencyKey(currentAdjacencyId))
- .setLocalEid(getArrayAsLocalEid(
- MappingsDumpParams.EidType.valueOf(currentAdjacency.eidType), currentAdjacency.leid, vni))
- .setRemoteEid(getArrayAsRemoteEid(
- MappingsDumpParams.EidType.valueOf(currentAdjacency.eidType), currentAdjacency.reid, vni));
- }
-
- private EntityDumpExecutor<LispAdjacenciesGetReply, AdjacencyDumpParams> createExecutor() {
- return (final InstanceIdentifier<?> identifier, final AdjacencyDumpParams params) -> {
- checkNotNull(params, "Dump parameters cannot be null");
-
- final LispAdjacenciesGet request = new LispAdjacenciesGet();
- request.vni = params.getVni();
-
- return getReplyForRead(getFutureJVpp().lispAdjacenciesGet(request).toCompletableFuture(), identifier);
- };
- }
-
- private class EidPairProducer implements EidTranslator {
-
- private final EidMappingContext localMappingContext;
- private final EidMappingContext remoteMappingContext;
-
- public EidPairProducer(final EidMappingContext localMappingContext,
- final EidMappingContext remoteMappingContext) {
- this.localMappingContext = checkNotNull(localMappingContext, "Local mapping context cannot be null");
- this.remoteMappingContext = checkNotNull(remoteMappingContext, "Remote mapping context cannot be null");
- }
-
- public EidIdentificatorPair createPair(final LispAdjacency data, final int vni,
- final MappingContext mappingContext) {
- return new EidIdentificatorPairBuilder()
- .setLocalEidId(new MappingId(localMappingContext.getId(getArrayAsEidLocal(
- MappingsDumpParams.EidType.valueOf(data.eidType), data.leid, vni), mappingContext)))
- .setRemoteEidId(new MappingId(remoteMappingContext.getId(getArrayAsEidLocal(
- MappingsDumpParams.EidType.valueOf(data.eidType), data.reid, vni), mappingContext)))
- .build();
- }
- }
-
- private static final class AdjacencyDumpParams {
-
- private final int vni;
-
- AdjacencyDumpParams(final int vni) {
- this.vni = vni;
- }
-
- public int getVni() {
- return this.vni;
- }
- }
-}
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
deleted file mode 100644
index 1d0d8a019..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizer.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.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.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.util.read.cache.DumpCacheManager.DumpCacheManagerBuilder;
-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.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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 final DumpCacheManager<LispEidTableMapDetailsReplyDump, SubtableDumpParams>
- dumpManager;
- private final NamingContext bridgeDomainContext;
-
- public BridgeDomainSubtableCustomizer(@Nonnull final FutureJVppCore futureJvppCore,
- @Nonnull final NamingContext bridgeDomainContext) {
- super(futureJvppCore);
- dumpManager =
- new DumpCacheManagerBuilder<LispEidTableMapDetailsReplyDump, SubtableDumpParams>()
- .withExecutor(createExecutor(futureJvppCore))
- .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 =
- dumpManager.getDump(id, ctx.getModificationCache(), 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/InterfaceCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizer.java
deleted file mode 100755
index 7291afb03..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizer.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 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.translate.read;
-
-
-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.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.trait.LocatorReader;
-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.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-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.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSetBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.InterfaceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.InterfaceKey;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-/**
- * Customizer for reading {@code Interface}<br> Currently not supported by jvpp
- */
-public class InterfaceCustomizer
- extends FutureJVppCustomizer
- implements ListReaderCustomizer<Interface, InterfaceKey, InterfaceBuilder>, LocatorReader {
-
- private final NamingContext interfaceContext;
- private final NamingContext locatorSetContext;
- private final DumpCacheManager<LispLocatorDetailsReplyDump, LocatorDumpParams> dumpCacheManager;
-
- public InterfaceCustomizer(@Nonnull final FutureJVppCore futureJvpp, @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext locatorSetContext) {
- super(futureJvpp);
- this.interfaceContext = checkNotNull(interfaceContext, "Interface context cannot be null");
- this.locatorSetContext = checkNotNull(locatorSetContext, "Locator set context cannot be null");
- this.dumpCacheManager =
- new DumpCacheManager.DumpCacheManagerBuilder<LispLocatorDetailsReplyDump, LocatorDumpParams>()
- .withExecutor(createLocatorDumpExecutor(futureJvpp))
- .build();
- }
-
- @Override
- public InterfaceBuilder getBuilder(InstanceIdentifier<Interface> id) {
- return new InterfaceBuilder();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<Interface> id, InterfaceBuilder builder, ReadContext ctx)
- throws ReadFailedException {
-
- final String locatorSetName = id.firstKeyOf(LocatorSet.class).getName();
- final String referencedInterfaceName = id.firstKeyOf(Interface.class).getInterfaceRef();
-
- checkState(interfaceContext.containsIndex(referencedInterfaceName, ctx.getMappingContext()),
- "No interface mapping for name %s", referencedInterfaceName);
- checkState(locatorSetContext.containsIndex(locatorSetName, ctx.getMappingContext()),
- "No locator set mapping for name %s", locatorSetName);
-
- final int locatorSetIndexIndex = locatorSetContext.getIndex(locatorSetName, ctx.getMappingContext());
- final int referencedInterfaceIndex =
- interfaceContext.getIndex(referencedInterfaceName, ctx.getMappingContext());
-
- final LocatorDumpParams params =
- new LocatorDumpParamsBuilder().setLocatorSetIndex(locatorSetIndexIndex).build();
-
- final Optional<LispLocatorDetailsReplyDump> reply =
- dumpCacheManager.getDump(id, ctx.getModificationCache(), params);
-
- if (!reply.isPresent() || reply.get().lispLocatorDetails.isEmpty()) {
- return;
- }
-
- final LispLocatorDetails details = reply.get()
- .lispLocatorDetails
- .stream()
- .filter(a -> a.swIfIndex == referencedInterfaceIndex)
- .collect(RWUtils.singleItemCollector());
-
- final String interfaceRef = interfaceContext.getName(details.swIfIndex, ctx.getMappingContext());
-
- builder.setPriority(Byte.valueOf(details.priority).shortValue());
- builder.setWeight(Byte.valueOf(details.weight).shortValue());
- builder.setInterfaceRef(interfaceRef);
- builder.setKey(new InterfaceKey(interfaceRef));
- }
-
- @Override
- public List<InterfaceKey> getAllIds(InstanceIdentifier<Interface> id, ReadContext context)
- throws ReadFailedException {
-
- checkState(id.firstKeyOf(LocatorSet.class) != null, "Cannot find reference to parent locator set");
- final String name = id.firstKeyOf(LocatorSet.class).getName();
-
- checkState(locatorSetContext.containsIndex(name, context.getMappingContext()), "No mapping for %s", name);
- final LocatorDumpParams params = new LocatorDumpParamsBuilder()
- .setLocatorSetIndex(locatorSetContext.getIndex(name, context.getMappingContext())).build();
-
- final Optional<LispLocatorDetailsReplyDump> reply =
- dumpCacheManager.getDump(id, context.getModificationCache(), params);
-
- if (!reply.isPresent() || reply.get().lispLocatorDetails.isEmpty()) {
- return Collections.emptyList();
- }
-
- return reply.get()
- .lispLocatorDetails
- .stream()
- .map(a -> new InterfaceKey(interfaceContext.getName(a.swIfIndex, context.getMappingContext())))
- .collect(Collectors.toList());
- }
-
- @Override
- public void merge(Builder<? extends DataObject> builder, List<Interface> readData) {
- ((LocatorSetBuilder) builder).setInterface(readData);
- }
-} \ No newline at end of file
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
deleted file mode 100644
index 8e8fd5848..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.translate.read;
-
-
-import static io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor.NO_PARAMS;
-
-import com.google.common.base.Optional;
-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.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocs;
-import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocsReply;
-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.rev161214.itr.remote.locator.sets.grouping.ItrRemoteLocatorSet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.itr.remote.locator.sets.grouping.ItrRemoteLocatorSetBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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;
-
-public class ItrRemoteLocatorSetCustomizer extends FutureJVppCustomizer
- implements ReaderCustomizer<ItrRemoteLocatorSet, ItrRemoteLocatorSetBuilder>, ByteDataTranslator,
- JvppReplyConsumer {
-
- private final DumpCacheManager<LispGetMapRequestItrRlocsReply, Void> dumpCacheManager;
-
- public ItrRemoteLocatorSetCustomizer(@Nonnull final FutureJVppCore futureJVppCore) {
- super(futureJVppCore);
- dumpCacheManager = new DumpCacheManagerBuilder<LispGetMapRequestItrRlocsReply, Void>()
- .withExecutor(((identifier, params) -> getReplyForRead(
- futureJVppCore.lispGetMapRequestItrRlocs(new LispGetMapRequestItrRlocs()).toCompletableFuture(),
- identifier)))
- .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 {
-
- final Optional<LispGetMapRequestItrRlocsReply> reply =
- dumpCacheManager.getDump(id, ctx.getModificationCache(), NO_PARAMS);
- 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/LispStateCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LispStateCustomizer.java
deleted file mode 100755
index 77374f9ad..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LispStateCustomizer.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.translate.read;
-
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer;
-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.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.ShowLispStatus;
-import io.fd.vpp.jvpp.core.dto.ShowLispStatusReply;
-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.rev161214.Lisp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.LispBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.LispState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.LispStateBuilder;
-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;
-
-
-/**
- * Customizer that handles reads of {@code LispState}
- */
-public class LispStateCustomizer extends FutureJVppCustomizer
- implements InitializingReaderCustomizer<LispState, LispStateBuilder>, JvppReplyConsumer, ByteDataTranslator {
-
- private static final Logger LOG = LoggerFactory.getLogger(LispStateCustomizer.class);
-
- public LispStateCustomizer(FutureJVppCore futureJvpp) {
- super(futureJvpp);
- }
-
- @Override
- public LispStateBuilder getBuilder(InstanceIdentifier<LispState> id) {
- return new LispStateBuilder();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<LispState> id, LispStateBuilder builder, ReadContext ctx)
- throws ReadFailedException {
-
- ShowLispStatusReply reply;
- try {
- reply = getReply(getFutureJVpp().showLispStatus(new ShowLispStatus()).toCompletableFuture());
- } catch (TimeoutException | VppBaseCallException e) {
- throw new ReadFailedException(id, e);
- }
-
- builder.setEnable(byteToBoolean(reply.featureStatus));
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final LispState readValue) {
- LOG.warn("Merge is unsupported for data roots");
- }
-
- @Override
- public Initialized<Lisp> init(
- @Nonnull final InstanceIdentifier<LispState> id, @Nonnull final LispState readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(InstanceIdentifier.create(Lisp.class),
-
- // set everything from LispState to LispBuilder
- // this is necessary in cases, when HC connects to a running VPP with some LISP configuration. HC needs to
- // reconstruct configuration based on what's present in VPP in order to support subsequent configuration changes
- // without any issues
-
- // the other reason this should work is HC persistence, so that HC after restart only performs diff (only push
- // configuration that is not currently in VPP, but is persisted. If they are equal skip any VPP calls)
- // updates to VPP. If this is not fully implemented (depending on VPP implementation, restoration of persisted
- // configuration can fail)
- new LispBuilder()
- .setEnable(readValue.isEnable())
- .setLispFeatureData(readValue.getLispFeatureData())
- .build());
- }
-}
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
deleted file mode 100755
index e989a393d..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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.translate.read;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-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 io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.QuantityType;
-
-import com.google.common.base.Optional;
-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.read.trait.MappingReader;
-import io.fd.honeycomb.lisp.translate.util.EidTranslator;
-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.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.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.LocalMappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-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;
-
-/**
- * Customizer for reading {@code LocalMapping}<br> Currently unsupported by jvpp
- */
-public class LocalMappingCustomizer
- extends FutureJVppCustomizer
- implements ListReaderCustomizer<LocalMapping, LocalMappingKey, LocalMappingBuilder>, EidTranslator,
- MappingReader {
-
- private static final Logger LOG = LoggerFactory.getLogger(LocalMappingCustomizer.class);
-
- private final DumpCacheManager<LispEidTableDetailsReplyDump, MappingsDumpParams> dumpManager;
- private final NamingContext locatorSetContext;
- private final EidMappingContext localMappingContext;
-
- public LocalMappingCustomizer(@Nonnull FutureJVppCore futureJvpp, @Nonnull NamingContext locatorSetContext,
- @Nonnull EidMappingContext localMappingsContext) {
- super(futureJvpp);
- this.locatorSetContext = checkNotNull(locatorSetContext, "Locator Set Mapping Context cannot be null");
- this.localMappingContext = checkNotNull(localMappingsContext, "Local mappings context cannot be null");
- this.dumpManager =
- new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableDetailsReplyDump, MappingsDumpParams>()
- .withExecutor(createMappingDumpExecutor(futureJvpp))
- .build();
- }
-
- @Override
- public LocalMappingBuilder getBuilder(InstanceIdentifier<LocalMapping> id) {
- return new LocalMappingBuilder();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<LocalMapping> id, LocalMappingBuilder builder,
- ReadContext ctx) throws ReadFailedException {
- checkState(id.firstKeyOf(LocalMapping.class) != null, "No key present for id({})", id);
- checkState(id.firstKeyOf(VniTable.class) != null, "Parent VNI table not specified");
-
- //checks whether there is an existing mapping
- final MappingId mappingId = id.firstKeyOf(LocalMapping.class).getId();
- checkState(localMappingContext.containsEid(mappingId, ctx.getMappingContext()));
-
- final long vni = id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier();
-
- final String localMappingId = id.firstKeyOf(LocalMapping.class).getId().getValue();
- final Eid eid = localMappingContext.getEid(mappingId, ctx.getMappingContext());
-
- //Requesting for specific mapping dump,only from local mappings with specified eid/vni/eid type
- final MappingsDumpParams dumpParams = new MappingsDumpParams.MappingsDumpParamsBuilder()
- .setEidSet(QuantityType.SPECIFIC)
- .setVni(Long.valueOf(vni).intValue())
- .setEid(getEidAsByteArray(eid))
- .setEidType(getEidType(eid))
- .setPrefixLength(getPrefixLength(eid))
- .build();
-
- LOG.debug("Dumping data for LocalMappings(id={})", id);
- final Optional<LispEidTableDetailsReplyDump> replyOptional =
- dumpManager.getDump(id, ctx.getModificationCache(), dumpParams);
-
- if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) {
- return;
- }
-
- LispEidTableDetails details = replyOptional.get().lispEidTableDetails.stream()
- .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, details.vni));
- }
-
- private Address getAddressFromDumpDetail(final LispEidTableDetails detail) {
- return getArrayAsEidLocal(valueOf(detail.eidType), detail.eid, detail.vni).getAddress();
- }
-
- @Override
- public List<LocalMappingKey> getAllIds(InstanceIdentifier<LocalMapping> id, ReadContext context)
- throws ReadFailedException {
-
- checkState(id.firstKeyOf(VniTable.class) != null, "Parent VNI table not specified");
- final long vni = id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier();
-
- if (vni == 0) {
- // ignoring default vni mapping
- // its not relevant for us and we also don't store mapping for such eid's
- // such mapping is used to create helper local mappings to process remote ones
- return Collections.emptyList();
- }
-
- //request for all local mappings
- final MappingsDumpParams dumpParams = new MappingsDumpParamsBuilder()
- .setFilter(FilterType.LOCAL)
- .setEidSet(QuantityType.ALL)
- .build();
-
- LOG.debug("Dumping data for LocalMappings(id={})", id);
- final Optional<LispEidTableDetailsReplyDump> replyOptional =
- dumpManager.getDump(id, context.getModificationCache(), dumpParams);
-
- if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) {
- return Collections.emptyList();
- }
-
-
- return replyOptional.get().lispEidTableDetails.stream()
- .filter(a -> a.vni == vni)
- .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());
- }
-
- @Override
- public void merge(Builder<? extends DataObject> builder, List<LocalMapping> readData) {
- ((LocalMappingsBuilder) builder).setLocalMapping(readData);
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizer.java
deleted file mode 100755
index ff0855a74..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizer.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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.translate.read;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-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.trait.LocatorSetReader;
-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.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetails;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump;
-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.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.LocatorSetsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSetBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSetKey;
-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 LocatorSetCustomizer extends FutureJVppCustomizer
- implements ListReaderCustomizer<LocatorSet, LocatorSetKey, LocatorSetBuilder>, ByteDataTranslator,
- LocatorSetReader {
-
- private static final Logger LOG = LoggerFactory.getLogger(LocatorSetCustomizer.class);
-
- private final DumpCacheManager<LispLocatorSetDetailsReplyDump, Void> dumpManager;
- private final NamingContext locatorSetContext;
-
- public LocatorSetCustomizer(@Nonnull final FutureJVppCore futureJvpp,
- @Nonnull final NamingContext locatorSetContext) {
- super(futureJvpp);
- this.locatorSetContext = checkNotNull(locatorSetContext, "Locator Set mapping context cannot be null");
- this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder<LispLocatorSetDetailsReplyDump, Void>()
- .withExecutor(createExecutor(futureJvpp))
- .build();
- }
-
- @Override
- public LocatorSetBuilder getBuilder(InstanceIdentifier<LocatorSet> id) {
- return new LocatorSetBuilder();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<LocatorSet> id, LocatorSetBuilder builder, ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading attributes for Locator Set {}", id);
-
- final Optional<LispLocatorSetDetailsReplyDump> dumpOptional =
- dumpManager.getDump(id, ctx.getModificationCache(), NO_PARAMS);
-
- if (!dumpOptional.isPresent() || dumpOptional.get().lispLocatorSetDetails.isEmpty()) {
- return;
- }
-
- String keyName = id.firstKeyOf(LocatorSet.class).getName();
- LispLocatorSetDetailsReplyDump dump = dumpOptional.get();
-
- java.util.Optional<LispLocatorSetDetails> details = dump.lispLocatorSetDetails.stream()
- .filter(n -> keyName.equals(toString(n.lsName)))
- .findFirst();
-
- if (details.isPresent()) {
- final String name = toString(details.get().lsName);
-
- builder.setName(name);
- builder.setKey(new LocatorSetKey(name));
- } else {
- LOG.warn("Locator Set {} not found in dump", id);
- }
- }
-
- @Override
- public List<LocatorSetKey> getAllIds(InstanceIdentifier<LocatorSet> id, ReadContext context)
- throws ReadFailedException {
- LOG.debug("Dumping Locator Set {}", id);
-
- final Optional<LispLocatorSetDetailsReplyDump> dumpOptional =
- dumpManager.getDump(id, context.getModificationCache(), NO_PARAMS);
-
- if (!dumpOptional.isPresent() || dumpOptional.get().lispLocatorSetDetails.isEmpty()) {
- return Collections.emptyList();
- }
-
- return dumpOptional.get().lispLocatorSetDetails.stream()
- .map(set -> {
-
- final String locatorSetName = toString(set.lsName);
- //creates mapping for existing locator-set(if it is'nt already existing one)
- if (!locatorSetContext.containsIndex(locatorSetName, context.getMappingContext())) {
- locatorSetContext.addName(set.lsIndex, locatorSetName, context.getMappingContext());
- }
-
- LOG.trace("Locator Set with name: {}, VPP name: {} and index: {} found in VPP",
- locatorSetContext.getName(set.lsIndex, context.getMappingContext()),
- locatorSetName,
- set.lsIndex);
-
- return set;
- })
- .map(set -> new LocatorSetKey(toString(set.lsName)))
- .collect(Collectors.toList());
- }
-
- @Override
- public void merge(Builder<? extends DataObject> builder, List<LocatorSet> readData) {
- ((LocatorSetsBuilder) builder).setLocatorSet(readData);
- }
-}
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
deleted file mode 100755
index fb44e13e9..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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.translate.read;
-
-import static io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor.NO_PARAMS;
-
-import com.google.common.base.Optional;
-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.vpp.util.AddressTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispMapResolverDetails;
-import io.fd.vpp.jvpp.core.dto.LispMapResolverDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.LispMapResolverDump;
-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;
-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.rev161214.map.resolvers.grouping.MapResolversBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolver;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolverBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolverKey;
-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 MapResolverCustomizer extends FutureJVppCustomizer
- implements ListReaderCustomizer<MapResolver, MapResolverKey, MapResolverBuilder>, AddressTranslator,
- JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(MapResolverCustomizer.class);
-
- private final DumpCacheManager<LispMapResolverDetailsReplyDump, Void> dumpManager;
-
- public MapResolverCustomizer(FutureJVppCore futureJvpp) {
- super(futureJvpp);
- this.dumpManager =
- new DumpCacheManager.DumpCacheManagerBuilder<LispMapResolverDetailsReplyDump, Void>()
- .withExecutor((identifier, params) -> getReplyForRead(
- futureJvpp.lispMapResolverDump(new LispMapResolverDump()).toCompletableFuture(),
- identifier))
- .build();
- }
-
- @Override
- public MapResolverBuilder getBuilder(InstanceIdentifier<MapResolver> id) {
- return new MapResolverBuilder();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<MapResolver> id, MapResolverBuilder builder, ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading attributes...");
-
- final Optional<LispMapResolverDetailsReplyDump> dumpOptional =
- dumpManager.getDump(id, ctx.getModificationCache(), NO_PARAMS);
-
- if (!dumpOptional.isPresent() || dumpOptional.get().lispMapResolverDetails.isEmpty()) {
- LOG.warn("No data dumped");
- return;
- }
-
- final MapResolverKey key = id.firstKeyOf(MapResolver.class);
- final LispMapResolverDetails mapResolverDetails =
- dumpOptional.get().lispMapResolverDetails.stream()
- .filter(a -> addressesEqual(key.getIpAddress(),
- arrayToIpAddressReversed(byteToBoolean(a.isIpv6), a.ipAddress)))
- .collect(RWUtils.singleItemCollector());
-
- builder.setKey(key);
- builder.setIpAddress(
- 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 {
- LOG.debug("Dumping MapResolver...");
-
- final Optional<LispMapResolverDetailsReplyDump> dumpOptional =
- dumpManager.getDump(id, context.getModificationCache(), NO_PARAMS);
-
- if (!dumpOptional.isPresent() || dumpOptional.get().lispMapResolverDetails.isEmpty()) {
- return Collections.emptyList();
- }
-
- return dumpOptional.get().lispMapResolverDetails.stream()
- .map(resolver -> new MapResolverKey(
- arrayToIpAddressReversed(byteToBoolean(resolver.isIpv6), resolver.ipAddress)))
- .collect(Collectors.toList());
- }
-
- @Override
- public void merge(Builder<? extends DataObject> builder, List<MapResolver> readData) {
- ((MapResolversBuilder) builder).setMapResolver(readData);
- }
-}
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
deleted file mode 100755
index 7b049c043..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizer.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.translate.read;
-
-
-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.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.rev161214.lisp.feature.data.grouping.LispFeatureDataBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfg;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfgBuilder;
-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.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.ShowLispPitr;
-import io.fd.vpp.jvpp.core.dto.ShowLispPitrReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * Customizer for reading {@link PitrCfg}<br> Currently unsupported in jvpp
- */
-public class PitrCfgCustomizer extends FutureJVppCustomizer
- implements ReaderCustomizer<PitrCfg, PitrCfgBuilder>, ByteDataTranslator, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(PitrCfgCustomizer.class);
-
- public PitrCfgCustomizer(FutureJVppCore futureJvpp) {
- super(futureJvpp);
- }
-
- @Override
- public PitrCfgBuilder getBuilder(InstanceIdentifier<PitrCfg> id) {
- return new PitrCfgBuilder();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<PitrCfg> id, PitrCfgBuilder builder, ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading status for Lisp Pitr node {}", id);
-
- ShowLispPitrReply reply;
-
- try {
- reply = getPitrStatus();
- } catch (TimeoutException | VppBaseCallException e) {
- throw new ReadFailedException(id, e);
- }
-
- builder.setLocatorSet(toString(reply.locatorSetName));
- LOG.debug("Reading status for Lisp Pitr node {} successfull", id);
- }
-
- @Override
- public void merge(Builder<? extends DataObject> parentBuilder, PitrCfg readValue) {
- ((LispFeatureDataBuilder) parentBuilder).setPitrCfg(readValue);
- }
-
- public ShowLispPitrReply getPitrStatus() throws TimeoutException, VppBaseCallException {
- return getReply(getFutureJVpp().showLispPitr(new ShowLispPitr()).toCompletableFuture());
- }
-}
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
deleted file mode 100755
index b0e9056fc..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * 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.translate.read;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-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.rev161214.MapReplyAction.NoAction;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableSet;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-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.LocatorReader;
-import io.fd.honeycomb.lisp.translate.read.trait.MappingReader;
-import io.fd.honeycomb.lisp.translate.util.EidTranslator;
-import io.fd.honeycomb.translate.MappingContext;
-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.IdentifierCacheKeyFactory;
-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.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.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.rev161214.MapReplyAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.NegativeMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.PositiveMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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.rev161214.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.rev161214.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.rev161214.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.rev161214.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.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.LocatorSets;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSetKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.Interface;
-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;
-
-/**
- * Customizer for reading {@code RemoteMapping}<br>
- */
-public class RemoteMappingCustomizer extends FutureJVppCustomizer
- implements ListReaderCustomizer<RemoteMapping, RemoteMappingKey, RemoteMappingBuilder>,
- EidTranslator, AddressTranslator, ByteDataTranslator, MappingReader, LocatorReader {
-
- private static final Logger LOG = LoggerFactory.getLogger(RemoteMappingCustomizer.class);
-
- private final DumpCacheManager<LispEidTableDetailsReplyDump, MappingsDumpParams> dumpManager;
- private final DumpCacheManager<LispLocatorDetailsReplyDump, LocatorDumpParams> locatorsDumpManager;
- private final NamingContext locatorSetContext;
- private final EidMappingContext remoteMappingContext;
-
- public RemoteMappingCustomizer(@Nonnull final FutureJVppCore futureJvpp,
- @Nonnull final NamingContext locatorSetContext,
- @Nonnull final EidMappingContext remoteMappingContext) {
- super(futureJvpp);
- this.locatorSetContext = checkNotNull(locatorSetContext, "Locator sets context not present");
- this.remoteMappingContext = checkNotNull(remoteMappingContext, "Remote mappings not present");
- // this one should have default scope == RemoteMapping
- this.dumpManager =
- new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableDetailsReplyDump, MappingsDumpParams>()
- .withExecutor(createMappingDumpExecutor(futureJvpp))
- .build();
-
- // cache key needs to have locator set scope to not mix with cached data
- this.locatorsDumpManager =
- new DumpCacheManager.DumpCacheManagerBuilder<LispLocatorDetailsReplyDump, LocatorDumpParams>()
- .withExecutor(createLocatorDumpExecutor(futureJvpp))
- .withCacheKeyFactory(new IdentifierCacheKeyFactory(ImmutableSet.of(LocatorSet.class)))
- .build();
- }
-
-
- @Override
- public RemoteMappingBuilder getBuilder(InstanceIdentifier<RemoteMapping> id) {
- return new RemoteMappingBuilder();
- }
-
- private Eid copyEid(
- org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid eid) {
- return new EidBuilder().setAddress(eid.getAddress()).setAddressType(eid.getAddressType())
- .setVirtualNetworkId(eid.getVirtualNetworkId()).build();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<RemoteMapping> id, RemoteMappingBuilder builder,
- ReadContext ctx)
- throws ReadFailedException {
- checkState(id.firstKeyOf(RemoteMapping.class) != null, "No key present for id({})", id);
- checkState(id.firstKeyOf(VniTable.class) != null, "Parent VNI table not specified");
-
- final MappingId mappingId = id.firstKeyOf(RemoteMapping.class).getId();
- checkState(remoteMappingContext.containsEid(mappingId, ctx.getMappingContext()),
- "No mapping stored for id %s", mappingId);
-
- final long vni = id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier();
- final String remoteMappingId = id.firstKeyOf(RemoteMapping.class).getId().getValue();
- final Eid eid = copyEid(remoteMappingContext.getEid(mappingId, ctx.getMappingContext()));
- final MappingsDumpParams dumpParams = new MappingsDumpParamsBuilder()
- .setVni(Long.valueOf(vni).intValue())
- .setEidSet(QuantityType.SPECIFIC)
- .setEidType(getEidType(eid))
- .setEid(getEidAsByteArray(eid))
- .setPrefixLength(getPrefixLength(eid))
- .setFilter(FilterType.REMOTE)
- .build();
-
- LOG.debug("Dumping data for LocalMappings(id={})", id);
- final Optional<LispEidTableDetailsReplyDump> replyOptional =
- dumpManager.getDump(id, ctx.getModificationCache(), dumpParams);
-
- if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) {
- return;
- }
-
- 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, a.vni).getAddress()))
- .collect(
- RWUtils.singleItemCollector());
-
- 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)));
- resolveMappings(id, builder, details, ctx.getModificationCache(), ctx.getMappingContext());
- }
-
- //compensate ~0 as default value of ttl
- private static long resolveTtl(final int ttlValue) {
- return ttlValue == -1
- ? Integer.MAX_VALUE
- : ttlValue;
- }
-
- @Override
- public List<RemoteMappingKey> getAllIds(InstanceIdentifier<RemoteMapping> id, ReadContext context)
- throws ReadFailedException {
-
- checkState(id.firstKeyOf(VniTable.class) != null, "Parent VNI table not specified");
- final int vni = id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier().intValue();
-
- if (vni == 0) {
- // ignoring default vni mapping
- // it's not relevant for us and we also don't store mapping for such eid's
- // such mapping is used to create helper local mappings to process remote ones
- return Collections.emptyList();
- }
-
- //requesting all remote with specific vni
- final MappingsDumpParams dumpParams = new MappingsDumpParamsBuilder()
- .setEidSet(QuantityType.ALL)
- .setFilter(FilterType.REMOTE)
- .build();
-
- LOG.debug("Dumping data for LocalMappings(id={})", id);
- final Optional<LispEidTableDetailsReplyDump> replyOptional =
- dumpManager.getDump(id, context.getModificationCache(), dumpParams);
-
- if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) {
- return Collections.emptyList();
- }
-
- return replyOptional.get()
- .lispEidTableDetails
- .stream()
- .filter(a -> a.vni == vni)
- .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());
- }
-
- @Override
- public void merge(Builder<? extends DataObject> builder, List<RemoteMapping> readData) {
- ((RemoteMappingsBuilder) builder).setRemoteMapping(readData);
- }
-
- private void resolveMappings(final InstanceIdentifier id, final RemoteMappingBuilder builder,
- final LispEidTableDetails details,
- final ModificationCache cache,
- final MappingContext mappingContext) 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;
-
- // this will serve to achieve that locators have locator set scope
- final InstanceIdentifier<Interface> locatorIfaceIdentifier = InstanceIdentifier.create(LocatorSets.class)
- .child(LocatorSet.class,
- new LocatorSetKey(locatorSetContext.getName(details.locatorSetIndex, mappingContext)))
- .child(Interface.class);
- try {
- reply = locatorsDumpManager.getDump(locatorIfaceIdentifier, cache,
- new LocatorDumpParamsBuilder().setLocatorSetIndex(details.locatorSetIndex).build());
- } catch (ReadFailedException e) {
- throw new ReadFailedException(id,
- new IllegalStateException("Unable to resolve Positive/Negative mapping for RemoteMapping",
- e.getCause()));
- }
-
- 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
deleted file mode 100755
index 49047bcc9..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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.translate.read;
-
-import static com.google.common.base.Preconditions.checkState;
-import static io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor.NO_PARAMS;
-
-import com.google.common.base.Optional;
-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.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetails;
-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.Collections;
-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.rev161214.eid.table.grouping.EidTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableKey;
-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;
-
-/**
- * Handles the reads of {@link VniTable} nodes
- */
-public class VniTableCustomizer extends FutureJVppCustomizer
- implements ListReaderCustomizer<VniTable, VniTableKey, VniTableBuilder>, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(VniTableCustomizer.class);
-
- private final DumpCacheManager<LispEidTableVniDetailsReplyDump, Void> dumpManager;
-
- public VniTableCustomizer(@Nonnull final FutureJVppCore futureJvpp) {
- super(futureJvpp);
- this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableVniDetailsReplyDump, Void>()
- .withExecutor(((identifier, params) -> getReplyForRead(
- futureJvpp.lispEidTableVniDump(new LispEidTableVniDump()).toCompletableFuture(), identifier)))
- .build();
- }
-
- private static VniTableKey detailsToKey(final LispEidTableVniDetails lispEidTableMapDetails) {
- return new VniTableKey(Integer.valueOf(lispEidTableMapDetails.vni).longValue());
-
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder, @Nonnull final List<VniTable> readData) {
- ((EidTableBuilder) builder).setVniTable(readData);
- }
-
- @Nonnull
- @Override
- public VniTableBuilder getBuilder(@Nonnull final InstanceIdentifier<VniTable> id) {
- return new VniTableBuilder();
- }
-
- @Nonnull
- @Override
- public List<VniTableKey> getAllIds(@Nonnull final InstanceIdentifier<VniTable> id,
- @Nonnull final ReadContext context)
- throws ReadFailedException {
- LOG.trace("Reading all IDS...");
-
- final Optional<LispEidTableVniDetailsReplyDump> optionalReply =
- dumpManager.getDump(id, context.getModificationCache(), NO_PARAMS);
-
- if (!optionalReply.isPresent() || optionalReply.get().lispEidTableVniDetails.isEmpty()) {
- return Collections.emptyList();
- }
-
- return optionalReply.get().lispEidTableVniDetails.stream().map(VniTableCustomizer::detailsToKey)
- .collect(Collectors.toList());
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<VniTable> id,
- @Nonnull final VniTableBuilder builder, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
-
- checkState(id.firstKeyOf(VniTable.class) != null, "No VNI present");
- VniTableKey key = new VniTableKey(id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier());
-
- final Optional<LispEidTableVniDetailsReplyDump> optionalReply =
- dumpManager.getDump(id, ctx.getModificationCache(), NO_PARAMS);
-
- if (!optionalReply.isPresent() || optionalReply.get().lispEidTableVniDetails.isEmpty()) {
- return;
- }
-
- //transforming right away to single detail(specific request should do the magic)
- final LispEidTableVniDetails details = optionalReply.get()
- .lispEidTableVniDetails
- .stream()
- .filter(a -> a.vni == key.getVirtualNetworkIdentifier().intValue())
- .collect(RWUtils.singleItemCollector());
-
- builder.setVirtualNetworkIdentifier((long) details.vni);
- 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
deleted file mode 100644
index af48a6500..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizer.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.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.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.util.read.cache.DumpCacheManager.DumpCacheManagerBuilder;
-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.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.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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 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 final DumpCacheManager<LispEidTableMapDetailsReplyDump, SubtableDumpParams> dumpManager;
-
- public VrfSubtableCustomizer(@Nonnull final FutureJVppCore futureJvpp) {
- super(futureJvpp);
- dumpManager = new DumpCacheManagerBuilder<LispEidTableMapDetailsReplyDump, SubtableDumpParams>()
- .withExecutor(createExecutor(futureJvpp))
- .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 = dumpManager.getDump(id, ctx.getModificationCache(), 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/params/LocatorDumpParams.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/LocatorDumpParams.java
deleted file mode 100644
index 7528d1d68..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/LocatorDumpParams.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.translate.read.dump.executor.params;
-
-/**
- * Params for dumping locators
- */
-public final class LocatorDumpParams {
-
- private final int locatorSetIndex;
-
- private LocatorDumpParams(LocatorDumpParamsBuilder builder) {
- this.locatorSetIndex = builder.locatorSetIndex;
- }
-
- public int getLocatorSetIndex() {
- return locatorSetIndex;
- }
-
- public static final class LocatorDumpParamsBuilder {
-
- private int locatorSetIndex;
-
- public LocatorDumpParamsBuilder setLocatorSetIndex(final int locatorSetIndex) {
- this.locatorSetIndex = locatorSetIndex;
- return this;
- }
-
- public LocatorDumpParams build() {
- return new LocatorDumpParams(this);
- }
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/MappingsDumpParams.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/MappingsDumpParams.java
deleted file mode 100755
index d1af212b8..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/MappingsDumpParams.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * 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.translate.read.dump.executor.params;
-
-import java.util.Arrays;
-
-/**
- * Parameters for executing dump of mappings
- */
-public final class MappingsDumpParams {
-
- private final byte eidSet;
- private final byte prefixLength;
- private final int vni;
- private final byte eidType;
- private final byte[] eid;
- private final byte filter;
-
- private MappingsDumpParams(MappingsDumpParamsBuilder builder) {
- this.eidSet = builder.eidSet;
- this.prefixLength = builder.prefixLength;
- this.vni = builder.vni;
- this.eidType = builder.eidType;
- this.eid = builder.eid;
- this.filter = builder.filter;
- }
-
-
- public byte getEidSet() {
- return eidSet;
- }
-
- public byte getPrefixLength() {
- return prefixLength;
- }
-
- public int getVni() {
- return vni;
- }
-
- public byte getEidType() {
- return eidType;
- }
-
- public byte[] getEid() {
- return eid;
- }
-
- public final byte getFilter() {
- return filter;
- }
-
- @Override
- public String toString() {
- return "MappingsDumpParams{" +
- "eidSet=" + eidSet +
- ", prefixLength=" + prefixLength +
- ", vni=" + vni +
- ", eidType=" + eidType +
- ", eid=" + Arrays.toString(eid) +
- ", filter=" + filter +
- '}';
- }
-
- /**
- * Type of requested mapping eid
- */
- public enum EidType {
- IPV4(0),
- IPV6(1),
- MAC(2);
-
- private final int value;
-
- private EidType(final int value) {
- this.value = value;
- }
-
- public static final EidType valueOf(int value) {
- switch (value) {
- case 0:
- return IPV4;
- case 1:
- return IPV6;
- case 2:
- return MAC;
- default:
- throw new IllegalArgumentException("Illegal value");
- }
- }
-
- public final int getValue() {
- return this.value;
- }
- }
-
- /**
- * Type of requested mapping
- */
- public enum FilterType {
- ALL(0),
- LOCAL(1),
- REMOTE(2);
-
- private final int value;
-
- private FilterType(final int value) {
- this.value = value;
- }
-
- public final int getValue() {
- return this.value;
- }
- }
-
- public enum QuantityType {
- ALL(0),
- SPECIFIC(1);
-
- private final int value;
-
- private QuantityType(final int value) {
- this.value = value;
- }
-
- public final int getValue() {
- return this.value;
- }
- }
-
- public static final class MappingsDumpParamsBuilder {
- private byte eidSet;
- private byte prefixLength;
- private int vni;
- private byte eidType;
- private byte[] eid;
- private byte filter;
-
- public static final MappingsDumpParamsBuilder newInstance() {
- return new MappingsDumpParamsBuilder();
- }
-
- public MappingsDumpParamsBuilder setEidSet(final QuantityType quantityType) {
- this.eidSet = (byte) quantityType.getValue();
- return this;
- }
-
- public MappingsDumpParamsBuilder setPrefixLength(final byte prefixLength) {
- this.prefixLength = prefixLength;
- return this;
- }
-
- public MappingsDumpParamsBuilder setVni(final int vni) {
- this.vni = vni;
- return this;
- }
-
- public MappingsDumpParamsBuilder setEidType(final EidType eidType) {
- this.eidType = (byte) eidType.getValue();
- return this;
- }
-
- public MappingsDumpParamsBuilder setEid(final byte[] eid) {
- this.eid = eid;
- return this;
- }
-
- public MappingsDumpParamsBuilder setFilter(final FilterType filterType) {
- this.filter = (byte) filterType.getValue();
- return this;
- }
-
- public MappingsDumpParams build() {
- return new MappingsDumpParams(this);
- }
- }
-}
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
deleted file mode 100644
index 678255c02..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/SubtableDumpParams.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.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.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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
deleted file mode 100644
index 8eb3d53da..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/AbstractLispReaderFactoryBase.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.translate.read.factory;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-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.rev161214.LispState;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Basic attributes for lisp reader factories
- */
-abstract class AbstractLispReaderFactoryBase {
-
- protected final InstanceIdentifier<LispState> lispStateId;
- protected final FutureJVppCore vppApi;
- protected NamingContext interfaceContext;
- protected NamingContext locatorSetContext;
- protected NamingContext bridgeDomainContext;
- protected EidMappingContext localMappingContext;
- protected EidMappingContext remoteMappingContext;
-
- protected AbstractLispReaderFactoryBase(@Nonnull final InstanceIdentifier<LispState> lispStateId,
- @Nonnull final FutureJVppCore vppApi) {
- this.lispStateId = checkNotNull(lispStateId, "Lisp state identifier is null");
- this.vppApi = checkNotNull(vppApi, "VPP api refference is null");
- }
-
- protected AbstractLispReaderFactoryBase(@Nonnull final InstanceIdentifier<LispState> lispStateId,
- @Nonnull final FutureJVppCore vppApi,
- @Nonnull final NamingContext interfaceContext,
- @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.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");
- }
-
- protected AbstractLispReaderFactoryBase(@Nonnull final InstanceIdentifier<LispState> lispStateId,
- @Nonnull final FutureJVppCore vppApi,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext locatorSetContext,
- @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.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");
- }
-
- 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
deleted file mode 100755
index 553b5b548..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/EidTableReaderFactory.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * 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.translate.read.factory;
-
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.collect.ImmutableSet;
-import io.fd.honeycomb.lisp.context.util.AdjacenciesMappingContext;
-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.rev161214.LispState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.Adjacencies;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.AdjacenciesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.LocalEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.RemoteEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.LocalMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.LocalMappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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.rev161214.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.rev161214.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.rev161214.eid.table.grouping.EidTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-/**
- * Factory that produces {@code Reader} for {@code EidTable}<br> with all its inhired child readers
- */
-final class EidTableReaderFactory extends AbstractLispReaderFactoryBase implements ReaderFactory {
-
- private final AdjacenciesMappingContext adjacenciesMappingContext;
-
- private EidTableReaderFactory(final InstanceIdentifier<LispState> lispStateId,
- final FutureJVppCore vppApi,
- final NamingContext interfaceContext,
- final NamingContext locatorSetContext,
- final NamingContext bridgeDomainContext,
- final EidMappingContext localMappingContext,
- final EidMappingContext remoteMappingContext,
- final AdjacenciesMappingContext adjacenciesMappingContext) {
- super(lispStateId, vppApi, interfaceContext, locatorSetContext, bridgeDomainContext, localMappingContext,
- remoteMappingContext);
- this.adjacenciesMappingContext = checkNotNull(adjacenciesMappingContext, "Adjacencies context cannot be null");
- }
-
- 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,
- @Nonnull final AdjacenciesMappingContext adjacenciesMappingContext) {
- return new EidTableReaderFactory(lispStateId, vppApi, interfaceContext, locatorSetContext, bridgeDomainContext,
- localMappingContext, remoteMappingContext, adjacenciesMappingContext);
- }
-
- @Override
- public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
- 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)));
-
- //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.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid.class)),
- new GenericListReader<>(vrfTableLocalMappingsInstanceIdentifier.child(LocalMapping.class),
- new LocalMappingCustomizer(vppApi, locatorSetContext, localMappingContext)));
-
- //EidTable -> VniTable -> BridgeDomainSubtable -> LocalMappings -> LocalMapping
- registry.subtreeAdd(ImmutableSet.of(localMappingSubtreeId
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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.rev161214.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, locatorSetContext, remoteMappingContext)));
- registry.subtreeAdd(ImmutableSet.of(remoteMappingSubtreeId
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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, locatorSetContext, remoteMappingContext)));
-
- 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<>(vrfTableAdjacenciesInstanceIdentifier.child(Adjacency.class),
- new AdjacencyCustomizer(vppApi, localMappingContext, remoteMappingContext,
- adjacenciesMappingContext)));
- registry.subtreeAdd(
- ImmutableSet.of(adjacencySubtreeId.child(LocalEid.class), adjacencySubtreeId.child(RemoteEid.class)),
- new GenericListReader<>(bridgeDomainAdjacenciesInstanceIdentifier.child(Adjacency.class),
- new AdjacencyCustomizer(vppApi, localMappingContext, remoteMappingContext,
- adjacenciesMappingContext)));
- }
-}
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
deleted file mode 100755
index e96246b43..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LispStateReaderFactory.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.translate.read.factory;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.ADJACENCIES_IDENTIFICATION_CONTEXT;
-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;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.REMOTE_MAPPING_CONTEXT;
-
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import io.fd.honeycomb.lisp.context.util.AdjacenciesMappingContext;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.translate.read.LispStateCustomizer;
-import io.fd.honeycomb.lisp.translate.read.PitrCfgCustomizer;
-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.rev161214.LispState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureDataBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfg;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-/**
- * Initialize readers for {@link LispState}
- */
-public class LispStateReaderFactory extends AbstractLispReaderFactoryBase implements ReaderFactory {
-
- private final AdjacenciesMappingContext adjacenciesIdentificationContext;
-
- @Inject
- 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,
- @Named(ADJACENCIES_IDENTIFICATION_CONTEXT) final
- AdjacenciesMappingContext adjacenciesIdentificationContext) {
- super(InstanceIdentifier.create(LispState.class), vppApi, interfaceContext, locatorSetContext,
- bridgeDomainContext, localMappingContext, remoteMappingContext);
- this.adjacenciesIdentificationContext =
- checkNotNull(adjacenciesIdentificationContext, "Adjacencies mapping context cannot be null");
- }
-
- @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, bridgeDomainContext,
- localMappingContext, remoteMappingContext, adjacenciesIdentificationContext)
- .init(registry);
-
- 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
deleted file mode 100755
index c0d9468af..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LocatorSetsReaderFactory.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.translate.read.factory;
-
-
-import io.fd.honeycomb.lisp.translate.read.InterfaceCustomizer;
-import io.fd.honeycomb.lisp.translate.read.LocatorSetCustomizer;
-import io.fd.honeycomb.translate.impl.read.GenericListReader;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-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.rev161214.LispState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.LocatorSets;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.LocatorSetsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.Interface;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Produces reader for {@link LocatorSets} <br> and all its inhired child readers.
- */
-public class LocatorSetsReaderFactory extends AbstractLispReaderFactoryBase implements ReaderFactory {
-
-
- private LocatorSetsReaderFactory(final InstanceIdentifier<LispState> lispStateId,
- final FutureJVppCore vppApi,
- final NamingContext interfaceContext,
- final NamingContext locatorSetContext) {
- super(lispStateId, vppApi);
- this.interfaceContext = interfaceContext;
- this.locatorSetContext = locatorSetContext;
- }
-
- public static final LocatorSetsReaderFactory newInstance(@Nonnull final InstanceIdentifier<LispState> lispStateId,
- @Nonnull final FutureJVppCore vppApi,
- final NamingContext interfaceContext,
- @Nonnull final NamingContext locatorSetContext) {
- return new LocatorSetsReaderFactory(lispStateId, vppApi, interfaceContext, locatorSetContext);
- }
-
- @Override
- public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
- InstanceIdentifier<LocatorSets> locatorSetsInstanceIdentifier = lispStateId.child(LispFeatureData.class).child(LocatorSets.class);
- InstanceIdentifier<LocatorSet> locatorSetInstanceIdentifier =
- locatorSetsInstanceIdentifier.child(LocatorSet.class);
-
- registry.addStructuralReader(locatorSetsInstanceIdentifier, LocatorSetsBuilder.class);
- registry.add(new GenericListReader<>(locatorSetInstanceIdentifier,
- new LocatorSetCustomizer(vppApi, locatorSetContext)));
- registry.add(new GenericListReader<>(locatorSetInstanceIdentifier.child(Interface.class),
- new InterfaceCustomizer(vppApi, interfaceContext, locatorSetContext)));
- }
-}
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
deleted file mode 100755
index 866f13719..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/MapResolversReaderFactory.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.translate.read.factory;
-
-
-import io.fd.honeycomb.lisp.translate.read.MapResolverCustomizer;
-import io.fd.honeycomb.translate.impl.read.GenericListReader;
-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.rev161214.LispState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.MapResolvers;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.MapResolversBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolver;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Builds reader for {@link MapResolvers}<br> and all its inhired child readers
- */
-public class MapResolversReaderFactory extends AbstractLispReaderFactoryBase implements ReaderFactory {
-
- private MapResolversReaderFactory(final InstanceIdentifier<LispState> lispStateId, final FutureJVppCore vppApi) {
- super(lispStateId, vppApi);
- }
-
- public static MapResolversReaderFactory newInstance(@Nonnull final InstanceIdentifier<LispState> lispStateId,
- @Nonnull final FutureJVppCore vppApi) {
- return new MapResolversReaderFactory(lispStateId, vppApi);
- }
-
- @Override
- public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
-
- InstanceIdentifier<MapResolvers> mapResolversInstanceIdentifier =
- lispStateId.child(LispFeatureData.class).child(MapResolvers.class);
-
- registry.addStructuralReader(mapResolversInstanceIdentifier, MapResolversBuilder.class);
- registry.add(new GenericListReader<>(mapResolversInstanceIdentifier.child(MapResolver.class),
- new MapResolverCustomizer(vppApi)));
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorReader.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorReader.java
deleted file mode 100644
index 54fef659e..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorReader.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.translate.read.trait;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.lisp.translate.read.dump.executor.params.LocatorDumpParams;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispLocatorDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.LispLocatorDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-
-/**
- * Provides common logic for reading of locators
- */
-public interface LocatorReader extends JvppReplyConsumer {
-
- default EntityDumpExecutor<LispLocatorDetailsReplyDump, LocatorDumpParams> createLocatorDumpExecutor(
- @Nonnull final FutureJVppCore vppApi) {
- return (identifier, params) -> {
- checkNotNull(params, "Params for dump request not present");
- final LispLocatorDump request = new LispLocatorDump();
- request.lsIndex = params.getLocatorSetIndex();
- //flag that lsIndex is set
- request.isIndexSet = (byte) 1;
-
- return getReplyForRead(vppApi.lispLocatorDump(request).toCompletableFuture(), identifier);
- };
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorSetReader.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorSetReader.java
deleted file mode 100644
index 7085b047d..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorSetReader.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.translate.read.trait;
-
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDump;
-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.rev161214.locator.sets.grouping.locator.sets.LocatorSet;
-
-/**
- * Provides common logic for reading {@link LocatorSet}
- */
-public interface LocatorSetReader extends JvppReplyConsumer {
-
- default EntityDumpExecutor<LispLocatorSetDetailsReplyDump, Void> createExecutor(
- @Nonnull final FutureJVppCore vppApi) {
- return (identifier, params) -> {
- final LispLocatorSetDump request = new LispLocatorSetDump();
- //only local
- request.filter = 1;
- return getReplyForRead(vppApi.lispLocatorSetDump(request).toCompletableFuture(), 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
deleted file mode 100644
index 92e5c3191..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducer.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.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.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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/MappingReader.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReader.java
deleted file mode 100644
index 759e52ae4..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReader.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.translate.read.trait;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-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 io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispEidTableDetails;
-import io.fd.vpp.jvpp.core.dto.LispEidTableDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.LispEidTableDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.function.Predicate;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * Trait providing predicates to filter mappings to respective subtables
- */
-public interface MappingReader extends JvppReplyConsumer {
-
- 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);
- }
- }
-
- default EntityDumpExecutor<LispEidTableDetailsReplyDump, MappingsDumpParams> createMappingDumpExecutor(
- @Nonnull final FutureJVppCore vppApi) {
- return (identifier, params) -> {
- checkNotNull(params, "Params for dump request not present");
-
- LispEidTableDump request = new LispEidTableDump();
- request.eid = params.getEid();
- request.eidSet = params.getEidSet();
- request.eidType = params.getEidType();
- request.prefixLength = params.getPrefixLength();
- request.vni = params.getVni();
- request.filter = params.getFilter();
-
- return getReplyForRead(vppApi.lispEidTableDump(request).toCompletableFuture(), identifier);
- };
- }
-}
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
deleted file mode 100644
index a4a6e21ab..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.translate.read.trait;
-
-
-import static com.google.common.base.Preconditions.checkNotNull;
-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.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDump;
-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.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtable;
-import org.opendaylight.yangtools.yang.binding.ChildOf;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * Provides common logic for reading Eid subtables
- */
-public interface SubtableReader extends JvppReplyConsumer {
-
- SubtableDumpParams L2_PARAMS = new SubtableDumpParamsBuilder().setL2(L2).build();
- SubtableDumpParams L3_PARAMS = new SubtableDumpParamsBuilder().setL2(L3).build();
-
- default EntityDumpExecutor<LispEidTableMapDetailsReplyDump, SubtableDumpParams> createExecutor(
- @Nonnull final FutureJVppCore vppApi) {
- return (identifier, params) -> {
- final LispEidTableMapDump request = new LispEidTableMapDump();
- request.isL2 = checkNotNull(params, "Cannot bind null params").isL2();
- return getReplyForRead(vppApi.lispEidTableMapDump(request).toCompletableFuture(), identifier);
- };
- }
-}
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
deleted file mode 100644
index 88571f717..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidMetadataProvider.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.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;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.LocalEidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.RemoteEidBuilder;
-
-/**
- * Trait providing metadata for eid's
- */
-public interface EidMetadataProvider {
-
- /**
- * Returns new {@link org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder}
- * binded with metadata
- */
- default org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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.rev161214.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.rev161214.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder}
- * binded with metadata
- */
- default org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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.rev161214.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder()
- .setAddressType(eidAddressType)
- .setVirtualNetworkId(new InstanceIdType(Long.valueOf(vni)));
- }
-
- default LocalEidBuilder newEidBuilderLocal(@Nonnull final Class<? extends LispAddressFamily> eidAddressType,
- final int vni) {
- return new LocalEidBuilder()
- .setAddressType(eidAddressType)
- .setVirtualNetworkId(new InstanceIdType(Long.valueOf(vni)));
- }
-
- default RemoteEidBuilder newEidBuilderRemote(@Nonnull final Class<? extends LispAddressFamily> eidAddressType,
- final int vni) {
- return new RemoteEidBuilder()
- .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
deleted file mode 100755
index 0b7faba31..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidTranslator.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * 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.translate.util;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType;
-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 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;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Builder;
-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.rev161214.adjacencies.grouping.adjacencies.adjacency.LocalEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.RemoteEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid;
-
-
-/**
- * Trait providing converting logic for eid's
- */
-public interface EidTranslator extends AddressTranslator, EidMetadataProvider {
-
-
- default byte getPrefixLength(LocalEid address) {
- return resolverPrefixLength(address.getAddress());
- }
-
- default byte getPrefixLength(RemoteEid address) {
- return resolverPrefixLength(address.getAddress());
- }
-
- default byte getPrefixLength(
- org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid address) {
- return resolverPrefixLength(address.getAddress());
- }
-
- default byte getPrefixLength(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid address) {
- return resolverPrefixLength(address.getAddress());
- }
-
- static byte resolverPrefixLength(Address address) {
-
- switch (resolveType(address)) {
- case IPV4:
- return 32;
- case IPV6:
- return (byte) 128;
- case MAC:
- return 0;
- default:
- throw new IllegalArgumentException("Illegal type");
- }
- }
-
- default Eid getArrayAsEidLocal(@Nonnull final EidType type, final byte[] address, final int vni) {
-
- switch (type) {
- case IPV4: {
- return newLocalEidBuilder(Ipv4Afi.class, vni).setAddress(
- new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZoneReversed(address)).build())
- .build();
- }
- case IPV6: {
- return newLocalEidBuilder(Ipv6Afi.class, vni).setAddress(
- new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZoneReversed(address)).build())
- .build();
- }
- case MAC: {
- return newLocalEidBuilder(MacAfi.class, vni).setAddress(
- new MacBuilder().setMac(new MacAddress(byteArrayToMacSeparated(address)))
- .build()).build();
- }
- default: {
- throw new IllegalStateException("Unknown type detected");
- }
- }
- }
-
- default org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid getArrayAsEidRemote(
- @Nonnull final EidType type, final byte[] address, final int vni) {
-
- switch (type) {
- case IPV4: {
- return newRemoteEidBuilder(Ipv4Afi.class, vni)
- .setAddress(
- new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZoneReversed(address))
- .build())
- .build();
- }
- case IPV6: {
- return newRemoteEidBuilder(Ipv6Afi.class, vni)
- .setAddress(
- new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZoneReversed(address))
- .build())
- .build();
- }
- case MAC: {
- return newRemoteEidBuilder(MacAfi.class, vni)
- .setAddress(
- new MacBuilder().setMac(new MacAddress(byteArrayToMacSeparated(address)))
- .build()).build();
- }
- default: {
- throw new IllegalStateException("Unknown type detected");
- }
- }
- }
-
- default LocalEid getArrayAsLocalEid(@Nonnull final EidType type, final byte[] address, final int vni) {
- switch (type) {
- case IPV4: {
- return newEidBuilderLocal(Ipv4Afi.class, vni)
- .setAddress(
- new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZoneReversed(address))
- .build())
- .build();
- }
- case IPV6: {
- return newEidBuilderLocal(Ipv6Afi.class, vni)
- .setAddress(
- new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZoneReversed(address))
- .build())
- .build();
- }
- case MAC: {
- return newEidBuilderLocal(MacAfi.class, vni)
- .setAddress(
- new MacBuilder().setMac(new MacAddress(byteArrayToMacSeparated(address)))
- .build()).build();
- }
- default: {
- throw new IllegalStateException("Unknown type detected");
- }
- }
- }
-
- default RemoteEid getArrayAsRemoteEid(@Nonnull final EidType type, final byte[] address, final int vni) {
- switch (type) {
- case IPV4: {
- return newEidBuilderRemote(Ipv4Afi.class, vni)
- .setAddress(
- new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZoneReversed(address))
- .build())
- .build();
- }
- case IPV6: {
- return newEidBuilderRemote(Ipv6Afi.class, vni)
- .setAddress(
- new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZoneReversed(address))
- .build())
- .build();
- }
- case MAC: {
- return newEidBuilderRemote(MacAfi.class, vni)
- .setAddress(
- new MacBuilder().setMac(new MacAddress(byteArrayToMacSeparated(address)))
- .build()).build();
- }
- default: {
- throw new IllegalStateException("Unknown type detected");
- }
- }
- }
-
- default String getArrayAsEidString(
- EidType type, byte[] address) {
- switch (type) {
- case IPV4: {
- return arrayToIpv4AddressNoZoneReversed(address).getValue();
- }
- case IPV6: {
- return arrayToIpv6AddressNoZoneReversed(address).getValue();
- }
- case MAC: {
- //as wrong as it looks ,its right(second param is not end index,but count)
- return byteArrayToMacSeparated(Arrays.copyOfRange(address, 0, 6));
- }
- default: {
- throw new IllegalStateException("Unknown type detected");
- }
- }
- }
-
-
- default EidType getEidType(
- org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid address) {
- checkNotNull(address, "SimpleAddress cannot be null");
-
- return resolveType(address.getAddress());
- }
-
- default EidType getEidType(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid address) {
- checkNotNull(address, "SimpleAddress cannot be null");
-
- return resolveType(address.getAddress());
- }
-
-
- default EidType getEidType(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid address) {
- checkNotNull(address, "Address cannot be null");
-
- return resolveType(address.getAddress());
- }
-
-
- default EidType getEidType(final LocalEid address) {
- checkNotNull(address, "Address cannot be null");
-
- return resolveType(address.getAddress());
- }
-
- default EidType getEidType(final RemoteEid address) {
- checkNotNull(address, "Address cannot be null");
-
- return resolveType(address.getAddress());
- }
-
- static EidType resolveType(
- Address address) {
-
- if (address instanceof Ipv4) {
- return IPV4;
- } else if (address instanceof Ipv6) {
- return IPV6;
- } else if (address instanceof Mac) {
- return MAC;
- } else {
- throw new IllegalStateException("Unknown type detected");
- }
- }
-
- default byte[] getEidAsByteArray(
- org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.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.rev161214.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.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid address) {
- checkNotNull(address, "Eid cannot be null");
-
- return resolveByteArray(getEidType(address), address.getAddress());
- }
-
- default byte[] getEidAsByteArray(final LocalEid address) {
- checkNotNull(address, "Eid cannot be null");
-
- return resolveByteArray(getEidType(address), address.getAddress());
- }
-
-
- default byte[] getEidAsByteArray(final RemoteEid address) {
- checkNotNull(address, "Eid cannot be null");
-
- return resolveByteArray(getEidType(address), address.getAddress());
- }
-
- default byte[] resolveByteArray(EidType type, Address address) {
- switch (type) {
- case IPV4:
- return ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(((Ipv4) address).getIpv4()));
- case IPV6:
- return ipv6AddressNoZoneToArray(new Ipv6AddressNoZone(((Ipv6) address).getIpv6()));
- case MAC:
- return parseMac(((Mac) address).getMac().getValue());
- default:
- throw new IllegalArgumentException("Unsupported type");
- }
- }
-
- default boolean compareEids(
- LispAddress first,
- LispAddress second) {
-
- return compareAddresses(checkNotNull(first, "First eid is null").getAddress(),
- checkNotNull(second, "Second eid is null").getAddress());
- }
-
- default boolean compareAddresses(Address firstAddress, Address secondAddress) {
-
- checkNotNull(firstAddress, "First address is null");
- checkNotNull(secondAddress, "Second address is null");
-
- if (firstAddress instanceof Ipv4 && secondAddress instanceof Ipv4) {
- return ((Ipv4) firstAddress).getIpv4().getValue().equals(((Ipv4) secondAddress).getIpv4().getValue());
- }
-
- if (firstAddress instanceof Ipv6 && secondAddress instanceof Ipv6) {
- return ((Ipv6) firstAddress).getIpv6().getValue().equals(((Ipv6) secondAddress).getIpv6().getValue());
- }
-
- if (firstAddress instanceof Mac && secondAddress instanceof Mac) {
- return ((Mac) firstAddress).getMac().getValue().equals(((Mac) secondAddress).getMac().getValue());
- }
-
- 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
deleted file mode 100755
index b394f2a69..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizer.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * 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.translate.write;
-
-
-import static com.google.common.base.Preconditions.checkArgument;
-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.AdjacenciesMappingContext;
-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;
-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.rev161214.adjacencies.grouping.adjacencies.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.AdjacencyKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.LocalEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.RemoteEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class AdjacencyCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<Adjacency, AdjacencyKey>, ByteDataTranslator, EidTranslator,
- JvppReplyConsumer {
-
- private final EidMappingContext localEidsMappingContext;
- private final EidMappingContext remoteEidsMappingContext;
- private final AdjacenciesMappingContext adjacenciesMappingContext;
-
- public AdjacencyCustomizer(@Nonnull final FutureJVppCore futureJvpp,
- @Nonnull final EidMappingContext localEidsMappingContext,
- @Nonnull final EidMappingContext remoteEidsMappingContext,
- @Nonnull final AdjacenciesMappingContext adjacenciesMappingContext) {
- 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");
- this.adjacenciesMappingContext = checkNotNull(adjacenciesMappingContext, "Adjacencies context cannot be null");
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Adjacency> id,
- @Nonnull final Adjacency dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- try {
- addDelAdjacency(true, id, dataAfter, writeContext);
- } catch (TimeoutException | VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
-
- //after successful creation, create mapping
- adjacenciesMappingContext.addEidPair(adjacencyId(id),
- localEidId(dataAfter, writeContext),
- remoteEidId(dataAfter, writeContext),
- writeContext.getMappingContext());
- }
-
- private String remoteEidId(final @Nonnull Adjacency dataAfter, final @Nonnull WriteContext writeContext) {
- return remoteEidsMappingContext.getId(toRemoteEid(dataAfter.getRemoteEid()), writeContext.getMappingContext())
- .getValue();
- }
-
- private String localEidId(final @Nonnull Adjacency dataAfter, final @Nonnull WriteContext writeContext) {
- return localEidsMappingContext.getId(toLocalEid(dataAfter.getLocalEid()), writeContext.getMappingContext())
- .getValue();
- }
-
- private String adjacencyId(final @Nonnull InstanceIdentifier<Adjacency> id) {
- return id.firstKeyOf(Adjacency.class).getId();
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Adjacency> id,
- @Nonnull final Adjacency dataBefore, @Nonnull final Adjacency dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- throw new UnsupportedOperationException("Operation not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Adjacency> id,
- @Nonnull final Adjacency dataBefore, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- try {
- addDelAdjacency(false, id, dataBefore, writeContext);
- } catch (TimeoutException | VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataBefore, e);
- }
-
- //after successful creation, create mapping
- adjacenciesMappingContext.removeForIndex(adjacencyId(id),
- writeContext.getMappingContext());
- }
-
- private void addDelAdjacency(boolean add, final InstanceIdentifier<Adjacency> id, final Adjacency data,
- final WriteContext writeContext)
- throws TimeoutException, VppBaseCallException {
-
- 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);
-
- LispAddDelAdjacency request = new LispAddDelAdjacency();
-
- request.isAdd = booleanToByte(add);
- 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.rev161214.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.rev161214.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
deleted file mode 100644
index 41e1adc15..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainSubtableCustomizer.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.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.rev161214.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/InterfaceCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizer.java
deleted file mode 100755
index fa477e536..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizer.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.translate.write;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-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.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-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.rev161214.locator.sets.grouping.locator.sets.LocatorSet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.InterfaceKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.LispAddDelLocator;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Customizer for updating {@link Interface}
- *
- * @see Interface
- */
-public class InterfaceCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<Interface, InterfaceKey>, ByteDataTranslator, JvppReplyConsumer {
-
- private final NamingContext interfaceContext;
-
- public InterfaceCustomizer(@Nonnull FutureJVppCore futureJvpp, @Nonnull NamingContext interfaceContext) {
- super(futureJvpp);
- this.interfaceContext = checkNotNull(interfaceContext, "Naming context is null");
- }
-
- @Override
- public void writeCurrentAttributes(InstanceIdentifier<Interface> id, Interface dataAfter, WriteContext writeContext)
- throws WriteFailedException {
-
- checkNotNull(dataAfter, "Interface is null");
- checkNotNull(dataAfter.getPriority(), "Priority is null");
- checkNotNull(dataAfter.getWeight(), "Weight is null");
- checkState(id.firstKeyOf(Interface.class) != null, "Parent interface not found");
- checkState(id.firstKeyOf(LocatorSet.class) != null, "Parent locator set not found");
-
- String interfaceName = id.firstKeyOf(Interface.class).getInterfaceRef();
- String locatorSetName = id.firstKeyOf(LocatorSet.class).getName();
-
- checkState(interfaceContext.containsIndex(interfaceName, writeContext.getMappingContext()),
- "No mapping stored for interface %s", interfaceName);
-
- try {
- addDelInterfaceAndReply(true, dataAfter,
- interfaceContext.getIndex(interfaceName, writeContext.getMappingContext()), locatorSetName);
- } catch (VppBaseCallException | TimeoutException | UnsupportedEncodingException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
-
- }
-
- @Override
- public void updateCurrentAttributes(InstanceIdentifier<Interface> id, Interface dataBefore, Interface dataAfter,
- WriteContext writeContext) throws WriteFailedException {
- throw new UnsupportedOperationException("Operation not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(InstanceIdentifier<Interface> id, Interface dataBefore,
- WriteContext writeContext) throws WriteFailedException {
- checkNotNull(dataBefore, "Interface is null");
- checkNotNull(dataBefore.getPriority(), "Priority is null");
- checkNotNull(dataBefore.getWeight(), "Weight is null");
- checkState(id.firstKeyOf(Interface.class) != null, "Parent interface not found");
- checkState(id.firstKeyOf(LocatorSet.class) != null, "Parent locator set not found");
-
- String interfaceName = id.firstKeyOf(Interface.class).getInterfaceRef();
- String locatorSetName = id.firstKeyOf(LocatorSet.class).getName();
-
- checkState(interfaceContext.containsIndex(interfaceName, writeContext.getMappingContext()),
- "No mapping stored for interface %s", interfaceName);
- try {
- addDelInterfaceAndReply(false, dataBefore,
- interfaceContext.getIndex(interfaceName, writeContext.getMappingContext()), locatorSetName);
- } catch (VppBaseCallException | TimeoutException | UnsupportedEncodingException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
- }
-
- private void addDelInterfaceAndReply(boolean add, Interface data, int interfaceIndex, String locatorSetName)
- throws VppBaseCallException, TimeoutException, UnsupportedEncodingException {
- LispAddDelLocator request = new LispAddDelLocator();
-
- request.isAdd = booleanToByte(add);
- request.priority = data.getPriority().byteValue();
- request.weight = data.getWeight().byteValue();
- request.swIfIndex = interfaceIndex;
- request.locatorSetName = locatorSetName.getBytes(UTF_8);
-
- getReply(getFutureJVpp().lispAddDelLocator(request).toCompletableFuture());
- }
-}
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
deleted file mode 100644
index 8ba1bcf3f..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizer.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.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.rev161214.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/LispCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LispCustomizer.java
deleted file mode 100755
index ba2e24038..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LispCustomizer.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.translate.write;
-
-import com.google.common.base.Preconditions;
-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.util.concurrent.CompletionStage;
-import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.Lisp;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.LispEnableDisable;
-import io.fd.vpp.jvpp.core.dto.LispEnableDisableReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Handles updates of {@link Lisp} node. Takes care of LISP enable/disable
- */
-public class LispCustomizer extends FutureJVppCustomizer
- implements WriterCustomizer<Lisp>, ByteDataTranslator, JvppReplyConsumer {
-
- public LispCustomizer(final FutureJVppCore vppApi) {
- super(vppApi);
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Lisp> id, @Nonnull final Lisp dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- Preconditions.checkNotNull(dataAfter, "Lisp is null");
-
- try {
- enableDisableLisp(dataAfter.isEnable());
- } catch (VppBaseCallException | TimeoutException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Lisp> id, @Nonnull final Lisp dataBefore,
- @Nonnull final Lisp dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- Preconditions.checkNotNull(dataAfter, "Lisp is null");
-
- try {
- enableDisableLisp(dataAfter.isEnable());
- } catch (VppBaseCallException | TimeoutException e) {
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, e);
- }
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Lisp> id, @Nonnull final Lisp dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- Preconditions.checkNotNull(dataBefore, "Lisp is null");
-
- try {
- enableDisableLisp(false);
- } catch (VppBaseCallException | TimeoutException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
-
- }
-
-
- private void enableDisableLisp(final boolean enable) throws VppBaseCallException, TimeoutException {
- final CompletionStage<LispEnableDisableReply> lispEnableDisableReplyCompletionStage =
- getFutureJVpp().lispEnableDisable(getRequest(enable));
- getReply(lispEnableDisableReplyCompletionStage.toCompletableFuture());
- }
-
- private LispEnableDisable getRequest(final boolean enable) {
- final LispEnableDisable lispEnableDisable = new LispEnableDisable();
- lispEnableDisable.isEn = booleanToByte(enable);
- return lispEnableDisable;
- }
-}
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
deleted file mode 100755
index 93f39f49b..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizer.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * 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.translate.write;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-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 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;
-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.io.UnsupportedEncodingException;
-import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.LispAddDelLocalEid;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Customizer that writes changes for {@link LocalMapping}
- */
-public class LocalMappingCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<LocalMapping, LocalMappingKey>, ByteDataTranslator, EidTranslator,
- JvppReplyConsumer, MappingProducer {
-
- private final EidMappingContext localMappingsContext;
-
- public LocalMappingCustomizer(@Nonnull FutureJVppCore futureJvpp, @Nonnull EidMappingContext localMappingsContext) {
- super(futureJvpp);
- this.localMappingsContext = checkNotNull(localMappingsContext, "No local mappings context defined");
- }
-
- @Override
- public void writeCurrentAttributes(InstanceIdentifier<LocalMapping> id, LocalMapping dataAfter,
- WriteContext writeContext) throws WriteFailedException {
- checkNotNull(dataAfter, "Mapping is null");
- 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
- final MappingId mappingId = id.firstKeyOf(LocalMapping.class).getId();
- checkState(!localMappingsContext
- .containsEid(mappingId, writeContext.getMappingContext()),
- "Local mapping with id %s already defined", id);
-
-
- try {
- addDelMappingAndReply(true, dataAfter,
- id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier().intValue());
- } catch (VppBaseCallException | TimeoutException | UnsupportedEncodingException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
-
- //adds mapping for id and eid
- localMappingsContext.addEid(mappingId, dataAfter.getEid(), writeContext.getMappingContext());
- }
-
- @Override
- public void updateCurrentAttributes(InstanceIdentifier<LocalMapping> id, LocalMapping dataBefore,
- LocalMapping dataAfter, WriteContext writeContext)
- throws WriteFailedException {
- throw new UnsupportedOperationException("Operation not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(InstanceIdentifier<LocalMapping> id, LocalMapping dataBefore,
- WriteContext writeContext) throws WriteFailedException {
- checkNotNull(dataBefore, "Mapping is null");
- checkNotNull(dataBefore.getEid(), "Eid is null");
- checkNotNull(dataBefore.getLocatorSet(), "LocatorSet is null");
- checkState(id.firstKeyOf(VniTable.class) != null, "Parent vni table not found");
-
- //checks whether value with specified mapping-id does exist in mapping,so there is something to delete
- MappingId mappingId = id.firstKeyOf(LocalMapping.class).getId();
- checkState(localMappingsContext
- .containsEid(mappingId, writeContext.getMappingContext()),
- "Local mapping with id %s not present in mapping", id);
-
- try {
- addDelMappingAndReply(false, dataBefore,
- id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier().intValue());
- } catch (VppBaseCallException | TimeoutException | UnsupportedEncodingException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
-
- //removes value also from mapping
- localMappingsContext.removeEid(mappingId, writeContext.getMappingContext());
- }
-
- private void addDelMappingAndReply(boolean add, LocalMapping data, int vni) throws VppBaseCallException,
- TimeoutException, UnsupportedEncodingException {
-
- LispAddDelLocalEid request = new LispAddDelLocalEid();
-
- request.isAdd = booleanToByte(add);
- request.eid = getEidAsByteArray(data.getEid());
- request.eidType = (byte) getEidType(data.getEid()).getValue();
- request.locatorSetName = data.getLocatorSet().getBytes(UTF_8);
- request.vni = vni;
-
- //default prefixes
- if (request.eidType == IPV4.getValue()) {
- request.prefixLen = 32;
- } else if (request.eidType == IPV6.getValue()) {
- request.prefixLen = (byte) 128;
- }
-
- getReply(getFutureJVpp().lispAddDelLocalEid(request).toCompletableFuture());
- }
-
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java
deleted file mode 100755
index 749255836..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.translate.write;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-import io.fd.honeycomb.lisp.translate.read.trait.LocatorSetReader;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-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.core.dto.LispAddDelLocatorSet;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.List;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSetKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.Interface;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-/**
- * Customizer for {@link LocatorSet} entity.
- *
- * @see LocatorSet
- */
-public class LocatorSetCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<LocatorSet, LocatorSetKey>, ByteDataTranslator,
- LocatorSetReader {
-
- private final NamingContext locatorSetContext;
-
- public LocatorSetCustomizer(@Nonnull final FutureJVppCore futureJvpp,
- @Nonnull final NamingContext locatorSetContext) {
- super(futureJvpp);
- this.locatorSetContext = checkNotNull(locatorSetContext, "Locator set context cannot be null");
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull InstanceIdentifier<LocatorSet> id,
- @Nonnull LocatorSet dataAfter,
- @Nonnull WriteContext writeContext) throws WriteFailedException {
- checkState(isNonEmptyLocatorSet(writeContext.readAfter(id).get()),
- "Creating empty locator-sets is not allowed");
- final String locatorSetName = dataAfter.getName();
- checkState(!locatorSetContext.containsIndex(locatorSetName, writeContext.getMappingContext()),
- "Locator set with name %s already defined", locatorSetName);
-
- final int locatorSetIndex = addDelLocatorSetAndReply(true, dataAfter.getName(), id);
- locatorSetContext.addName(locatorSetIndex, locatorSetName, writeContext.getMappingContext());
- }
-
- private boolean isNonEmptyLocatorSet(final LocatorSet locatorSet) {
- final List<Interface> locators = locatorSet.getInterface();
- return locators != null && !locators.isEmpty();
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull InstanceIdentifier<LocatorSet> id,
- @Nonnull LocatorSet dataBefore,
- @Nonnull LocatorSet dataAfter,
- @Nonnull WriteContext writeContext) throws WriteFailedException {
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter,
- new UnsupportedOperationException("Operation not supported"));
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull InstanceIdentifier<LocatorSet> id,
- @Nonnull LocatorSet dataBefore,
- @Nonnull WriteContext writeContext) throws WriteFailedException {
- final String locatorSetName = dataBefore.getName();
- addDelLocatorSetAndReply(false, dataBefore.getName(), id);
- //removes mapping after successful delete
- locatorSetContext.removeName(locatorSetName, writeContext.getMappingContext());
- }
-
- private int addDelLocatorSetAndReply(final boolean add, final String name, final InstanceIdentifier<LocatorSet> id)
- throws WriteFailedException {
-
- LispAddDelLocatorSet addDelSet = new LispAddDelLocatorSet();
-
- addDelSet.isAdd = booleanToByte(add);
- addDelSet.locatorSetName = name.getBytes(UTF_8);
-
- return getReplyForWrite(getFutureJVpp().lispAddDelLocatorSet(addDelSet).toCompletableFuture(), id).lsIndex;
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/MapResolverCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/MapResolverCustomizer.java
deleted file mode 100755
index 42066c442..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/MapResolverCustomizer.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.translate.write;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.AddressTranslator;
-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 javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolver;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolverKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.LispAddDelMapResolver;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Handles updates of {@link MapResolver} list
- */
-public class MapResolverCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<MapResolver, MapResolverKey>, AddressTranslator,
- JvppReplyConsumer {
-
- public MapResolverCustomizer(final FutureJVppCore vppApi) {
- super(vppApi);
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<MapResolver> id,
- @Nonnull final MapResolver dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
-
- checkNotNull(dataAfter, "Data is null");
- checkNotNull(dataAfter.getIpAddress(), "Address is null");
-
- try {
- addDelMapResolverAndReply(true, dataAfter);
- } catch (VppBaseCallException | TimeoutException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<MapResolver> id,
- @Nonnull final MapResolver dataBefore, @Nonnull final MapResolver dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- throw new UnsupportedOperationException("Operation not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<MapResolver> id,
- @Nonnull final MapResolver dataBefore, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
-
- checkNotNull(dataBefore, "Data is null");
- checkNotNull(dataBefore.getIpAddress(), "Address is null");
-
- try {
- addDelMapResolverAndReply(false, dataBefore);
- } catch (VppBaseCallException | TimeoutException e) {
- throw new WriteFailedException.CreateFailedException(id, dataBefore, e);
- }
- }
-
- private void addDelMapResolverAndReply(boolean add, MapResolver data) throws VppBaseCallException,
- TimeoutException {
-
- LispAddDelMapResolver request = new LispAddDelMapResolver();
- request.isAdd = booleanToByte(add);
-
-
- boolean ipv6 = isIpv6(data.getIpAddress());
-
- request.isIpv6 = booleanToByte(ipv6);
- request.ipAddress = ipAddressToArray(ipv6, data.getIpAddress());
-
- getReply(getFutureJVpp().lispAddDelMapResolver(request).toCompletableFuture());
- }
-}
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
deleted file mode 100755
index 035db3c33..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizer.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.translate.write;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-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.util.concurrent.TimeoutException;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfg;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.LispPitrSetLocatorSet;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Customizer for {@code PitrCfg}
- */
-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);
- }
-
- @Override
- public void writeCurrentAttributes(InstanceIdentifier<PitrCfg> id, PitrCfg dataAfter, WriteContext writeContext)
- throws WriteFailedException {
- checkNotNull(dataAfter, "PitrCfg is null");
- checkNotNull(dataAfter.getLocatorSet(), "Locator set name is null");
-
- try {
- addDelPitrSetLocatorSetAndReply(true, dataAfter);
- } catch (VppBaseCallException | TimeoutException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
- }
-
- @Override
- public void updateCurrentAttributes(InstanceIdentifier<PitrCfg> id, PitrCfg dataBefore, PitrCfg dataAfter,
- WriteContext writeContext) throws WriteFailedException {
- checkNotNull(dataAfter, "PitrCfg is null");
- checkNotNull(dataAfter.getLocatorSet(), "Locator set name is null");
-
- try {
- addDelPitrSetLocatorSetAndReply(true, dataAfter);
- } catch (VppBaseCallException | TimeoutException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
- }
-
- @Override
- public void deleteCurrentAttributes(InstanceIdentifier<PitrCfg> id, PitrCfg dataBefore, WriteContext writeContext)
- throws WriteFailedException {
- checkNotNull(dataBefore, "PitrCfg is null");
- checkNotNull(dataBefore.getLocatorSet(), "Locator set name is null");
-
- try {
- addDelPitrSetLocatorSetAndReply(false, dataBefore);
- } catch (VppBaseCallException | TimeoutException e) {
- throw new WriteFailedException.CreateFailedException(id, dataBefore, e);
- }
- }
-
- 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);
-
- getReply(getFutureJVpp().lispPitrSetLocatorSet(request).toCompletableFuture());
- }
-
-}
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
deleted file mode 100755
index cb4313bc2..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizer.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * 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.translate.write;
-
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static io.fd.honeycomb.lisp.translate.write.RemoteMappingCustomizer.LocatorListType.NEGATIVE;
-import static io.fd.honeycomb.lisp.translate.write.RemoteMappingCustomizer.LocatorListType.POSITIVE;
-
-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;
-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.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.TimeoutException;
-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.opendaylight.params.xml.ns.yang.lisp.rev161214.MapReplyAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.LocatorList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.NegativeMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.PositiveMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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.rev161214.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.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.LispAddDelRemoteMapping;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Customizer for {@link RemoteMapping}
- */
-public class RemoteMappingCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<RemoteMapping, RemoteMappingKey>, EidTranslator,
- AddressTranslator, JvppReplyConsumer, MappingProducer {
-
- private final EidMappingContext remoteMappingContext;
-
- public RemoteMappingCustomizer(@Nonnull final FutureJVppCore futureJvpp,
- @Nonnull final EidMappingContext remoteMappingContext) {
- super(futureJvpp);
- this.remoteMappingContext = remoteMappingContext;
- }
-
- @Override
- public void writeCurrentAttributes(InstanceIdentifier<RemoteMapping> id, RemoteMapping dataAfter,
- WriteContext writeContext) throws WriteFailedException {
- 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();
- checkState(!remoteMappingContext.containsEid(mappingId, writeContext.getMappingContext()),
- "Mapping for id %s already defined", mappingId);
-
- try {
- addDelRemoteMappingAndReply(true, dataAfter,
- id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier().intValue());
- } catch (VppBaseCallException | TimeoutException | IOException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
-
- //after successfull adition adds mapping
- remoteMappingContext.addEid(mappingId, dataAfter.getEid(), writeContext.getMappingContext());
- }
-
- @Override
- public void updateCurrentAttributes(InstanceIdentifier<RemoteMapping> id, RemoteMapping dataBefore,
- RemoteMapping dataAfter, WriteContext writeContext)
- throws WriteFailedException {
- throw new UnsupportedOperationException("Operation not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(InstanceIdentifier<RemoteMapping> id, RemoteMapping dataBefore,
- WriteContext writeContext) throws WriteFailedException {
- checkNotNull(dataBefore, "Mapping is null");
- checkNotNull(dataBefore.getEid(), "Eid is null");
-
- //checks whether mapping already contains such key
- MappingId mappingId = id.firstKeyOf(RemoteMapping.class).getId();
- checkState(remoteMappingContext.containsEid(mappingId, writeContext.getMappingContext()),
- "Mapping for id %s is not existing,nothing to remove", mappingId);
-
- try {
- addDelRemoteMappingAndReply(false, dataBefore,
- id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier().intValue());
- } catch (VppBaseCallException | TimeoutException | IOException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
-
- //remote mapping after successfull remove of data
- remoteMappingContext.removeEid(mappingId, writeContext.getMappingContext());
- }
-
- private void addDelRemoteMappingAndReply(boolean add, RemoteMapping data, int vni)
- throws VppBaseCallException, TimeoutException, IOException {
-
- LispAddDelRemoteMapping request = new LispAddDelRemoteMapping();
-
- request.isAdd = booleanToByte(add);
- request.vni = vni;
- request.eidType = (byte) getEidType(data.getEid()).getValue();
- request.eid = getEidAsByteArray(data.getEid());
-
- //this is not length of eid array,but prefix length(bad naming by vpp)
- request.eidLen = getPrefixLength(data.getEid());
-
- if (LocatorListType.NEGATIVE
- .equals(resolveType(data.getLocatorList()))) {
- request.action = (byte) extractAction(data.getLocatorList()).getIntValue();
- } else {
- Rlocs rlocs = extractRemoteLocators(data.getLocatorList());
-
- checkArgument(rlocs != null, "No remote locators set for Positive mapping");
-
- request.rlocs = locatorsToBinaryData(rlocs.getLocator());
- request.rlocNum = Integer.valueOf(rlocs.getLocator().size()).byteValue();
- }
-
- getReply(getFutureJVpp().lispAddDelRemoteMapping(request).toCompletableFuture());
- }
-
- private static LocatorListType resolveType(LocatorList locatorList) {
- checkNotNull(locatorList, "Locator List cannot be null");
-
- if (locatorList instanceof PositiveMapping) {
- return POSITIVE;
- } else {
- return NEGATIVE;
- }
- }
-
- private static MapReplyAction extractAction(LocatorList locatorList) {
- checkNotNull(locatorList, "Locator List cannot be null");
- Preconditions.checkArgument(NEGATIVE.equals(resolveType(locatorList)),
- "Action can be extracted only from Negative Mapping");
-
- return ((NegativeMapping) locatorList).getMapReply().getMapReplyAction();
- }
-
- private static Rlocs extractRemoteLocators(LocatorList locatorList) {
- checkNotNull(locatorList, "Locator List cannot be null");
- Preconditions.checkArgument(POSITIVE.equals(resolveType(locatorList)),
- "RLocs can be extracted only from Positive Mapping");
-
- return ((PositiveMapping) locatorList).getRlocs();
- }
-
- //cant be static because of use of default methods from traits
- private byte[] locatorsToBinaryData(List<Locator> locators) throws IOException {
- checkNotNull(locators, "Cannot convert null list");
-
- ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
-
- DataOutputStream out = new DataOutputStream(byteArrayOut);
-
-
- for (Locator locator : locators) {
- boolean isIpv4;
- byte[] address;
-
- //first byte says that its v4/v6
- isIpv4 = !isIpv6(locator.getAddress());
- out.writeByte(booleanToByte(isIpv4));
-
- //then writes priority
- out.write(locator.getPriority());
-
- //and weight
- out.write(locator.getWeight());
-
- if (isIpv4) {
- //vpp in this case needs address as 16 byte array,regardless if it is ivp4 or ipv6
- address = Arrays.copyOf(
-
- ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(locator.getAddress().getIpv4Address())),
- 16);
-
- out.write(address);
- } else {
- out.write(
- ipv6AddressNoZoneToArray(new Ipv6AddressNoZone(locator.getAddress().getIpv6Address())));
- }
- }
-
- return byteArrayOut.toByteArray();
- }
-
- public enum LocatorListType {
-
- /**
- * Represents locator list as negative mapping
- */
- NEGATIVE,
-
- /**
- * Represents locator list as positive mapping
- */
- POSITIVE
- }
-
-}
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
deleted file mode 100755
index 005b336d6..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizer.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.translate.write;
-
-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.util.RWUtils;
-
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * 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> {
-
- private static final Logger LOG = LoggerFactory.getLogger(VniTableCustomizer.class);
-
- public VniTableCustomizer(FutureJVppCore futureJvpp) {
- super(futureJvpp);
- }
-
- @Override
- public void writeCurrentAttributes(InstanceIdentifier<VniTable> id, VniTable dataAfter, WriteContext writeContext)
- throws WriteFailedException {
- checkAtLeastOnChildExists(id, writeContext, false);
- }
-
- @Override
- public void updateCurrentAttributes(InstanceIdentifier<VniTable> id, VniTable dataBefore, VniTable dataAfter,
- WriteContext writeContext) throws WriteFailedException {
- throw new UnsupportedOperationException("Operation not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(InstanceIdentifier<VniTable> id, VniTable dataBefore, WriteContext writeContext)
- throws WriteFailedException {
- checkAtLeastOnChildExists(id, writeContext, true);
- }
-
- private void checkAtLeastOnChildExists(final InstanceIdentifier<VniTable> id, final WriteContext writeContext,
- final boolean before) {
-
- 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);
- }
-
- checkState(optData.isPresent(), "Illegal after-write state");
-
- 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
deleted file mode 100644
index a977871b5..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizer.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.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.rev161214.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/AbstractLispWriterFactoryBase.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/AbstractLispWriterFactoryBase.java
deleted file mode 100644
index 366caf846..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/AbstractLispWriterFactoryBase.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.translate.write.factory;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-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.rev161214.Lisp;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Basic attributes for lisp writer factories
- */
-abstract class AbstractLispWriterFactoryBase {
-
- protected final InstanceIdentifier<Lisp> lispInstanceIdentifier;
- protected final FutureJVppCore vppApi;
- protected NamingContext interfaceContext;
- protected NamingContext locatorSetContext;
- protected EidMappingContext localMappingContext;
- protected EidMappingContext remoteMappingContext;
-
- protected AbstractLispWriterFactoryBase(@Nonnull final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- @Nonnull final FutureJVppCore vppApi,
- NamingContext interfaceContext) {
- this.lispInstanceIdentifier = checkNotNull(lispInstanceIdentifier, "Lisp identifier is null");
- this.vppApi = checkNotNull(vppApi, "VPP Api refference is null");
- this.interfaceContext = interfaceContext;
- }
-
- protected AbstractLispWriterFactoryBase(@Nonnull final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- @Nonnull final FutureJVppCore vppApi,
- NamingContext interfaceContext,
- NamingContext locatorSetContext) {
- this.lispInstanceIdentifier = checkNotNull(lispInstanceIdentifier, "Lisp identifier is null");
- this.vppApi = checkNotNull(vppApi, "VPP Api refference is null");
- this.interfaceContext = interfaceContext;
- this.locatorSetContext = locatorSetContext;
- }
-
- protected AbstractLispWriterFactoryBase(@Nonnull final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- @Nonnull final FutureJVppCore vppApi,
- EidMappingContext localMappingContext,
- EidMappingContext remoteMappingContext) {
- this.lispInstanceIdentifier = checkNotNull(lispInstanceIdentifier, "Lisp identifier is null");
- this.vppApi = checkNotNull(vppApi, "VPP Api refference is null");
- this.localMappingContext = localMappingContext;
- this.remoteMappingContext = remoteMappingContext;
- }
-
- protected AbstractLispWriterFactoryBase(@Nonnull final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- @Nonnull final FutureJVppCore vppApi,
- NamingContext interfaceContext,
- NamingContext locatorSetContext,
- EidMappingContext localMappingContext,
- EidMappingContext remoteMappingContext) {
- this.lispInstanceIdentifier = checkNotNull(lispInstanceIdentifier, "Lisp identifier is null");
- this.vppApi = checkNotNull(vppApi, "VPP Api refference is null");
- this.interfaceContext = interfaceContext;
- this.locatorSetContext = locatorSetContext;
- this.localMappingContext = localMappingContext;
- this.remoteMappingContext = remoteMappingContext;
- }
-
- protected AbstractLispWriterFactoryBase(@Nonnull final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- @Nonnull final FutureJVppCore vppApi,
- NamingContext interfaceContext,
- EidMappingContext localMappingContext,
- EidMappingContext remoteMappingContext) {
- this.lispInstanceIdentifier = checkNotNull(lispInstanceIdentifier, "Lisp identifier is null");
- this.vppApi = checkNotNull(vppApi, "VPP Api refference is null");
- this.interfaceContext = interfaceContext;
- this.localMappingContext = localMappingContext;
- this.remoteMappingContext = remoteMappingContext;
- }
-}
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
deleted file mode 100755
index 055aa72b9..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LispWriterFactory.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.translate.write.factory;
-
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.ADJACENCIES_IDENTIFICATION_CONTEXT;
-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;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.REMOTE_MAPPING_CONTEXT;
-
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import io.fd.honeycomb.lisp.context.util.AdjacenciesMappingContext;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.translate.write.LispCustomizer;
-import io.fd.honeycomb.lisp.translate.write.PitrCfgCustomizer;
-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.rev161214.Lisp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfg;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-/**
- * Initialize writers for {@link Lisp}
- */
-public final class LispWriterFactory extends AbstractLispWriterFactoryBase implements WriterFactory {
-
- private final NamingContext bridgeDomainContext;
- private final AdjacenciesMappingContext adjacenciesMappingContext;
-
- @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,
- @Named(ADJACENCIES_IDENTIFICATION_CONTEXT) final AdjacenciesMappingContext adjacenciesMappingContext) {
- super(InstanceIdentifier.create(Lisp.class), vppApi, interfaceContext, locatorSetContext, localMappingContext,
- remoteMappingContext);
- this.bridgeDomainContext = checkNotNull(bridgeDomainContext, "Bridge domain context cannot be null");
- this.adjacenciesMappingContext =
- checkNotNull(adjacenciesMappingContext, "Adjacencies mapping 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,
- bridgeDomainContext, adjacenciesMappingContext)
- .init(registry);
- LocatorSetsWriterFactory.newInstance(lispInstanceIdentifier, vppApi, interfaceContext, locatorSetContext)
- .init(registry);
- MapResolversWriterFactory.newInstance(lispInstanceIdentifier, vppApi).init(registry);
-
- 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
deleted file mode 100755
index eabdfe27d..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LocatorSetsWriterFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.translate.write.factory;
-
-import io.fd.honeycomb.lisp.translate.write.InterfaceCustomizer;
-import io.fd.honeycomb.lisp.translate.write.LocatorSetCustomizer;
-import io.fd.honeycomb.translate.impl.write.GenericListWriter;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-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.rev161214.Lisp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.LocatorSets;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.Interface;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Factory producing writers for {@code LocatorSets}
- */
-final class LocatorSetsWriterFactory extends AbstractLispWriterFactoryBase implements WriterFactory {
-
- private LocatorSetsWriterFactory(final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- final FutureJVppCore vppApi,
- final NamingContext interfaceContext,
- final NamingContext locatorSetContext) {
- super(lispInstanceIdentifier, vppApi, interfaceContext, locatorSetContext);
- }
-
- public static LocatorSetsWriterFactory newInstance(
- @Nonnull final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- @Nonnull final FutureJVppCore vppApi,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext locatorSetContext) {
- return new LocatorSetsWriterFactory(lispInstanceIdentifier, vppApi, interfaceContext, locatorSetContext);
- }
-
- @Override
- public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
- InstanceIdentifier<LocatorSet> locatorSetId =
- 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),
- new InterfaceCustomizer(vppApi, interfaceContext)));
- }
-}
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
deleted file mode 100755
index 0586f88cd..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/MapResolversWriterFactory.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.translate.write.factory;
-
-
-import io.fd.honeycomb.lisp.translate.write.MapResolverCustomizer;
-import io.fd.honeycomb.translate.impl.write.GenericListWriter;
-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.rev161214.Lisp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.MapResolvers;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolver;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Factory responsible for producing writers for {@code MapResolvers}
- */
-final class MapResolversWriterFactory extends AbstractLispWriterFactoryBase implements WriterFactory {
-
- private MapResolversWriterFactory(final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- final FutureJVppCore vppApi) {
- super(lispInstanceIdentifier, vppApi, null);
- }
-
- public static MapResolversWriterFactory newInstance(
- @Nonnull final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- @Nonnull final FutureJVppCore vppApi) {
- return new MapResolversWriterFactory(lispInstanceIdentifier, vppApi);
- }
-
- @Override
- public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
- 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
deleted file mode 100755
index 9e9152ce0..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/VniTableWriterFactory.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * 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.translate.write.factory;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.collect.ImmutableSet;
-import io.fd.honeycomb.lisp.context.util.AdjacenciesMappingContext;
-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.rev161214.Lisp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.Adjacencies;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.LocalEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.RemoteEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.LocalMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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.rev161214.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.rev161214.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.rev161214.eid.table.grouping.EidTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-//TODO - HONEYCOMB-282 - refactor this and other factories for better readability
-
-/**
- * Factory for producing writers for {@code EidTable}
- */
-final class VniTableWriterFactory extends AbstractLispWriterFactoryBase implements WriterFactory {
-
- private final NamingContext bridgeDomainContext;
- private final AdjacenciesMappingContext adjacenciesMappingContext;
-
- private VniTableWriterFactory(final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- final FutureJVppCore vppApi,
- final EidMappingContext localMappingContext,
- final EidMappingContext remoteMappingContext,
- final NamingContext bridgeDomainContext,
- final AdjacenciesMappingContext adjacenciesMappingContext) {
- super(lispInstanceIdentifier, vppApi, localMappingContext, remoteMappingContext);
- this.bridgeDomainContext = checkNotNull(bridgeDomainContext, "Bridge domain context cannot be null");
- this.adjacenciesMappingContext =
- checkNotNull(adjacenciesMappingContext, "Adjacencies mapping 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,
- @Nonnull final NamingContext bridgeDomainContext,
- @Nonnull final AdjacenciesMappingContext adjacenciesMappingContext) {
- return new VniTableWriterFactory(lispInstanceIdentifier, vppApi, localMappingContext, remoteMappingContext,
- bridgeDomainContext, adjacenciesMappingContext);
- }
-
- @Override
- public void init(final ModifiableWriterRegistryBuilder registry) {
- final InstanceIdentifier<VniTable> vniTableId =
- 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.rev161214.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.rev161214.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.rev161214.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.rev161214.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<>(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<>(
- vrfSubtableId.child(RemoteMappings.class).child(RemoteMapping.class)
- .child(Adjacencies.class).child(Adjacency.class),
- new AdjacencyCustomizer(vppApi, localMappingContext, remoteMappingContext,
- adjacenciesMappingContext)));
- //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,
- adjacenciesMappingContext)));
- }
-}
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
deleted file mode 100644
index b00bfc09f..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriter.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.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.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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/main/resources/honeycomb-minimal-resources/config/lisp.json b/lisp/lisp2vpp/src/main/resources/honeycomb-minimal-resources/config/lisp.json
deleted file mode 100644
index 7a73a41bf..000000000
--- a/lisp/lisp2vpp/src/main/resources/honeycomb-minimal-resources/config/lisp.json
+++ /dev/null
@@ -1,2 +0,0 @@
-{
-} \ No newline at end of file
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
deleted file mode 100644
index 20c6aa3f7..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/LispModuleTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.Matchers.empty;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import com.google.inject.Guice;
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import com.google.inject.testing.fieldbinder.Bind;
-import com.google.inject.testing.fieldbinder.BoundFieldModule;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
-import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import java.util.HashSet;
-import java.util.Set;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-public class LispModuleTest {
-
- @Named("interface-context")
- @Bind
- private NamingContext interfaceContext;
-
- @Named("bridge-domain-context")
- @Bind
- private NamingContext bridgeDomainContext;
-
- @Named("honeycomb-context")
- @Bind
- @Mock
- private DataBroker honeycombContext;
-
- @Named("honeycomb-initializer")
- @Bind
- @Mock
- private DataBroker honeycombInitializer;
-
- @Bind
- @Mock
- private FutureJVppCore futureJVppCore;
-
- @Inject
- private Set<ReaderFactory> readerFactories = new HashSet<>();
-
- @Inject
- private Set<WriterFactory> writerFactories = new HashSet<>();
-
- @Before
- 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);
- }
-
- @Test
- public void testReaderFactories() throws Exception {
- assertThat(readerFactories, is(not(empty())));
-
- // Test registration process (all dependencies present, topological order of readers does exist, etc.)
- final CompositeReaderRegistryBuilder registryBuilder = new CompositeReaderRegistryBuilder();
- readerFactories.stream().forEach(factory -> factory.init(registryBuilder));
- assertNotNull(registryBuilder.build());
- }
-
- @Test
- public void testWriterFactories() throws Exception {
- assertThat(writerFactories, is(not(empty())));
-
- // Test registration process (all dependencies present, topological order of writers does exist, etc.)
- final FlatWriterRegistryBuilder registryBuilder = new FlatWriterRegistryBuilder();
- writerFactories.stream().forEach(factory -> factory.init(registryBuilder));
- assertNotNull(registryBuilder.build());
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/AdjacenciesMappingContextTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/AdjacenciesMappingContextTest.java
deleted file mode 100644
index 4a5302ba6..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/AdjacenciesMappingContextTest.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * 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 static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableSet;
-import io.fd.honeycomb.test.tools.HoneycombTestRunner;
-import io.fd.honeycomb.test.tools.annotations.InjectTestData;
-import io.fd.honeycomb.test.tools.annotations.InjectablesProcessor;
-import io.fd.honeycomb.test.tools.annotations.SchemaContextProvider;
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.util.RWUtils;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.$YangModuleInfoImpl;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.AdjacenciesIdentificationContexts;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.AdjacenciesIdentification;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.AdjacenciesIdentificationKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.Mappings;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.Mapping;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.MappingKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.mapping.EidIdentificatorPair;
-import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-
-@RunWith(HoneycombTestRunner.class)
-public class AdjacenciesMappingContextTest implements InjectablesProcessor {
-
- private static final String PARENT_1 = "first";
- private static final String PARENT_2 = "second";
- private static final String PARENT_3 = "third";
- private static final String PARENT_4 = "fourth";
-
- private static final String LOCAL_EID_ID_1 = "local-eid-1";
- private static final String LOCAL_EID_ID_2 = "local-eid-2";
- private static final String LOCAL_EID_ID_3 = "local-eid-3";
-
- private static final String REMOTE_EID_ID_1 = "remote-eid-1";
- private static final String REMOTE_EID_ID_2 = "remote-eid-2";
- private static final String REMOTE_EID_ID_3 = "remote-eid-3";
-
- @Mock
- private MappingContext mappingContext;
-
- @Captor
- private ArgumentCaptor<Mapping> mappingArgumentCaptor;
-
- @Captor
- private ArgumentCaptor<KeyedInstanceIdentifier<Mapping, MappingKey>> keyedInstanceIdentifierArgumentCaptor;
-
- private AdjacenciesMappingContext adjacenciesMappingContext;
- private KeyedInstanceIdentifier<AdjacenciesIdentification, AdjacenciesIdentificationKey>
- adjacenciesMappingContextId;
-
- @SchemaContextProvider
- public ModuleInfoBackedContext schemaContext() {
- return provideSchemaContextFor(ImmutableSet.of($YangModuleInfoImpl.getInstance(),
- org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.$YangModuleInfoImpl
- .getInstance()));
- }
-
- @InjectTestData(resourcePath = "/adjacencies-identification-context.json", id = "/naming-context:contexts" +
- "/adjacencies-identification-context:adjacencies-identification-contexts" +
- "/adjacencies-identification-context:adjacencies-identification[adjacencies-identification-context:name='context']" +
- "/adjacencies-identification-context:mappings")
- private Mappings mappings;
-
- @Before
- public void init() {
- MockitoAnnotations.initMocks(this);
-
- adjacenciesMappingContext = new AdjacenciesMappingContext("context");
- adjacenciesMappingContextId = InstanceIdentifier.create(AdjacenciesIdentificationContexts.class).child(
- AdjacenciesIdentification.class, new AdjacenciesIdentificationKey("context"));
-
- when(mappingContext.read(adjacenciesMappingContextId.child(Mappings.class))).thenReturn(Optional.of(mappings));
- when(mappingContext.read(parentKey(PARENT_1))).thenReturn(Optional.of(filterForParent(PARENT_1)));
- when(mappingContext.read(parentKey(PARENT_2))).thenReturn(Optional.of(filterForParent(PARENT_2)));
- when(mappingContext.read(parentKey(PARENT_3))).thenReturn(Optional.of(filterForParent(PARENT_3)));
- }
-
- private Mapping filterForParent(final String parent) {
- return mappings.getMapping().stream()
- .filter(mapping -> mapping.getId().equals(parent))
- .collect(RWUtils.singleItemCollector());
- }
-
- private KeyedInstanceIdentifier<Mapping, MappingKey> parentKey(final String parent) {
- return adjacenciesMappingContextId.child(Mappings.class).child(Mapping.class, new MappingKey(parent));
- }
-
- @Test
- public void getAdjacencyId() throws Exception {
- assertEquals(PARENT_1,
- adjacenciesMappingContext.getAdjacencyId(LOCAL_EID_ID_1, REMOTE_EID_ID_1, mappingContext));
- assertEquals(PARENT_2,
- adjacenciesMappingContext.getAdjacencyId(LOCAL_EID_ID_2, REMOTE_EID_ID_2, mappingContext));
- assertEquals(PARENT_3,
- adjacenciesMappingContext.getAdjacencyId(LOCAL_EID_ID_3, REMOTE_EID_ID_3, mappingContext));
- }
-
- @Test
- public void containsId() throws Exception {
- assertTrue(adjacenciesMappingContext.containsId(LOCAL_EID_ID_1, REMOTE_EID_ID_1, mappingContext));
- assertTrue(adjacenciesMappingContext.containsId(LOCAL_EID_ID_2, REMOTE_EID_ID_2, mappingContext));
- assertTrue(adjacenciesMappingContext.containsId(LOCAL_EID_ID_3, REMOTE_EID_ID_3, mappingContext));
- }
-
- @Test
- public void addEidPair() throws Exception {
- adjacenciesMappingContext.addEidPair(PARENT_4, LOCAL_EID_ID_1, REMOTE_EID_ID_3, mappingContext);
- verify(mappingContext, times(1))
- .put(keyedInstanceIdentifierArgumentCaptor.capture(), mappingArgumentCaptor.capture());
-
- final KeyedInstanceIdentifier<Mapping, MappingKey> key = keyedInstanceIdentifierArgumentCaptor.getValue();
- final Mapping mapping = mappingArgumentCaptor.getValue();
-
- assertEquals(PARENT_4, key.getKey().getId());
- assertEquals(PARENT_4, mapping.getId());
- assertEquals(PARENT_4, mapping.getKey().getId());
-
- final EidIdentificatorPair pair = mapping.getEidIdentificatorPair();
- assertEquals(LOCAL_EID_ID_1, pair.getLocalEidId().getValue());
- assertEquals(REMOTE_EID_ID_3, pair.getRemoteEidId().getValue());
- }
-
- @Test
- public void removeForIndex() throws Exception {
- adjacenciesMappingContext.removeForIndex(PARENT_1, mappingContext);
- adjacenciesMappingContext.removeForIndex(PARENT_2, mappingContext);
- adjacenciesMappingContext.removeForIndex(PARENT_3, mappingContext);
- verify(mappingContext, times(1)).delete(parentKey(PARENT_1));
- verify(mappingContext, times(1)).delete(parentKey(PARENT_2));
- verify(mappingContext, times(1)).delete(parentKey(PARENT_3));
- }
-
- @Test
- public void getEidPair() throws Exception {
- final EidIdentificatorPair pair1 = adjacenciesMappingContext.getEidPair(PARENT_1, mappingContext);
- final EidIdentificatorPair pair2 = adjacenciesMappingContext.getEidPair(PARENT_2, mappingContext);
- final EidIdentificatorPair pair3 = adjacenciesMappingContext.getEidPair(PARENT_3, mappingContext);
-
- assertEquals(LOCAL_EID_ID_1, pair1.getLocalEidId().getValue());
- assertEquals(REMOTE_EID_ID_1, pair1.getRemoteEidId().getValue());
- assertEquals(LOCAL_EID_ID_2, pair2.getLocalEidId().getValue());
- assertEquals(REMOTE_EID_ID_2, pair2.getRemoteEidId().getValue());
- assertEquals(LOCAL_EID_ID_3, pair3.getLocalEidId().getValue());
- assertEquals(REMOTE_EID_ID_3, pair3.getRemoteEidId().getValue());
- }
-
- @Test
- public void containsEidPairForIndex() throws Exception {
- assertTrue(adjacenciesMappingContext.containsEidPairForIndex(PARENT_1, mappingContext));
- assertTrue(adjacenciesMappingContext.containsEidPairForIndex(PARENT_2, mappingContext));
- assertTrue(adjacenciesMappingContext.containsEidPairForIndex(PARENT_3, mappingContext));
- }
-
-} \ No newline at end of file
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
deleted file mode 100644
index ccd38292e..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/EidMappingContextTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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 static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-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.MockitoAnnotations;
-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.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder;
-
-public class EidMappingContextTest implements EidMappingContextHelper {
-
- 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.rev161214.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_MAPPING_CONTEXT_NAME);
-
- localEid =
- new EidBuilder().setAddress(new Ipv4Builder().setIpv4(new Ipv4Address("192.168.2.1")).build()).build();
- remoteEid = fromLocalToRemoteEid(localEid);
- mappingEid = fromLocalToMappingEid(localEid);
- mappingId = new MappingId("mapping");
-
- defineEidMapping(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(mappingId, mappingContext);
-
- assertEquals("192.168.2.1", ((Ipv4) (loadedEid.getAddress())).getIpv4().getValue());
- }
-
- @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())
- .setAddressType(eid.getAddressType())
- .setVirtualNetworkId(eid.getVirtualNetworkId())
- .build();
- }
-
- private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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.rev161214.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/AdjacencyData.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/AdjacencyData.java
deleted file mode 100644
index 2ecfe175f..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/AdjacencyData.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.translate;
-
-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.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.EidBuilder;
-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.lisp.address.address.Ipv4Builder;
-
-public class AdjacencyData {
-
- public static final Long VNI = 12L;
-
- public static final Ipv4Address ADDRESS_ONE = new Ipv4Address("192.168.2.1");
- public static final Ipv4Address ADDRESS_TWO = new Ipv4Address("192.168.2.2");
- public static final Ipv4Address ADDRESS_THREE = new Ipv4Address("192.168.2.3");
- public static final Ipv4Address ADDRESS_FOUR = new Ipv4Address("192.168.2.4");
-
- public static final Eid LOCAL_EID_ONE = new EidBuilder()
- .setAddressType(Ipv4Afi.class)
- .setVirtualNetworkId(new InstanceIdType(VNI))
- .setAddress(new Ipv4Builder().setIpv4(ADDRESS_ONE).build())
- .build();
-
- public static final Eid LOCAL_EID_TWO = new EidBuilder()
- .setAddressType(Ipv4Afi.class)
- .setVirtualNetworkId(new InstanceIdType(VNI))
- .setAddress(new Ipv4Builder().setIpv4(ADDRESS_TWO).build())
- .build();
-
- public static final Eid REMOTE_EID_ONE = new EidBuilder()
- .setAddressType(Ipv4Afi.class)
- .setVirtualNetworkId(new InstanceIdType(VNI))
- .setAddress(new Ipv4Builder().setIpv4(ADDRESS_THREE).build())
- .build();
- public static final Eid REMOTE_EID_TWO = new EidBuilder()
- .setAddressType(Ipv4Afi.class)
- .setVirtualNetworkId(new InstanceIdType(VNI))
- .setAddress(new Ipv4Builder().setIpv4(ADDRESS_FOUR).build())
- .build();
-
-
-}
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
deleted file mode 100644
index 09d4d27fb..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizerTest.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.translate.read;
-
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.ADDRESS_ONE;
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.ADDRESS_THREE;
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.LOCAL_EID_ONE;
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.LOCAL_EID_TWO;
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.REMOTE_EID_ONE;
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.REMOTE_EID_TWO;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.contains;
-import static org.hamcrest.Matchers.hasSize;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.lisp.context.util.AdjacenciesMappingContext;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.translate.util.EidMetadataProvider;
-import io.fd.honeycomb.lisp.util.AdjacencyMappingContextTestHelper;
-import io.fd.honeycomb.lisp.util.EidMappingContextHelper;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.LispAdjacenciesGetReply;
-import io.fd.vpp.jvpp.core.types.LispAdjacency;
-import java.util.List;
-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.lisp.address.address.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.Adjacencies;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.AdjacenciesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.AdjacencyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.AdjacencyKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-public class AdjacencyCustomizerTest
- extends ListReaderCustomizerTest<Adjacency, AdjacencyKey, AdjacencyBuilder>
- implements ByteDataTranslator, EidMetadataProvider, EidMappingContextHelper, AdjacencyMappingContextTestHelper {
-
- private InstanceIdentifier<Adjacency> identifier;
-
- public AdjacencyCustomizerTest() {
- super(Adjacency.class, AdjacenciesBuilder.class);
- }
-
- @Before
- public void init() {
- identifier = InstanceIdentifier.create(EidTable.class)
- .child(VniTable.class, new VniTableKey(2L))
- .child(BridgeDomainSubtable.class)
- .child(RemoteMappings.class)
- .child(RemoteMapping.class, new RemoteMappingKey(new MappingId("remote-mapping")))
- .child(Adjacencies.class)
- .child(Adjacency.class, new AdjacencyKey("adj-one"));
-
-
- mockApi();
- defineEidMapping(mappingContext, LOCAL_EID_ONE, new MappingId("local-eid-one"), "local-mapping-context");
- defineEidMapping(mappingContext, LOCAL_EID_TWO, new MappingId("local-eid-two"), "local-mapping-context");
- defineEidMapping(mappingContext, REMOTE_EID_ONE, new MappingId("remote-eid-one"), "remote-mapping-context");
- defineEidMapping(mappingContext, REMOTE_EID_TWO, new MappingId("remote-eid-two"), "remote-mapping-context");
-
- defineAdjacencyMapping(mappingContext, "local-eid-one", "remote-eid-one", "adj-one",
- "adjacencies-mapping-context");
- defineAdjacencyMapping(mappingContext, "local-eid-two", "remote-eid-two", "adj-two",
- "adjacencies-mapping-context");
- mockApi();
- }
-
- @Test
- public void getAllIds() throws Exception {
- final List<AdjacencyKey> keys = getCustomizer().getAllIds(identifier, ctx);
-
- assertThat(keys, hasSize(2));
- assertThat(keys, contains(new AdjacencyKey("adj-one"), new AdjacencyKey("adj-two")));
- }
-
- @Test
- public void readCurrentAttributes() throws Exception {
- final AdjacencyBuilder builder = new AdjacencyBuilder();
- getCustomizer().readCurrentAttributes(identifier, builder, ctx);
-
- assertEquals("adj-one", builder.getId());
- assertEquals(new AdjacencyKey("adj-one"), builder.getKey());
- assertEquals(ADDRESS_ONE.getValue(), Ipv4.class.cast(builder.getLocalEid().getAddress()).getIpv4().getValue());
- assertEquals(ADDRESS_THREE.getValue(),
- Ipv4.class.cast(builder.getRemoteEid().getAddress()).getIpv4().getValue());
- }
-
- @Override
- protected ReaderCustomizer<Adjacency, AdjacencyBuilder> initCustomizer() {
- return new AdjacencyCustomizer(api, new EidMappingContext("local-mapping-context"),
- new EidMappingContext("remote-mapping-context"),
- new AdjacenciesMappingContext("adjacencies-mapping-context"));
- }
-
-
- private void mockApi() {
- LispAdjacency adjacencyOne = new LispAdjacency();
- adjacencyOne.eidType = 0;
- adjacencyOne.leid = new byte[]{-64, -88, 2, 1};
- adjacencyOne.leidPrefixLen = 32;
- adjacencyOne.reid = new byte[]{-64, -88, 2, 3};
- adjacencyOne.reidPrefixLen = 32;
-
-
- LispAdjacency adjacencyTwo = new LispAdjacency();
- adjacencyTwo.eidType = 0;
- adjacencyTwo.leid = new byte[]{-64, -88, 2, 2};
- adjacencyTwo.leidPrefixLen = 32;
- adjacencyTwo.reid = new byte[]{-64, -88, 2, 4};
- adjacencyTwo.reidPrefixLen = 32;
-
- LispAdjacenciesGetReply reply = new LispAdjacenciesGetReply();
- reply.adjacencies = new LispAdjacency[]{adjacencyOne, adjacencyTwo};
-
- when(api.lispAdjacenciesGet(any())).thenReturn(future(reply));
- }
-} \ No newline at end of file
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
deleted file mode 100644
index b230b3435..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizerTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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.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.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.rev161214.eid.table.grouping.EidTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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 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/InterfaceCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizerTest.java
deleted file mode 100644
index fb97dce5d..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizerTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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.translate.read;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.when;
-
-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.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
-import java.util.List;
-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.rev161214.locator.sets.grouping.LocatorSets;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSetBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSetKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.InterfaceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.InterfaceKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispLocatorDetails;
-import io.fd.vpp.jvpp.core.dto.LispLocatorDetailsReplyDump;
-
-public class InterfaceCustomizerTest
- extends ListReaderCustomizerTest<Interface, InterfaceKey, InterfaceBuilder> {
-
- public InterfaceCustomizerTest() {
- super(Interface.class, LocatorSetBuilder.class);
- }
-
- private InstanceIdentifier<Interface> validId;
-
- @Before
- public void init() {
- validId = InstanceIdentifier.create(LocatorSets.class).child(LocatorSet.class, new LocatorSetKey("loc-set-1"))
- .child(Interface.class, new InterfaceKey("interface-1"));
-
- //mappings
- defineMappings();
- //dump data
- defineDumpData();
- }
-
- private void defineDumpData() {
- final LispLocatorDetailsReplyDump dump = new LispLocatorDetailsReplyDump();
-
- final LispLocatorDetails detail1 = new LispLocatorDetails();
- detail1.swIfIndex = 1;
- detail1.ipAddress = new byte[]{-64, -88, 2, 1};
- detail1.isIpv6 = 0;
- detail1.local = 0;
- detail1.priority = 1;
- detail1.weight = 2;
-
- final LispLocatorDetails detail2 = new LispLocatorDetails();
- detail2.swIfIndex = 2;
- detail2.ipAddress = new byte[]{-64, -88, 2, 2};
- detail2.isIpv6 = 0;
- detail2.local = 0;
- detail2.priority = 2;
- detail2.weight = 3;
-
- dump.lispLocatorDetails = ImmutableList.of(detail1, detail2);
-
- when(api.lispLocatorDump(Mockito.any())).thenReturn(future(dump));
- }
-
- private void defineMappings() {
- defineMapping(mappingContext, "interface-1", 1, "interface-context");
- defineMapping(mappingContext, "interface-2", 2, "interface-context");
- defineMapping(mappingContext, "loc-set-1", 3, "locator-set-context");
- }
-
- @Test
- public void testGetAllIds() throws ReadFailedException {
-
- final List<InterfaceKey> keys = getCustomizer().getAllIds(validId, ctx);
-
- assertEquals(2, keys.size());
- assertEquals("interface-1", keys.get(0).getInterfaceRef());
- assertEquals("interface-2", keys.get(1).getInterfaceRef());
- }
-
- @Test
- public void testReadCurrentAttributes() throws ReadFailedException {
- InterfaceBuilder builder = new InterfaceBuilder();
- getCustomizer().readCurrentAttributes(validId, builder, ctx);
-
- final Interface iface = builder.build();
- assertEquals("interface-1", iface.getInterfaceRef());
- assertEquals("interface-1", iface.getKey().getInterfaceRef());
-
- }
-
- @Override
- protected ReaderCustomizer<Interface, InterfaceBuilder> initCustomizer() {
- return new InterfaceCustomizer(api, new NamingContext("interface", "interface-context"),
- new NamingContext("loc-set", "locator-set-context"));
- }
-}
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
deleted file mode 100644
index 9b810b94d..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizerTest.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * 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.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.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.rev161214.itr.remote.locator.sets.grouping.ItrRemoteLocatorSet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.itr.remote.locator.sets.grouping.ItrRemoteLocatorSetBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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 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/LispStateCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LispStateCustomizerTest.java
deleted file mode 100644
index 33d956f8e..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LispStateCustomizerTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.translate.read;
-
-import static org.junit.Assert.assertEquals;
-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.vpp.test.read.ReaderCustomizerTest;
-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.rev161214.LispState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.LispStateBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.ShowLispStatusReply;
-
-public class LispStateCustomizerTest extends ReaderCustomizerTest<LispState, LispStateBuilder> {
-
- private InstanceIdentifier<LispState> identifier;
-
- public LispStateCustomizerTest() {
- super(LispState.class, null);
- }
-
- @Before
- public void init() {
- identifier = InstanceIdentifier.create(LispState.class);
- final ShowLispStatusReply reply = new ShowLispStatusReply();
- reply.featureStatus = 1;
-
- when(api.showLispStatus(Mockito.any())).thenReturn(future(reply));
- }
-
- @Test
- public void testReadCurrentAttributes() throws ReadFailedException {
-
- LispStateBuilder builder = new LispStateBuilder();
- getCustomizer().readCurrentAttributes(identifier, builder, ctx);
-
- assertEquals(true, builder.build().isEnable());
- }
-
- @Override
- protected ReaderCustomizer<LispState, LispStateBuilder> initCustomizer() {
- return new LispStateCustomizer(api);
- }
-
- @Override
- public void testMerge() throws Exception {
- //LispState is root node, so there is no way to implement merge(it is also not needed)
- }
-}
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
deleted file mode 100644
index 065adcc4e..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizerTest.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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.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;
-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;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
-import java.util.List;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.EidBuilder;
-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.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.LocalMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.LocalMappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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 LocalMappingCustomizerTest extends
- ListReaderCustomizerTest<LocalMapping, LocalMappingKey, LocalMappingBuilder> implements EidTranslator {
-
- private static final Ipv4
- EID_ADDRESS = new Ipv4Builder().setIpv4(new Ipv4Address("192.168.2.1")).build();
-
- @Mock
- private EidMappingContext localMappingContext;
-
- private InstanceIdentifier<LocalMapping> emptyIdentifier;
- private InstanceIdentifier<LocalMapping> validIdentifier;
-
- public LocalMappingCustomizerTest() {
- super(LocalMapping.class, LocalMappingsBuilder.class);
- }
-
-
- 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")));
-
- defineDumpData();
- defineMappings();
- }
-
- private void defineDumpData() {
- 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.eidType = (byte) IPV4.getValue();
- detail.isLocal = 1;
- detail.locatorSetIndex = 1;
- detail.ttl = 7;
- detail.vni = 12;
-
- replyDump.lispEidTableDetails = ImmutableList.of(detail);
- when(api.lispEidTableDump(any())).thenReturn(future(replyDump));
- }
-
- private void defineMappings() {
- //eid mapping
-
- when(localMappingContext.getId(any(Eid.class), any(MappingContext.class)))
- .thenReturn(new MappingId("local-mapping"));
- when(localMappingContext.containsEid(new MappingId("local-mapping"), mappingContext)).thenReturn(true);
- when(localMappingContext.getEid(new MappingId("local-mapping"), mappingContext)).thenReturn(new EidBuilder()
- .setAddress(EID_ADDRESS).build());
- //naming context for locator
- defineMapping(mappingContext, "loc-set", 1, "locator-set-context");
- }
-
- @Test
- public void readCurrentAttributes() throws Exception {
- LocalMappingBuilder builder = new LocalMappingBuilder();
- getCustomizer().readCurrentAttributes(validIdentifier, builder, ctx);
-
- final LocalMapping mapping = builder.build();
-
- assertNotNull(mapping);
- assertEquals(true, compareAddresses(EID_ADDRESS, mapping.getEid().getAddress()));
- assertEquals("loc-set", mapping.getLocatorSet());
- }
-
- @Test
- public void getAllIds() throws Exception {
- final List<LocalMappingKey> keys = getCustomizer().getAllIds(emptyIdentifier, ctx);
-
- assertEquals(1, keys.size());
- assertEquals("local-mapping", keys.get(0).getId().getValue());
- }
-
- @Override
- protected ReaderCustomizer<LocalMapping, LocalMappingBuilder> initCustomizer() {
- return new LocalMappingCustomizer(api, new NamingContext("loc", "locator-set-context"), localMappingContext);
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizerTest.java
deleted file mode 100644
index e863ba2bb..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizerTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.translate.read;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.when;
-
-import com.google.common.collect.ImmutableList;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
-import java.nio.charset.StandardCharsets;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.LocatorSets;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.LocatorSetsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSetBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSetKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetails;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump;
-
-
-public class LocatorSetCustomizerTest
- extends ListReaderCustomizerTest<LocatorSet, LocatorSetKey, LocatorSetBuilder> {
-
- private InstanceIdentifier<LocatorSet> emptyId;
- private InstanceIdentifier<LocatorSet> validId;
-
- public LocatorSetCustomizerTest() {
- super(LocatorSet.class, LocatorSetsBuilder.class);
- }
-
- @Before
- public void init() {
- emptyId = InstanceIdentifier.create(LocatorSet.class);
- validId = InstanceIdentifier.create(LocatorSets.class).child(LocatorSet.class, new LocatorSetKey("loc-set"));
-
- defineDumpData();
- defineMapping(mappingContext, "loc-set", 1, "locator-set-context");
- }
-
- private void defineDumpData() {
- LispLocatorSetDetailsReplyDump dump = new LispLocatorSetDetailsReplyDump();
- LispLocatorSetDetails detail = new LispLocatorSetDetails();
- detail.context = 4;
- detail.lsName = "loc-set".getBytes(StandardCharsets.UTF_8);
- detail.lsIndex = 1;
-
- dump.lispLocatorSetDetails = ImmutableList.of(detail);
-
- when(api.lispLocatorSetDump(any())).thenReturn(future(dump));
- }
-
-
- @Test
- public void readCurrentAttributes() throws Exception {
- LocatorSetBuilder builder = new LocatorSetBuilder();
- getCustomizer().readCurrentAttributes(validId, builder, ctx);
-
- assertNotNull(builder);
- assertEquals("loc-set", builder.getName());
- assertEquals("loc-set", builder.getKey().getName());
- }
-
- @Test
- public void getAllIds() throws Exception {
- final List<LocatorSetKey> keys = getCustomizer().getAllIds(emptyId, ctx);
-
- assertEquals(1, keys.size());
- assertEquals("loc-set", keys.get(0).getName());
- }
-
- @Override
- protected ReaderCustomizer<LocatorSet, LocatorSetBuilder> initCustomizer() {
- return new LocatorSetCustomizer(api, new NamingContext("loc", "locator-set-context"));
- }
-} \ No newline at end of file
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
deleted file mode 100644
index adcbdb643..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizerTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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.translate.read;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
-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;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.MapResolvers;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.MapResolversBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolver;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolverBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolverKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-public class MapResolverCustomizerTest
- extends ListReaderCustomizerTest<MapResolver, MapResolverKey, MapResolverBuilder> {
-
- private static final IpAddress IP_ADDRESS_REVERTED =
- new IpAddress(new Ipv4AddressNoZone("1.2.168.192"));
-
- private InstanceIdentifier<MapResolver> emptyId;
- private InstanceIdentifier<MapResolver> validId;
-
- public MapResolverCustomizerTest() {
- super(MapResolver.class, MapResolversBuilder.class);
- }
-
- @Before
- public void init() {
-
- emptyId = InstanceIdentifier.create(MapResolver.class);
- validId = InstanceIdentifier.create(MapResolvers.class)
- .child(MapResolver.class, new MapResolverKey(IP_ADDRESS_REVERTED));
- defineDumpData();
- }
-
- @Test
- public void readCurrentAttributes() throws Exception {
- MapResolverBuilder builder = new MapResolverBuilder();
- getCustomizer().readCurrentAttributes(validId, builder, ctx);
-
- MapResolver resolver = builder.build();
- assertNotNull(resolver);
- assertEquals("1.2.168.192", resolver.getIpAddress().getIpv4Address().getValue());
- }
-
- @Test
- public void getAllIds() throws Exception {
- final List<MapResolverKey> keys = getCustomizer().getAllIds(emptyId, ctx);
-
- assertEquals(1, keys.size());
-
- final MapResolverKey key = keys.get(0);
- assertNotNull(key);
- assertEquals("1.2.168.192", new String(key.getIpAddress().getValue()));
-
- }
-
- private void defineDumpData() {
- final LispMapResolverDetailsReplyDump replyDump = new LispMapResolverDetailsReplyDump();
- final LispMapResolverDetails detail = new LispMapResolverDetails();
- detail.context = 5;
- detail.ipAddress = new byte[]{1, 2, -88, -64};
- detail.isIpv6 = 0;
-
- replyDump.lispMapResolverDetails = ImmutableList.of(detail);
-
- when(api.lispMapResolverDump(any())).thenReturn(future(replyDump));
- }
-
- @Override
- protected ReaderCustomizer<MapResolver, MapResolverBuilder> initCustomizer() {
- return new MapResolverCustomizer(api);
- }
-} \ No newline at end of file
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
deleted file mode 100644
index 52abdf818..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizerTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.translate.read;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-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.rev161214.LispStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureDataBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfg;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfgBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.ShowLispPitrReply;
-
-
-public class PitrCfgCustomizerTest extends ReaderCustomizerTest<PitrCfg, PitrCfgBuilder> {
-
- private static final byte[] LOC_SET_NAME_BYTES = "loc-set".getBytes(StandardCharsets.UTF_8);
-
- private InstanceIdentifier<PitrCfg> emptyId;
-
- public PitrCfgCustomizerTest() {
- super(PitrCfg.class, LispFeatureDataBuilder.class);
- }
-
- @Before
- public void init() {
- emptyId = InstanceIdentifier.create(PitrCfg.class);
-
- mockDumpData();
- }
-
- @Test
- public void readCurrentAttributes() throws Exception {
- PitrCfgBuilder builder = new PitrCfgBuilder();
- getCustomizer().readCurrentAttributes(emptyId, builder, ctx);
-
- final PitrCfg cfg = builder.build();
-
- assertNotNull(cfg);
- assertEquals("loc-set", cfg.getLocatorSet());
- }
-
- private void mockDumpData() {
- ShowLispPitrReply replyDump = new ShowLispPitrReply();
- replyDump.locatorSetName = LOC_SET_NAME_BYTES;
- replyDump.status = 1;
-
- when(api.showLispPitr(any())).thenReturn(future(replyDump));
- }
-
- @Override
- protected ReaderCustomizer<PitrCfg, PitrCfgBuilder> initCustomizer() {
- return new PitrCfgCustomizer(api);
- }
-} \ No newline at end of file
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
deleted file mode 100644
index 27c243e8b..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizerTest.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * 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.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;
-
-import com.google.common.collect.ImmutableList;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-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.translate.vpp.util.NamingContext;
-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;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.EidBuilder;
-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.rev161214.MapReplyAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.NegativeMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.PositiveMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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.rev161214.eid.table.grouping.EidTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class RemoteMappingCustomizerTest
- extends ListReaderCustomizerTest<RemoteMapping, RemoteMappingKey, RemoteMappingBuilder>
- implements EidTranslator {
-
- private static final Ipv4
- EID_ADDRESS = new Ipv4Builder().setIpv4(new Ipv4Address("192.168.2.1")).build();
-
- @Mock
- private EidMappingContext eidMappingContext;
-
- private InstanceIdentifier<RemoteMapping> validId;
-
- public RemoteMappingCustomizerTest() {
- super(RemoteMapping.class, RemoteMappingsBuilder.class);
- }
-
- @Before
- public void init() {
-
- 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")));
- mockMappings();
- defineMapping(mappingContext,"loc-set",1,"loc-set-context");
- }
-
-
- 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;
- 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();
- 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)))
- .thenReturn(new MappingId("remote-mapping"));
- when(eidMappingContext.containsEid(new MappingId("remote-mapping"), mappingContext)).thenReturn(true);
- when(eidMappingContext.getEid(new MappingId("remote-mapping"), mappingContext))
- .thenReturn(new EidBuilder().setAddress(EID_ADDRESS).build());
-
- }
-
- @Test
- 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);
-
- 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 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);
- assertEquals(1, keys.size());
- assertEquals("remote-mapping", keys.get(0).getId().getValue());
- }
-
- @Override
- protected ReaderCustomizer<RemoteMapping, RemoteMappingBuilder> initCustomizer() {
- return new RemoteMappingCustomizer(api, new NamingContext("loc-set", "loc-set-context"), eidMappingContext);
- }
-} \ No newline at end of file
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
deleted file mode 100644
index 1ff6cc631..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizerTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.translate.read;
-
-
-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.Mockito.when;
-
-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.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 org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class VniTableCustomizerTest extends ListReaderCustomizerTest<VniTable, VniTableKey, VniTableBuilder> {
-
- private InstanceIdentifier<VniTable> validId;
-
- public VniTableCustomizerTest() {
- super(VniTable.class, EidTableBuilder.class);
- }
-
- @Before
- public void init() {
- validId = InstanceIdentifier.create(EidTable.class).child(VniTable.class, new VniTableKey(12L));
- }
-
- @Test
- public void testReadAllSuccessfull() throws ReadFailedException {
- whenLispEidTableVniDumpReturnValid();
- final List<VniTableKey> keys = getCustomizer().getAllIds(validId, ctx);
-
- assertNotNull(keys);
- assertEquals(3, keys.size());
- assertTrue(keys.contains(new VniTableKey(12L)));
- assertTrue(keys.contains(new VniTableKey(14L)));
- assertTrue(keys.contains(new VniTableKey(16L)));
- }
-
- @Test
- public void testReadAllFailed() {
- whenLispEidTableVniDumpThrowException();
- try {
- getCustomizer().getAllIds(validId, ctx);
- } catch (ReadFailedException e) {
- assertTrue(e.getCause() instanceof VppCallbackException);
- return;
- }
-
- fail("Test should have thrown ReadFailedException");
- }
-
- @Test
- public void testReadAttributes() throws ReadFailedException {
- whenLispEidTableVniDumpReturnValid();
- VniTableBuilder builder = new VniTableBuilder();
-
- customizer.readCurrentAttributes(validId, builder, ctx);
-
- final VniTable table = builder.build();
- assertNotNull(table);
- 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(failedFuture());
- }
-
- @Override
- protected ReaderCustomizer<VniTable, VniTableBuilder> initCustomizer() {
- return new VniTableCustomizer(api);
- }
-} \ No newline at end of file
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
deleted file mode 100644
index 58965edc6..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizerTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.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.vpp.jvpp.VppCallbackException;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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 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/trait/MappingProducerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducerTest.java
deleted file mode 100644
index 313f27dad..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducerTest.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * 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.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.rev161214.dp.subtable.grouping.LocalMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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.rev161214.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.rev161214.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.rev161214.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/MappingReaderTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReaderTest.java
deleted file mode 100644
index 9366037a1..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReaderTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.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.rev161214.dp.subtable.grouping.LocalMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class MappingReaderTest implements MappingReader {
-
- 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/SubtableReaderTestCase.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReaderTestCase.java
deleted file mode 100644
index 3313395df..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReaderTestCase.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.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
deleted file mode 100755
index bc0bfc94a..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/util/EidTranslatorTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.translate.util;
-
-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 static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-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.inet.types.rev130715.Ipv6Address;
-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.Ipv6Builder;
-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;
-
-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.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
- .setAddress(
- new Ipv4Builder().setIpv4(
- new Ipv4Address("192.168.2.1"))
- .build())
- .build()));
-
- assertEquals(IPV6, getEidType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
- .setAddress(
- new Ipv6Builder().setIpv6(
- new Ipv6Address("2001:0db8:0a0b:12f0:0000:0000:0000:0001"))
- .build())
- .build()));
-
- assertEquals(MAC, getEidType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
- .setAddress(
- new MacBuilder().setMac(
- new MacAddress("aa:bb:cc:dd:ee:ff"))
- .build())
- .build()));
- }
-}
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
deleted file mode 100644
index 0b2536b85..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizerTest.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * 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.translate.write;
-
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.ADDRESS_ONE;
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.ADDRESS_THREE;
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.LOCAL_EID_ONE;
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.REMOTE_EID_ONE;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV4;
-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.AdjacenciesMappingContext;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.util.EidMappingContextHelper;
-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.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.Adjacencies;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.AdjacencyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.AdjacencyKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.LocalEidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.RemoteEidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class AdjacencyCustomizerTest extends WriterCustomizerTest implements EidMappingContextHelper {
-
- @Captor
- private ArgumentCaptor<LispAddDelAdjacency> requestCaptor;
-
- private EidMappingContext localMappingContext;
-
- private EidMappingContext remoteMappingContext;
-
- @Mock
- private AdjacenciesMappingContext adjacenciesMappingContext;
-
- private AdjacencyCustomizer customizer;
-
- private InstanceIdentifier<Adjacency> emptyId;
- private InstanceIdentifier<Adjacency> validId;
-
- private Adjacency emptyData;
- private Adjacency invalidData;
- private Adjacency validData;
-
- @Before
- public void init() {
- localMappingContext = new EidMappingContext("local-mapping-context");
- remoteMappingContext = new EidMappingContext("remote-mapping-context");
- customizer = new AdjacencyCustomizer(api, localMappingContext, remoteMappingContext, adjacenciesMappingContext);
-
- 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, new RemoteMappingKey(new MappingId("remote-mapping")))
- .child(Adjacencies.class)
- .child(Adjacency.class, new AdjacencyKey("adj-one"));
-
- emptyData = new AdjacencyBuilder().build();
-
- invalidData = new AdjacencyBuilder().setId("ID").setLocalEid(
- 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(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()
- .setVirtualNetworkId(new InstanceIdType(12L))
- .setAddressType(Ipv4Afi.class)
- .setAddress(new Ipv4Builder().setIpv4(ADDRESS_ONE).build())
- .build()).setRemoteEid(
- new RemoteEidBuilder()
- .setVirtualNetworkId(new InstanceIdType(12L))
- .setAddressType(Ipv4Afi.class)
- .setAddress(new Ipv4Builder().setIpv4(ADDRESS_THREE).build()).build()).build();
-
- when(api.lispAddDelAdjacency(any())).thenReturn(future(new LispAddDelAdjacencyReply()));
- }
-
- @Test
- public void writeCurrentAttributesNoKey() throws Exception {
- 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
- public void writeCurrentAttributesInvalidCombination() throws Exception {
- 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 {
- defineEidMapping(mappingContext, LOCAL_EID_ONE, new MappingId("local-eid-one"), "local-mapping-context");
- defineEidMapping(mappingContext, REMOTE_EID_ONE, new MappingId("remote-eid-one"), "remote-mapping-context");
- 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, 2, 3},
- 32, IPV4.getValue(), 2);
- verify(adjacenciesMappingContext, times(1))
- .addEidPair("adj-one", "local-eid-one", "remote-eid-one", mappingContext);
- }
-
- @Test
- public void writeCurrentAttributesNonExistingLocalMapping() throws Exception {
- noEidMappingDefined(mappingContext, "local-eid-one", "local-mapping-context");
- defineEidMapping(mappingContext, REMOTE_EID_ONE, new MappingId("remote-eid-one"), "remote-mapping-context");
- 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 {
- noEidMappingDefined(mappingContext, "remote-eid-one", "remote-mapping-context");
- defineEidMapping(mappingContext, LOCAL_EID_ONE, new MappingId("local-eid-one"), "local-mapping-context");
-
- 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
- public void deleteCurrentAttributesNoKey() throws Exception {
- 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)
- public void deleteCurrentAttributesInvalidCombination() throws Exception {
- customizer.deleteCurrentAttributes(validId, invalidData, writeContext);
- }
-
- @Test
- public void deleteCurrentAttributes() throws Exception {
- customizer.deleteCurrentAttributes(validId, validData, writeContext);
- verify(api, times(1)).lispAddDelAdjacency(requestCaptor.capture());
- verifyRequest(requestCaptor.getValue(), 0, new byte[]{-64, -88, 2, 1}, 32, new byte[]{-64, -88, 2, 3},
- 32, IPV4.getValue(), 2);
- verify(adjacenciesMappingContext, times(1)).removeForIndex("adj-one", mappingContext);
- }
-
- private static void verifyRequest(final LispAddDelAdjacency request, final int isAdd, final byte[] leid,
- final int leidLen, final byte[] reid, final int reidLen, final int eidType,
- final int vni) {
-
- assertNotNull(request);
- assertEquals(isAdd, request.isAdd);
- assertArrayEquals(leid, request.leid);
- assertEquals(leidLen, request.leidLen);
- assertArrayEquals(reid, request.reid);
- assertEquals(reidLen, request.reidLen);
- assertEquals(eidType, request.eidType);
- assertEquals(vni, request.vni);
-
- }
-} \ No newline at end of file
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
deleted file mode 100644
index ada98bfb8..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainCustomizerTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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.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.rev161214.eid.table.grouping.EidTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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
deleted file mode 100755
index a27e5ae94..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizerTest.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * 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.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.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-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.rev161214.Lisp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.LocatorSets;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSetKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.InterfaceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.InterfaceKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispAddDelLocator;
-import io.fd.vpp.jvpp.core.dto.LispAddDelLocatorReply;
-
-public class InterfaceCustomizerTest extends WriterCustomizerTest implements ByteDataTranslator {
-
- @Captor
- private ArgumentCaptor<LispAddDelLocator> intfCaptor;
-
- private InstanceIdentifier<Interface> id;
- private Interface intf;
- private InterfaceCustomizer customizer;
-
- @Override
- public void setUp() {
- final String ifcCtxName = "INInterruptedException, ExecutionException, STANCE";
- final String interfaceName = "Interface";
- 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))
- .build();
-
- intf = new InterfaceBuilder()
- .setPriority((short) 1)
- .setWeight((short) 2)
- .build();
-
- customizer = new InterfaceCustomizer(api, new NamingContext("PREFIX", ifcCtxName));
-
- when(api.lispAddDelLocator(any(LispAddDelLocator.class))).thenReturn(future(new LispAddDelLocatorReply()));
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, null, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullPriority() throws WriteFailedException {
- Interface intf = mock(Interface.class);
- when(intf.getWeight()).thenReturn((short) 1);
- when(intf.getPriority()).thenReturn(null);
-
- customizer.writeCurrentAttributes(null, intf, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullWeight() throws WriteFailedException {
- Interface intf = mock(Interface.class);
- when(intf.getWeight()).thenReturn(null);
- when(intf.getPriority()).thenReturn((short) 1);
-
- customizer.writeCurrentAttributes(null, intf, null);
- }
-
- @Test
- public void testWriteCurrentAttributes() throws WriteFailedException {
- customizer.writeCurrentAttributes(id, intf, writeContext);
-
- verify(api, times(1)).lispAddDelLocator(intfCaptor.capture());
-
- LispAddDelLocator request = intfCaptor.getValue();
-
- assertNotNull(request);
- assertEquals(1, request.isAdd);
- assertEquals(2, request.weight);
- assertEquals(1, request.priority);
- assertEquals(5, request.swIfIndex);
- assertEquals("Locator", toString(request.locatorSetName));
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdateCurrentAttributes() throws WriteFailedException {
- customizer.updateCurrentAttributes(null, null, null, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesNullData() throws WriteFailedException {
- customizer.deleteCurrentAttributes(null, null, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesNullPriority() throws WriteFailedException {
- Interface interf = mock(Interface.class);
- when(interf.getWeight()).thenReturn((short) 1);
- when(interf.getPriority()).thenReturn(null);
-
- customizer.deleteCurrentAttributes(null, interf, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesNullWeight() throws WriteFailedException {
- Interface interf = mock(Interface.class);
- when(interf.getWeight()).thenReturn(null);
- when(interf.getPriority()).thenReturn((short) 1);
-
- customizer.deleteCurrentAttributes(null, interf, null);
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws WriteFailedException {
- customizer.deleteCurrentAttributes(id, intf, writeContext);
-
- verify(api, times(1)).lispAddDelLocator(intfCaptor.capture());
-
- LispAddDelLocator request = intfCaptor.getValue();
-
- assertNotNull(request);
- assertEquals(0, request.isAdd);
- assertEquals(2, request.weight);
- assertEquals(1, request.priority);
- assertEquals(5, request.swIfIndex);
- assertEquals("Locator", toString(request.locatorSetName));
- }
-}
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
deleted file mode 100644
index 585589470..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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.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.rev161214.itr.remote.locator.sets.grouping.ItrRemoteLocatorSet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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/LispCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LispCustomizerTest.java
deleted file mode 100755
index 380335cd3..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LispCustomizerTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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.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.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.Lisp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.LispBuilder;
-import io.fd.vpp.jvpp.core.dto.LispEnableDisable;
-import io.fd.vpp.jvpp.core.dto.LispEnableDisableReply;
-
-
-public class LispCustomizerTest extends WriterCustomizerTest {
-
- private LispCustomizer customizer;
-
- @Override
- public void setUp() {
- customizer = new LispCustomizer(api);
- }
-
- private void whenlispEnableDisableThenSuccess() {
- when(api.lispEnableDisable(any(LispEnableDisable.class))).thenReturn(future(new LispEnableDisableReply()));
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, null, null);
- }
-
- @Test
- public void testWriteCurrentAttributes() throws WriteFailedException {
- Lisp intf = new LispBuilder().setEnable(true).build();
-
- whenlispEnableDisableThenSuccess();
- customizer.writeCurrentAttributes(null, intf, null);
-
- ArgumentCaptor<LispEnableDisable> mappingCaptor = ArgumentCaptor.forClass(LispEnableDisable.class);
- verify(api, times(1)).lispEnableDisable(mappingCaptor.capture());
-
- LispEnableDisable request = mappingCaptor.getValue();
-
- assertNotNull(request);
- assertEquals(1, request.isEn);
- }
-
- @Test(expected = NullPointerException.class)
- public void testUpdateCurrentAttributesNullData() throws WriteFailedException {
- customizer.updateCurrentAttributes(null, null, null, null);
- }
-
- @Test
- public void testUpdateCurrentAttributes() throws WriteFailedException {
- Lisp lisp = new LispBuilder().setEnable(true).build();
-
- whenlispEnableDisableThenSuccess();
- customizer.updateCurrentAttributes(null, null, lisp, null);
-
- ArgumentCaptor<LispEnableDisable> lispCaptor = ArgumentCaptor.forClass(LispEnableDisable.class);
- verify(api, times(1)).lispEnableDisable(lispCaptor.capture());
-
- LispEnableDisable request = lispCaptor.getValue();
-
- assertNotNull(request);
- assertEquals(1, request.isEn);
- }
-
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesNullData() throws WriteFailedException {
- customizer.deleteCurrentAttributes(null, null, null);
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws WriteFailedException {
- Lisp lisp = new LispBuilder().setEnable(true).build();
-
- whenlispEnableDisableThenSuccess();
- customizer.deleteCurrentAttributes(null, lisp, null);
-
- ArgumentCaptor<LispEnableDisable> lispCaptor = ArgumentCaptor.forClass(LispEnableDisable.class);
- verify(api, times(1)).lispEnableDisable(lispCaptor.capture());
-
- LispEnableDisable request = lispCaptor.getValue();
-
- assertNotNull(request);
- assertEquals(0, request.isEn);
- }
-}
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
deleted file mode 100755
index cfcc2befb..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizerTest.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * 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.translate.write;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-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.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import java.util.concurrent.ExecutionException;
-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.rev161214.Lisp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.LocalMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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;
-
-public class LocalMappingCustomizerTest extends WriterCustomizerTest implements ByteDataTranslator, Ipv4Translator {
-
- @Mock
- private EidMappingContext eidMappingContext;
- @Captor
- private ArgumentCaptor<LispAddDelLocalEid> mappingCaptor;
-
- private InstanceIdentifier<LocalMapping> id;
- private LocalMapping mapping;
- private LocalMappingCustomizer customizer;
-
- @Override
- public void setUp() {
- final Eid
- eid = new EidBuilder()
- .setAddressType(Ipv4Afi.class)
- .setAddress(
- new Ipv4Builder().setIpv4(
- new Ipv4Address("192.168.2.1"))
- .build())
- .build();
-
- mapping = new LocalMappingBuilder()
- .setEid(eid)
- .setLocatorSet("Locator")
- .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();
-
- customizer = new LocalMappingCustomizer(api, eidMappingContext);
-
- when(api.lispAddDelLocalEid(any(LispAddDelLocalEid.class))).thenReturn(future(new LispAddDelLocalEidReply()));
- }
-
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, null, writeContext);
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullEid() throws WriteFailedException {
- LocalMapping mapping = mock(LocalMapping.class);
- when(mapping.getEid()).thenReturn(null);
- when(mapping.getLocatorSet()).thenReturn("Locator");
-
- customizer.writeCurrentAttributes(null, mapping, writeContext);
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullLocator() throws WriteFailedException {
- LocalMapping mapping = mock(LocalMapping.class);
- when(mapping.getEid()).thenReturn(mock(Eid.class));
- when(mapping.getLocatorSet()).thenReturn(null);
-
- customizer.writeCurrentAttributes(null, mapping, writeContext);
- }
-
-
- @Test
- public void testWriteCurrentAttributes() throws WriteFailedException {
- customizer.writeCurrentAttributes(id, mapping, writeContext);
-
- verify(api, times(1)).lispAddDelLocalEid(mappingCaptor.capture());
-
- LispAddDelLocalEid request = mappingCaptor.getValue();
-
- assertNotNull(request);
- assertEquals("Locator", new String(request.locatorSetName));
- assertEquals("1.2.168.192", arrayToIpv4AddressNoZone(request.eid).getValue());
- assertEquals(0, request.eidType);
- assertEquals(1, request.isAdd);
- assertEquals(25, request.vni);
- assertEquals("Locator", toString(request.locatorSetName));
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdateCurrentAttributes() throws WriteFailedException {
- customizer.updateCurrentAttributes(null, null, null, writeContext);
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws WriteFailedException, InterruptedException, ExecutionException {
- when(eidMappingContext.containsEid(any(), eq(mappingContext))).thenReturn(true);
- customizer.deleteCurrentAttributes(id, mapping, writeContext);
-
- verify(api, times(1)).lispAddDelLocalEid(mappingCaptor.capture());
-
- LispAddDelLocalEid request = mappingCaptor.getValue();
-
- assertNotNull(request);
- assertEquals("Locator", new String(request.locatorSetName));
- assertEquals("1.2.168.192", arrayToIpv4AddressNoZone(request.eid).getValue());
- assertEquals(0, request.eidType);
- assertEquals(0, request.isAdd);
- assertEquals(25, request.vni);
- assertEquals("Locator", toString(request.locatorSetName));
- }
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizerTest.java
deleted file mode 100755
index 30d33a51b..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizerTest.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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.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.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableList;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.LispAddDelLocatorSet;
-import io.fd.vpp.jvpp.core.dto.LispAddDelLocatorSetReply;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetails;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump;
-import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.concurrent.ExecutionException;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.LocatorSets;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSetBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSetKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.InterfaceBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class LocatorSetCustomizerTest extends WriterCustomizerTest {
-
- private LocatorSetCustomizer customizer;
-
- @Override
- public void setUp() {
- customizer = new LocatorSetCustomizer(api, new NamingContext("locator-set", "locator-set-context"));
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, null, writeContext);
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesBadData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, mock(LocatorSet.class), writeContext);
- }
-
- @Test
- public void testWriteCurrentAttributes() throws WriteFailedException, InterruptedException, ExecutionException {
- noMappingDefined(mappingContext, "Locator", "locator-set-context");
- LocatorSet locatorSet = new LocatorSetBuilder()
- .setName("Locator")
- .setInterface(Arrays.asList(new InterfaceBuilder().build()))
- .build();
-
- InstanceIdentifier<LocatorSet> validId =
- InstanceIdentifier.create(LocatorSets.class).child(LocatorSet.class, new LocatorSetKey("Locator"));
-
-
- ArgumentCaptor<LispAddDelLocatorSet> locatorSetCaptor = ArgumentCaptor.forClass(LispAddDelLocatorSet.class);
-
- when(api.lispAddDelLocatorSet(any(LispAddDelLocatorSet.class)))
- .thenReturn(future(new LispAddDelLocatorSetReply()));
- when(writeContext.readAfter(validId)).thenReturn(Optional.of(locatorSet));
-
- final LispLocatorSetDetailsReplyDump reply = new LispLocatorSetDetailsReplyDump();
- LispLocatorSetDetails details = new LispLocatorSetDetails();
- details.lsName = "Locator".getBytes(StandardCharsets.UTF_8);
- reply.lispLocatorSetDetails = ImmutableList.of(details);
-
- customizer.writeCurrentAttributes(validId, locatorSet, writeContext);
-
- verify(api, times(1)).lispAddDelLocatorSet(locatorSetCaptor.capture());
-
- LispAddDelLocatorSet request = locatorSetCaptor.getValue();
-
- assertNotNull(request);
- assertEquals("Locator", new String(request.locatorSetName));
- assertEquals(1, request.isAdd);
- }
-
- @Test
- public void testUpdateCurrentAttributes() throws WriteFailedException {
- final InstanceIdentifier<LocatorSet> identifier = InstanceIdentifier.create(LocatorSet.class);
- try {
- customizer
- .updateCurrentAttributes(identifier, mock(LocatorSet.class), mock(LocatorSet.class), writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof UnsupportedOperationException);
- assertEquals(identifier, e.getFailedId());
- return;
- }
- fail("Test should have failed");
- }
-
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesNullData() throws WriteFailedException {
- customizer.deleteCurrentAttributes(null, null, writeContext);
- }
-
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesBadData() throws WriteFailedException {
- customizer.deleteCurrentAttributes(null, mock(LocatorSet.class), writeContext);
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws InterruptedException, ExecutionException, WriteFailedException {
- LocatorSet locatorSet = new LocatorSetBuilder()
- .setName("Locator")
- .build();
-
- ArgumentCaptor<LispAddDelLocatorSet> locatorSetCaptor = ArgumentCaptor.forClass(LispAddDelLocatorSet.class);
-
- when(api.lispAddDelLocatorSet(any(LispAddDelLocatorSet.class)))
- .thenReturn(future(new LispAddDelLocatorSetReply()));
-
- customizer.deleteCurrentAttributes(null, locatorSet, writeContext);
-
- verify(api, times(1)).lispAddDelLocatorSet(locatorSetCaptor.capture());
-
- LispAddDelLocatorSet request = locatorSetCaptor.getValue();
-
- assertNotNull(request);
- assertEquals("Locator", new String(request.locatorSetName));
- assertEquals(0, request.isAdd);
- }
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/MapResolverCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/MapResolverCustomizerTest.java
deleted file mode 100755
index ba5bf01b6..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/MapResolverCustomizerTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.translate.write;
-
-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 io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import java.util.concurrent.ExecutionException;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolver;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolverBuilder;
-import io.fd.vpp.jvpp.core.dto.LispAddDelMapResolver;
-import io.fd.vpp.jvpp.core.dto.LispAddDelMapResolverReply;
-
-
-public class MapResolverCustomizerTest extends WriterCustomizerTest implements Ipv4Translator {
-
- private MapResolverCustomizer customizer;
-
- @Override
- public void setUp() {
- customizer = new MapResolverCustomizer(api);
- }
-
- private void whenLispAddDelMapResolverThenSuccess() {
- when(api.lispAddDelMapResolver(any(LispAddDelMapResolver.class)))
- .thenReturn(future(new LispAddDelMapResolverReply()));
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, null, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesBadData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, new MapResolverBuilder().build(), null);
- }
-
- @Test
- public void testWriteCurrentAttributes() throws WriteFailedException {
- Ipv4Address address = new Ipv4Address("192.168.2.1");
- MapResolver resolver = new MapResolverBuilder().setIpAddress(new IpAddress(address)).build();
-
- whenLispAddDelMapResolverThenSuccess();
-
- customizer.writeCurrentAttributes(null, resolver, null);
-
- ArgumentCaptor<LispAddDelMapResolver> resolverCaptor = ArgumentCaptor.forClass(LispAddDelMapResolver.class);
- verify(api, times(1)).lispAddDelMapResolver(resolverCaptor.capture());
-
- LispAddDelMapResolver request = resolverCaptor.getValue();
- assertEquals(1, request.isAdd);
- assertEquals("1.2.168.192", arrayToIpv4AddressNoZone(request.ipAddress).getValue());
- }
-
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdateCurrentAttributes() throws WriteFailedException {
- customizer.updateCurrentAttributes(null, null, null, null);
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws InterruptedException, ExecutionException, WriteFailedException {
- Ipv4Address address = new Ipv4Address("192.168.2.1");
- MapResolver resolver = new MapResolverBuilder().setIpAddress(new IpAddress(address)).build();
-
- whenLispAddDelMapResolverThenSuccess();
-
- customizer.deleteCurrentAttributes(null, resolver, null);
-
- ArgumentCaptor<LispAddDelMapResolver> resolverCaptor = ArgumentCaptor.forClass(LispAddDelMapResolver.class);
- verify(api, times(1)).lispAddDelMapResolver(resolverCaptor.capture());
-
- LispAddDelMapResolver request = resolverCaptor.getValue();
- assertEquals(0, request.isAdd);
- assertEquals("1.2.168.192", arrayToIpv4AddressNoZone(request.ipAddress).getValue());
- }
-
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizerTest.java
deleted file mode 100755
index fa2061c49..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizerTest.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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.translate.write;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import java.util.concurrent.ExecutionException;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfg;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfgBuilder;
-import io.fd.vpp.jvpp.core.dto.LispPitrSetLocatorSet;
-import io.fd.vpp.jvpp.core.dto.LispPitrSetLocatorSetReply;
-
-
-public class PitrCfgCustomizerTest extends WriterCustomizerTest {
-
- private PitrCfgCustomizer customizer;
-
- @Override
- public void setUp() {
- customizer = new PitrCfgCustomizer(api);
- }
-
- private void whenLispPitrSetLocatorSetThenSuccess() {
- when(api.lispPitrSetLocatorSet(any(LispPitrSetLocatorSet.class))).thenReturn(future(new LispPitrSetLocatorSetReply()));
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, null, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesBadData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, mock(PitrCfg.class), null);
- }
-
- @Test
- public void testWriteCurrentAttributes() throws WriteFailedException {
- PitrCfg cfg = new PitrCfgBuilder().setLocatorSet("Locator").build();
-
- whenLispPitrSetLocatorSetThenSuccess();
- customizer.writeCurrentAttributes(null, cfg, null);
-
- ArgumentCaptor<LispPitrSetLocatorSet> cfgCaptor = ArgumentCaptor.forClass(LispPitrSetLocatorSet.class);
- verify(api, times(1)).lispPitrSetLocatorSet(cfgCaptor.capture());
-
- LispPitrSetLocatorSet request = cfgCaptor.getValue();
- assertEquals(1, request.isAdd);
- assertEquals("Locator", new String(request.lsName));
- }
-
- @Test
- public void testUpdateCurrentAttributes() throws WriteFailedException {
- PitrCfg cfg = new PitrCfgBuilder().setLocatorSet("Locator").build();
-
- whenLispPitrSetLocatorSetThenSuccess();
-
- customizer.writeCurrentAttributes(null, cfg, null);
-
- ArgumentCaptor<LispPitrSetLocatorSet> cfgCaptor = ArgumentCaptor.forClass(LispPitrSetLocatorSet.class);
- verify(api, times(1)).lispPitrSetLocatorSet(cfgCaptor.capture());
-
- LispPitrSetLocatorSet request = cfgCaptor.getValue();
- assertEquals(1, request.isAdd);
- assertEquals("Locator", new String(request.lsName));
- }
-
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesNullData() throws WriteFailedException {
- customizer.deleteCurrentAttributes(null, null, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesBadData() throws WriteFailedException {
- customizer.deleteCurrentAttributes(null, mock(PitrCfg.class), null);
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws WriteFailedException, InterruptedException, ExecutionException {
- PitrCfg cfg = new PitrCfgBuilder().setLocatorSet("Locator").build();
-
- whenLispPitrSetLocatorSetThenSuccess();
-
- customizer.deleteCurrentAttributes(null, cfg, null);
-
- ArgumentCaptor<LispPitrSetLocatorSet> cfgCaptor = ArgumentCaptor.forClass(LispPitrSetLocatorSet.class);
- verify(api, times(1)).lispPitrSetLocatorSet(cfgCaptor.capture());
-
- LispPitrSetLocatorSet request = cfgCaptor.getValue();
- assertEquals(0, request.isAdd);
- assertEquals("Locator", new String(request.lsName));
- }
-
-}
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
deleted file mode 100755
index f0fe32a63..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizerTest.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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.translate.write;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-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.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.rev161214.Lisp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MapReplyAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.NegativeMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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.rev161214.eid.table.grouping.EidTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class RemoteMappingCustomizerTest extends WriterCustomizerTest implements Ipv4Translator {
-
- @Captor
- private ArgumentCaptor<LispAddDelRemoteMapping> mappingCaptor;
-
- private MappingId mappingId;
- private RemoteMappingCustomizer customizer;
- private RemoteMapping intf;
- private InstanceIdentifier<RemoteMapping> id;
-
- @Mock
- private EidMappingContext remoteMappingContext;
-
- @Override
- public void setUp() {
- final Eid eid = new EidBuilder()
- .setAddressType(Ipv4Afi.class)
- .setAddress(
- new Ipv4Builder().setIpv4(
- new Ipv4Address("192.168.2.1"))
- .build())
- .build();
-
- mappingId = new MappingId("REMOTE");
- final RemoteMappingKey key = new RemoteMappingKey(mappingId);
-
- intf = new RemoteMappingBuilder()
- .setEid(
- eid)
- .setLocatorList(new NegativeMappingBuilder()
- .setMapReply(new MapReplyBuilder().setMapReplyAction(MapReplyAction.Drop).build()).build())
- .build();
-
- 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();
-
- customizer = new RemoteMappingCustomizer(api, remoteMappingContext);
-
- when(api.lispAddDelRemoteMapping(any())).thenReturn(future(new LispAddDelRemoteMappingReply()));
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, null, writeContext);
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesBadData() throws WriteFailedException {
- customizer
- .writeCurrentAttributes(null, mock(RemoteMapping.class), writeContext);
- }
-
- @Test
- public void testWriteCurrentAttributes() throws WriteFailedException {
- customizer.writeCurrentAttributes(id, intf, writeContext);
-
- verify(api, times(1)).lispAddDelRemoteMapping(mappingCaptor.capture());
-
- LispAddDelRemoteMapping request = mappingCaptor.getValue();
-
- assertNotNull(request);
- assertEquals(1, request.isAdd);
- assertEquals("1.2.168.192", arrayToIpv4AddressNoZone(request.eid).getValue());
- assertEquals(25, request.vni);
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdateCurrentAttributes() throws WriteFailedException {
- customizer.updateCurrentAttributes(null, null, null, writeContext);
- }
-
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesNullData() throws WriteFailedException {
- customizer.deleteCurrentAttributes(null, null, writeContext);
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws WriteFailedException {
- when(remoteMappingContext.containsEid(any(), eq(mappingContext))).thenReturn(true);
- customizer.deleteCurrentAttributes(id, intf, writeContext);
-
- verify(api, times(1)).lispAddDelRemoteMapping(mappingCaptor.capture());
-
- LispAddDelRemoteMapping request = mappingCaptor.getValue();
-
- assertNotNull(request);
- assertEquals(0, request.isAdd);
- assertEquals("1.2.168.192", arrayToIpv4AddressNoZone(request.eid).getValue());
- assertEquals(25, request.vni);
- }
-
-}
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
deleted file mode 100644
index ac56896c4..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizerTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.translate.write;
-
-
-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.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtableBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class VniTableCustomizerTest extends WriterCustomizerTest {
-
- private VniTableCustomizer customizer;
- private InstanceIdentifier<VniTable> validId;
- private VniTable validData;
-
- @Before
- public void init() {
- initMocks(this);
- customizer = new VniTableCustomizer(api);
-
- validId = InstanceIdentifier.create(VniTable.class);
- validData = new VniTableBuilder()
- .setVrfSubtable(new VrfSubtableBuilder()
- .build()).build();
- }
-
- @Test
- public void testWriteSuccessfull() {
- whenReadAfterReturnValid();
- try {
- customizer.writeCurrentAttributes(validId, validData, writeContext);
- } catch (Exception e) {
- fail("Test should pass without exception");
- }
- }
-
- @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 testDeleteSuccessfull() {
- whenReadBeforeReturnValid();
- try {
- customizer.deleteCurrentAttributes(validId, validData, writeContext);
- } catch (Exception e) {
- fail("Test should pass without exception");
- }
- }
-
- @Test(expected = IllegalStateException.class)
- public void testDeleteFailed() throws WriteFailedException {
- whenReadBeforeReturnInvalid();
- customizer.deleteCurrentAttributes(validId, validData, writeContext);
- }
-
- private void whenReadBeforeReturnValid() {
- when(writeContext.readBefore(validId)).thenReturn(Optional.of(validData));
- }
-
- private void whenReadBeforeReturnInvalid() {
- when(writeContext.readBefore(validId)).thenReturn(Optional.absent());
- }
-
- 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
deleted file mode 100644
index 3f814bfc5..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizerTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.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.rev161214.eid.table.grouping.EidTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.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
deleted file mode 100644
index 3f80ae561..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriterTestCase.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.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/AdjacencyMappingContextTestHelper.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/AdjacencyMappingContextTestHelper.java
deleted file mode 100644
index 1d6615472..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/AdjacencyMappingContextTestHelper.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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 com.google.common.base.Preconditions.checkNotNull;
-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.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.AdjacenciesIdentificationContexts;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.AdjacenciesIdentification;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.AdjacenciesIdentificationKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.Mappings;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.MappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.Mapping;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.MappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.MappingKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.mapping.EidIdentificatorPair;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.mapping.EidIdentificatorPairBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-
-/**
- * Utility for mocking adjacency mappings
- */
-public interface AdjacencyMappingContextTestHelper {
-
- /**
- * Creates {@link Mapping} for given data.
- *
- * @param pair to be mapped
- * @param id to be mapped
- * @return eid to id mapping
- */
- default Optional<Mapping> mapping(@Nonnull final EidIdentificatorPair pair, final String id) {
- return Optional.of(new MappingBuilder().setEidIdentificatorPair(pair).setId(id).build());
- }
-
- /**
- * Creates {@link KeyedInstanceIdentifier} for {@link Mapping} in {@link AdjacenciesIdentificationContexts}.
- *
- * @param id identificator of the mapping
- * @param mappingContextName identificator of the mapping context
- * @return identifier for the mapping
- */
- static KeyedInstanceIdentifier<Mapping, MappingKey> mappingIid(@Nonnull final String id,
- @Nonnull final String mappingContextName) {
- return InstanceIdentifier.create(AdjacenciesIdentificationContexts.class).child(AdjacenciesIdentification.class,
- new AdjacenciesIdentificationKey(mappingContextName)).child(Mappings.class)
- .child(Mapping.class, new MappingKey(id));
- }
-
- static EidIdentificatorPair pairOf(@Nonnull final String local, @Nonnull final String remote) {
- return new EidIdentificatorPairBuilder()
- .setLocalEidId(new MappingId(checkNotNull(local, "Local id cannot be null")))
- .setRemoteEidId(new MappingId(checkNotNull(remote, "Remote id cannot be null")))
- .build();
- }
-
- /**
- * Stubs {@link MappingContext#read} to include given mapping in {@link AdjacenciesIdentification}.
- *
- * @param mappingContext mock instance of {@link MappingContext}
- * @param localEidId local id for identification pair
- * @param remoteEidId remote id for identification pair
- * @param mappingName index to be mapped
- * @param namingContextName name of the naming context
- */
- default void defineAdjacencyMapping(@Nonnull final MappingContext mappingContext, @Nonnull final String localEidId,
- @Nonnull final String remoteEidId, @Nonnull final String 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(pairOf(localEidId, remoteEidId), 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);
- }
-
- default void noAdjacencyMappingDefined(@Nonnull final MappingContext mappingContext, @Nonnull final String name,
- @Nonnull final String namingContextName) {
- final InstanceIdentifier<Mappings> iid =
- mappingIid(name, namingContextName).firstIdentifierOf(Mappings.class);
- final List<Mapping> list = Common.getMappingList(mappingContext, iid);
-
- doReturn(Optional.of(new MappingsBuilder().setMapping(list).build())).when(mappingContext).read(iid);
- doReturn(Optional.absent()).when(mappingContext).read(mappingIid(name, namingContextName));
- }
-
- 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/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/EidMappingContextHelper.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/EidMappingContextHelper.java
deleted file mode 100644
index 70d536135..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/EidMappingContextHelper.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.rev161214.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 defineEidMapping(@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);
- }
-
- default void noEidMappingDefined(@Nonnull final MappingContext mappingContext, @Nonnull final String name,
- @Nonnull final String namingContextName) {
- final InstanceIdentifier<Mappings> iid =
- mappingIid(new MappingId(name), namingContextName).firstIdentifierOf(Mappings.class);
- final List<Mapping> list = Common.getMappingList(mappingContext, iid);
-
- doReturn(Optional.of(new MappingsBuilder().setMapping(list).build())).when(mappingContext).read(iid);
- doReturn(Optional.absent()).when(mappingContext).read(mappingIid(new MappingId(name), namingContextName));
- }
-
- 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/lisp2vpp/src/test/resources/adjacencies-identification-context.json b/lisp/lisp2vpp/src/test/resources/adjacencies-identification-context.json
deleted file mode 100644
index 795b548a4..000000000
--- a/lisp/lisp2vpp/src/test/resources/adjacencies-identification-context.json
+++ /dev/null
@@ -1,29 +0,0 @@
-
-{
-
- "mappings": {
- "mapping": [
- {
- "id": "first",
- "eid-identificator-pair": {
- "local-eid-id": "local-eid-1",
- "remote-eid-id": "remote-eid-1"
- }
- },
- {
- "id": "second",
- "eid-identificator-pair": {
- "local-eid-id": "local-eid-2",
- "remote-eid-id": "remote-eid-2"
- }
- },
- {
- "id": "third",
- "eid-identificator-pair": {
- "local-eid-id": "local-eid-3",
- "remote-eid-id": "remote-eid-3"
- }
- }
- ]
- }
-} \ No newline at end of file
diff --git a/lisp/lisp_postman_collection.json b/lisp/lisp_postman_collection.json
deleted file mode 100644
index 98c8c6511..000000000
--- a/lisp/lisp_postman_collection.json
+++ /dev/null
@@ -1,955 +0,0 @@
-{
- "id": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
- "name": "Lisp Postman Collection L2",
- "description": "",
- "order": [
- "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",
- "a98dcdc1-a383-4355-6174-d2618a790ebd",
- "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",
- "7d27fd46-87c3-4012-61f2-8b48a6d424aa",
- "383d2f9b-54f7-c924-dff9-b2bd96b08573",
- "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": 1475131541292,
- "owner": "658985",
- "public": false,
- "requests": [
- {
- "id": "0025c271-1d7c-4fe7-6f98-803c6db92d19",
- "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": 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": "{ \n \"locator-set\":{ \n \"name\":\"loc_1\"\n }\n}"
- },
- {
- "id": "07e6f197-3b13-095e-9525-176167e3b5a4",
- "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",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1475134410953,
- "name": "Get Vrf Subtable 10 Config",
- "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": "0f796bd9-87c8-0004-a3e7-25555d648b7e",
- "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_1/adjacencies/adjacency/adj_1",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1478093498704,
- "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 \"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": "107a0853-c530-eb1a-0a3c-bcc382f1bc60",
- "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/local-mappings/local-mapping/loc_map_1",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "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 \"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": "121017cd-63f8-231d-5676-f8e2d4f2961f",
- "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",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1475134503510,
- "name": "Get Bridge Domain 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": "1b0fd1f1-17f3-8de6-acf7-d9cd7f2c0b70",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "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": "GET",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "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": "{\r\n \"locator-set\":{\r\n \"name\":\"loc_1\"\r\n }\r\n}"
- },
- {
- "id": "1b24f085-9c39-896b-2644-575ae3c2747a",
- "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_3",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "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": "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": "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,
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "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": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
- "responses": [],
- "rawModeData": "{\r\n \"lisp\":{\r\n \"enable\":\"true\"\r\n } \r\n}"
- },
- {
- "id": "2eb7f81a-9ebb-12f2-64ff-304fc204169a",
- "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/remote-mappings/remote-mapping/remote_map_2",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "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 \"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": "383d2f9b-54f7-c924-dff9-b2bd96b08573",
- "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/adjacencies/adjacency/adj_1",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1478093569104,
- "name": "Get adjacency - Operational",
- "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 \"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": "39cdad3e-55e7-c091-835a-7b8956ad528b",
- "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": "PUT",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "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 \"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": "41798cf0-8fa1-ab54-815c-4ae37024aaf0",
- "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": "GET",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1475591910686,
- "name": "Get Bridge Domain Subtable 10 Config",
- "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": "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": "4f3d5d14-e397-5dca-bcf3-c64585fab175",
- "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",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1475136655292,
- "name": "Get VNI Table 12 Operational",
- "description": "",
- "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
- "responses": [],
- "rawModeData": "{\r\n \"vni-table\":{\r\n \"virtual-network-identifier\":\"12\"\r\n }\r\n}"
- },
- {
- "id": "577ba8a1-67b5-571f-903a-f44908c0d656",
- "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": "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",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1475225553971,
- "name": "Get Pitr-cfg ",
- "description": "Reads Pitr feature status\n\nequivalent of\n\n show_lisp_pitr",
- "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
- "responses": [],
- "rawModeData": "{\n \"pitr-cfg\": {\n \"locator-set\": \"N/A\"\n } \n}"
- },
- {
- "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/config/lisp:lisp/lisp-feature-data/locator-sets/locator-set/loc_1",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "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": "{ \n \"locator-set\":{ \n \"name\":\"loc_1\",\n \"interface\":{ \n \"interface-ref\":\"local0\",\n \"priority\":\"2\",\n \"weight\":\"3\"\n }\n }\n}"
- },
- {
- "id": "63ada212-fd75-3897-8df4-94530d9ec162",
- "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/remote-mappings/remote-mapping/remote_map_4",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "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": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
- "responses": [],
- "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": "706257fe-47ce-c0ca-ccd5-0e5cfdb1becb",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1475133788195,
- "name": "Get Lisp Config",
- "description": "",
- "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
- "responses": [],
- "rawModeData": "{\r\n \"lisp\":{\r\n \"enable\":\"true\"\r\n } \r\n}"
- },
- {
- "id": "70ab7906-c783-ae9f-487e-28505dace49c",
- "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",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1475137137792,
- "name": "Add Vrf Subtable 10",
- "description": "",
- "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
- "responses": [],
- "rawModeData": "{\r\n \"vrf-subtable\":{\r\n \t\"table-id\":10\r\n }\r\n}"
- },
- {
- "id": "799ee5a8-5ca6-b09a-da84-ebe7ee7dc34b",
- "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/remote-mappings/remote-mapping/remote_map_2",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1475219098376,
- "name": "Get remote negative mapping Config - 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": "7d27fd46-87c3-4012-61f2-8b48a6d424aa",
- "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_1/adjacencies/adjacency/adj_1",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1478093588436,
- "name": "Get adjacency - Config",
- "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 \"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": "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": "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": 1475591891745,
- "name": "Add Bridge Domain Subtable 10",
- "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": "a98dcdc1-a383-4355-6174-d2618a790ebd",
- "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
- "url": "http://localhost:8183/restconf/config/v3po:vpp/bridge-domains/bridge-domain/testBD",
- "pathVariables": {},
- "preRequestScript": "",
- "method": "PUT",
- "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
- "data": [],
- "dataMode": "raw",
- "name": "Create bridge testBD",
- "description": "Creates bridgfe domain. Corresponds to invoking:\n\nvat# bridge_domain_add_del bd_id [bd_id] learn 0 forward 0 uu-flood 0 flood 1 arp-term 0\n\nTo verify run:\n\nvppctl show bridge-domain [bd_id] detail",
- "descriptionFormat": "html",
- "time": 1465805138795,
- "version": 2,
- "responses": [],
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "rawModeData": "{\r\n \"bridge-domain\": [\r\n {\r\n \"name\": \"testBD\",\r\n \"flood\": \"true\",\r\n \"forward\": \"false\",\r\n \"learn\": \"false\",\r\n \"unknown-unicast-flood\": \"false\",\r\n \"arp-termination\": \"false\"\r\n }\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,
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1474450438453,
- "name": "Get Lisp Operational",
- "description": "Reads status of lisp feature\n\nequivalent of \n\n show_lisp_status",
- "collectionId": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
- "responses": [],
- "rawModeData": "{\r\n \"lisp\":{\r\n \"enable\":\"true\"\r\n } \r\n}"
- },
- {
- "id": "b546cbd7-b598-b419-4dab-b747ea444f23",
- "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_1",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "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 \"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": "b5e65290-0729-7089-ca3a-7de7454f58fa",
- "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": 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 \"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": "b5e76988-aee4-19d1-3781-8ab7784af1ab",
- "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": "PUT",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "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 \"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": "bc81a430-c93c-d9ca-8427-1c4f4a73fcf9",
- "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/remote-mappings/remote-mapping/remote_map_4",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "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_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": "bf3ad99c-0fa6-a566-742a-92a9a8404b8c",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/pitr-cfg",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "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": "f81144ce-6874-1a85-4f77-dcead6a67cd3",
- "responses": [],
- "rawModeData": "{\n \"pitr-cfg\": {\n \"locator-set\": \"loc_1\"\n } \n}"
- },
- {
- "id": "ca05036e-787a-5e8b-bbfd-9b6fce61a893",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/map-resolvers/map-resolver/192.168.2.1",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "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 \"map-resolver\":{\r\n \"ip-address\":\"192.168.2.1\"\r\n }\r\n}"
- },
- {
- "id": "d3dde4b1-56df-b489-53d9-a3edee6c4bd3",
- "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": "PUT",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "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 \"vni-table\":{\r\n \"virtual-network-identifier\":\"12\"\r\n }\r\n}"
- },
- {
- "id": "d75a1d9c-51cb-7e8a-a1cb-8ae77b42fdec",
- "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_1",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "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/lisp/pom.xml b/lisp/pom.xml
deleted file mode 100755
index 7b2c3e595..000000000
--- a/lisp/pom.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>honeycomb-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../common/honeycomb-parent</relativePath>
- </parent>
-
- <groupId>io.fd.honeycomb.lisp</groupId>
- <artifactId>lisp-aggregator</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <name>${project.artifactId}</name>
- <packaging>pom</packaging>
- <modelVersion>4.0.0</modelVersion>
- <description>Aggregator for Honeycomb LISP plugin</description>
-
- <modules>
- <module>api</module>
- <module>lisp2vpp</module>
- </modules>
-
- <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/nat/asciidoc/Readme.adoc b/nat/asciidoc/Readme.adoc
deleted file mode 100644
index eced90f11..000000000
--- a/nat/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,12 +0,0 @@
-= SNAT
-
-Support fot VPP's SNAT plugin:
-https://docs.fd.io/vpp/16.12/plugins_snat-plugin_snat.html
-
-== Supported features
-
-=== 1:1 NAT
-- Create/Read/Delete static 1:1 IPv4 (no port) mappings
-
-=== Interface NAT feature
-- Enable/Disable NAT feature for interface \ No newline at end of file
diff --git a/nat/nat-api/asciidoc/Readme.adoc b/nat/nat-api/asciidoc/Readme.adoc
deleted file mode 100644
index 300d83885..000000000
--- a/nat/nat-api/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,11 +0,0 @@
-= nat-api
-
-The APIs are based on ietf-nat YANG model draft:
-https://tools.ietf.org/html/draft-sivakumar-yang-nat-05
-
-== Notes on model
-* Nat-instances map to VRF in VPP (nat-instance/id mapps to VRF-ID)
-
-== Deviations
-* nat-state/nat-instances/nat-instance/id type changed to uint32 from int32
-* "mandatory true" statements commented to support partial model implementation
diff --git a/nat/nat-api/pom.xml b/nat/nat-api/pom.xml
deleted file mode 100644
index 13d8f0ccf..000000000
--- a/nat/nat-api/pom.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
---><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>api-parent</artifactId>
- <relativePath>../../common/api-parent</relativePath>
- <version>1.16.12-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.nat</groupId>
- <artifactId>nat-api</artifactId>
- <name>${project.artifactId}</name>
- <version>1.16.12-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <properties>
- <naming.context.version>1.16.12-SNAPSHOT</naming.context.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>iana-if-type-2014-05-08</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-yang-types-20130715</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-interfaces</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-inet-types-2013-07-15</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>yang-ext</artifactId>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>naming-context-api</artifactId>
- <version>${naming.context.version}</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/nat/nat-api/src/main/yang/ietf-nat.yang b/nat/nat-api/src/main/yang/ietf-nat.yang
deleted file mode 100644
index 54707708c..000000000
--- a/nat/nat-api/src/main/yang/ietf-nat.yang
+++ /dev/null
@@ -1,1074 +0,0 @@
-module ietf-nat {
-
- namespace "urn:ietf:params:xml:ns:yang:ietf-nat";
- //namespace to be assigned by IANA
- prefix "nat";
- import ietf-inet-types {
- prefix "inet";
- }
-
- organization "IETF NetMod Working Group";
- contact
- "Senthil Sivakumar <ssenthil@cisco.com>
- Mohamed Boucadair <mohamed.boucadair@orange.com>
- Suresh Vinapamula <sureshk@juniper.net>";
-
- description
- "This module is a YANG module for NAT implementations
- (including both NAT44 and NAT64 flavors.
-
- Copyright (c) 2015 IETF Trust and the persons identified as
- authors of the code. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, is permitted pursuant to, and subject
- to the license terms contained in, the Simplified BSD License
- set forth in Section 4.c of the IETF Trust's Legal Provisions
- Relating to IETF Documents
- (http://trustee.ietf.org/license-info).
-
- This version of this YANG module is part of RFC XXXX; see
- the RFC itself for full legal notices.";
-
- revision 2015-09-08 {
- description "Fixes few YANG errors.";
- reference "-02";
- }
-
- revision 2015-09-07 {
- description "Completes the NAT64 model.";
- reference "01";
- }
-
- revision 2015-08-29 {
- description "Initial version.";
- reference "00";
- }
-
- typedef percent {
- type uint8 {
- range "0 .. 100";
- }
- description
- "Percentage";
- }
-
- /*
- * Grouping
- */
-
- grouping timeouts {
- description
- "Configure values of various timeouts.";
-
- leaf udp-timeouts {
- type uint32;
- default 300;
- description
- "UDP inactivity timeout.";
- }
-
- leaf tcp-idle-timeout {
- type uint32;
- default 7440;
- description
- "TCP Idle timeout, as per RFC 5382 should be no
- 2 hours and 4 minutes.";
- }
-
- leaf tcp-trans-open-timeout {
- type uint32;
- default 240;
- description
- "The value of the transitory open connection
- idle-timeout.";
- }
-
- leaf tcp-trans-close-timeout {
- type uint32;
- default 240;
- description
- "The value of the transitory close connection
- idle-timeout.";
- }
-
- leaf tcp-in-syn-timeout {
- type uint32;
- default 6;
- description
- "6 seconds, as defined in [RFC5382].";
- }
-
- leaf fragment-min-timeout {
- type uint32;
- default 2;
- description
- "As long as the NAT has available resources,
- the NAT allows the fragments to arrive
- over fragment-min-timeout interval.
- The default value is inspired from RFC6146.";
- }
-
- leaf icmp-timeout {
- type uint32;
- default 60;
- description
- "60 seconds, as defined in [RFC5508].";
- }
- }
-
- // port numbers: single or port range
-
- grouping port-number {
- description
- "Individual port or a range of ports.";
-
- choice port-type {
- default single-port-number;
- description
- "Port type: single or port-range.";
-
- case single-port-number {
- leaf single-port-number {
- type inet:port-number;
- description
- "Used for single port numbers.";
- }
- }
-
- case port-range {
- leaf start-port-number {
- type inet:port-number;
- description
- "Begining of the port range.";
- }
-
- leaf end-port-number {
- type inet:port-number;
- description
- "End of the port range.";
- }
- }
- }
- }
-
- grouping mapping-entry {
- description
- "NAT mapping entry.";
-
- leaf index {
- type uint32;
- description
- "A unique identifier of a mapping entry.";
- }
-
- leaf type {
- type enumeration {
- enum "static" {
- description
- "The mapping entry is manually configured.";
- }
-
- enum "dynamic" {
- description
- "This mapping is created by an outgoing
- packet.";
- }
- }
- description
- "Indicates the type of a mapping entry. E.g.,
- a mapping can be: static or dynamic";
- }
-
- leaf internal-src-address {
- type inet:ip-address;
- mandatory true;
- description
- "Corresponds to the source IPv4/IPv6 address
- of the IPv4 packet";
- }
-
- container internal-src-port {
- description
- "Corresponds to the source port of the
- IPv4 packet.";
- uses port-number;
- }
-
- leaf external-src-address {
- type inet:ipv4-address;
- mandatory true;
- description
- "External IPv4 address assigned by NAT";
- }
-
- container external-src-port {
- description
- "External source port number assigned by NAT.";
- uses port-number;
- }
-
- leaf transport-protocol {
- type uint8;
- // mandatory true;
- description
- "Upper-layer protocol associated with this mapping.
- Values are taken from the IANA protocol registry.
- For example, this field contains 6 (TCP) for a TCP
- mapping or 17 (UDP) for a UDP mapping.";
- }
-
- leaf internal-dst-address {
- type inet:ipv4-prefix;
- description
- "Corresponds to the destination IPv4 address
- of the IPv4 packet, for example, some NAT
- implementation support translating both source
- and destination address and ports referred to as
- Twice NAT";
- }
-
- container internal-dst-port {
- description
- "Corresponds to the destination port of the
- IPv4 packet.";
- uses port-number;
- }
-
- leaf external-dst-address {
- type inet:ipv4-address;
- description
- "External destination IPv4 address";
- }
-
- container external-dst-port {
- description
- "External source port number.";
- uses port-number;
- }
-
- leaf lifetime {
- type uint32;
- // mandatory true;
- description
- "Lifetime of the mapping.";
- }
- }
-
- grouping nat-parameters {
- description
- "NAT parameters for a given instance";
-
- list external-ip-address-pool {
- key pool-id;
-
-
- description
- "Pool of external IP addresses used to service
- internal hosts.
- Both contiguous and non-contiguous pools
- can be configured for NAT.";
-
- leaf pool-id {
- type uint32;
- description
- "An identifier of the address pool.";
- }
-
- leaf external-ip-pool {
- type inet:ipv4-prefix;
- description
- "An IPv4 prefix used for NAT purposes.";
- }
- }
-
-
- leaf subscriber-mask-v6 {
- type uint8 {
- range "0 .. 128";
- }
- description
- "The subscriber-mask is an integer that indicates
- the length of significant bits to be applied on
- the source IP address (internal side) to
- unambiguously identify a CPE.
-
- Subscriber-mask is a system-wide configuration
- parameter that is used to enforce generic
- per-subscriberpolicies (e.g., port-quota).
-
- The enforcement of these generic policies does not
- require the configuration of every subscriber's
- prefix.
-
- Example: suppose the 2001:db8:100:100::/56 prefix
- is assigned to a NAT64 serviced CPE. Suppose also
- that 2001:db8:100:100::1 is the IPv6 address used
- by the client that resides in that CPE. When the
- NAT64 receives a packet from this client,
- it applies the subscriber-mask (e.g., 56) on
- the source IPv6 address to compute the associated
- prefix for this client (2001:db8:100:100::/56).
- Then, the NAT64 enforces policies based on that
- prefix (2001:db8:100:100::/56), not on the exact
- source IPv6 address.";
- }
-
-
- list subscriber-mask-v4 {
-
- key sub-mask-id;
-
- description
- "IPv4 subscriber mask.";
-
- leaf sub-mask-id {
- type uint32;
- description
- "An identifier of the subscriber masks.";
- }
- leaf sub-mask {
- type inet:ipv4-prefix;
- // mandatory true;
- description
- "The IP address subnets that matches
- should be translated. E.g., If the
- private realms that are to be translated
- by NAT would be 192.0.2.0/24";
- }
- }
-
- leaf paired-address-pooling {
- type boolean;
- default true;
- description
- "Paired address pooling is indicating to NAT
- that all the flows from an internal IP
- address must be assigned the same external
- address. This is defined in RFC 4007.";
- }
-
- leaf nat-mapping-type {
- type enumeration {
- enum "eim" {
- description
- "endpoint-independent-mapping.
- Refer section 4 of RFC 4787.";
- }
-
- enum "adm" {
- description
- "address-dependent-mapping.
- Refer section 4 of RFC 4787.";
- }
-
- enum "edm" {
- description
- "address-and-port-dependent-mapping.
- Refer section 4 of RFC 4787.";
- }
- }
- description
- "Indicates the type of a NAT mapping.";
- }
- leaf nat-filtering-type {
- type enumeration {
- enum "eif" {
- description
- "endpoint-independent- filtering.
- Refer section 5 of RFC 4787.";
- }
-
- enum "adf" {
- description
- "address-dependent- filtering.
- Refer section 5 of RFC 4787.";
- }
-
- enum "edf" {
- description
- "address-and-port-dependent- filtering.
- Refer section 5 of RFC 4787.";
- }
- }
- description
- "Indicates the type of a NAT filtering.";
- }
-
- leaf port-quota {
- type uint16;
- description
- "Configures a port quota to be assigned per
- subscriber.";
- }
-
- container port-set {
- description
- "Manages port-set assignments.";
-
- leaf port-set-enable {
- type boolean;
- description
- "Enable/Disable port set assignment.";
- }
-
- leaf port-set-size {
- type uint16;
- description
- "Indicates the size of assigned port
- sets.";
- }
-
- leaf port-set-timeout {
- type uint32;
- description
- "Inactivty timeout for port sets.";
- }
- }
-
- leaf port-randomization-enable {
- type boolean;
- description
- "Enable/disable port randomization
- feature.";
- }
-
- leaf port-preservation-enable {
- type boolean;
- description
- "Indicates whether the PCP server should
- preserve the internal port number.";
- }
-
- leaf port-range-preservation-enable {
- type boolean;
- description
- "Indicates whether the NAT device should
- preserve the internal port range.";
- }
-
- leaf port-parity-preservation-enable {
- type boolean;
- description
- "Indicates whether the PCP server should
- preserve the port parity of the
- internal port number.";
- }
- leaf address-roundrobin-enable {
- type boolean;
- description
- "Enable/disable address allocation
- round robin.";
- }
-
- uses timeouts;
- container logging-info {
- description
- "Information about Logging NAT events";
-
- leaf destination-address {
- type inet:ipv4-prefix;
- // mandatory true;
- description
- "Address of the collector that receives
- the logs";
- }
- leaf destination-port {
- type inet:port-number;
- // mandatory true;
- description
- "Destination port of the collector.";
- }
-
- }
- container connection-limit {
- description
- "Information on the config parameters that
- rate limit the translations based on various
- criteria";
-
- leaf limit-per-subscriber {
- type uint32;
- description
- "Maximum number of NAT mappings per
- subscriber.";
- }
- leaf limit-per-vrf {
- type uint32;
- description
- "Maximum number of NAT mappings per
- VLAN/VRF.";
- }
- leaf limit-per-subnet {
- type inet:ipv4-prefix;
- description
- "Maximum number of NAT mappings per
- subnet.";
- }
- leaf limit-per-instance {
- type uint32;
- // mandatory true;
- description
- "Maximum number of NAT mappings per
- instance.";
- }
- }
- container mapping-limit {
- description
- "Information on the config parameters that
- rate limit the mappings based on various
- criteria";
-
- leaf limit-per-subscriber {
- type uint32;
- description
- "Maximum number of NAT mappings per
- subscriber.";
- }
- leaf limit-per-vrf {
- type uint32;
- description
- "Maximum number of NAT mappings per
- VLAN/VRF.";
- }
- leaf limit-per-subnet {
- type inet:ipv4-prefix;
- description
- "Maximum number of NAT mappings per
- subnet.";
- }
- leaf limit-per-instance {
- type uint32;
- // mandatory true;
- description
- "Maximum number of NAT mappings per
- instance.";
- }
- }
- leaf ftp-alg-enable {
- type boolean;
- description
- "Enable/Disable FTP ALG";
- }
-
- leaf dns-alg-enable {
- type boolean;
- description
- "Enable/Disable DNSALG";
- }
-
- leaf tftp-alg-enable {
- type boolean;
- description
- "Enable/Disable TFTP ALG";
- }
-
- leaf msrpc-alg-enable {
- type boolean;
- description
- "Enable/Disable MS-RPC ALG";
- }
-
- leaf netbios-alg-enable {
- type boolean;
- description
- "Enable/Disable NetBIOS ALG";
- }
-
- leaf rcmd-alg-enable {
- type boolean;
- description
- "Enable/Disable rcmd ALG";
- }
-
- leaf ldap-alg-enable {
- type boolean;
- description
- "Enable/Disable LDAP ALG";
- }
-
- leaf sip-alg-enable {
- type boolean;
- description
- "Enable/Disable SIP ALG";
- }
-
- leaf rtsp-alg-enable {
- type boolean;
- description
- "Enable/Disable RTSP ALG";
- }
-
- leaf h323-alg-enable {
- type boolean;
- description
- "Enable/Disable H323 ALG";
- }
-
- leaf all-algs-enable {
- type boolean;
- description
- "Enable/Disable all the ALGs";
- }
-
- container notify-pool-usage {
- description
- "Notification of Pool usage when certain criteria
- is met";
-
- leaf pool-id {
- type uint32;
- description
- "Pool-ID for which the notification
- criteria is defined";
- }
-
- leaf notify-pool-hi-threshold {
- type percent;
- // mandatory true;
- description
- "Notification must be generated when the
- defined high threshold is reached.
- For example, if a notification is
- required when the pool utilization reaches
- 90%, this configuration parameter must
- be set to 90%";
- }
-
- leaf notify-pool-low-threshold {
- type percent;
- description
- "Notification must be generated when the defined
- low threshold is reached.
- For example, if a notification is required when
- the pool utilization reaches below 10%,
- this configuration parameter must be set to
- 10%";
- }
- }
- list nat64-prefixes {
- key nat64-prefix-id;
-
- description
- "Provides one or a list of NAT64 prefixes
- With or without a list of destination IPv4 prefixes.
-
- Destination-based Pref64::/n is discussed in
- Section 5.1 of [RFC7050]). For example:
- 192.0.2.0/24 is mapped to 2001:db8:122:300::/56.
- 198.51.100.0/24 is mapped to 2001:db8:122::/48.";
-
- leaf nat64-prefix-id {
- type uint32;
- description
- "An identifier of the NAT64 prefix.";
- }
-
- leaf nat64-prefix {
- type inet:ipv6-prefix;
- default "64:ff9b::/96";
- description
- "A NAT64 prefix. Can be NSP or WKP [RFC6052].";
- }
-
- list destination-ipv4-prefix {
-
- key ipv4-prefix-id;
-
- description
- "An IPv4 prefix/address.";
-
- leaf ipv4-prefix-id {
- type uint32;
- description
- "An identifier of the IPv4 prefix/address.";
- }
-
- leaf ipv4-prefix {
- type inet:ipv4-prefix;
- description
- "An IPv4 address/prefix. ";
- }
- }
- }
- } //nat-parameters group
-
- container nat-config {
- description
- "NAT";
-
- container nat-instances {
- description
- "nat instances";
-
- list nat-instance {
-
- key "id";
-
- description
- "A NAT instance.";
-
- leaf id {
- type uint32;
- description
- "NAT instance identifier.";
- }
-
- leaf enable {
- type boolean;
- description
- "Status of the the NAT instance.";
- }
-
- uses nat-parameters;
-
- container mapping-table {
- description
- "NAT dynamic mapping table used to track
- sessions";
-
- list mapping-entry {
- key "index";
- description
- "NAT mapping entry.";
- uses mapping-entry;
- }
- }
- }
- }
- }
-
- /*
- * NAT State
- */
-
- container nat-state {
-
- config false;
-
- description
- "nat-state";
-
- container nat-instances {
- description
- "nat instances";
-
- list nat-instance {
- key "id";
-
- description
- "nat instance";
-
- leaf id {
- // FIXME changed int32 to uint32 to align with nat-config (authors of draft notified)
- type uint32;
- description
- "The identifier of the nat instance.";
- }
-
- container nat-capabilities {
- description
- "NAT Capabilities";
-
- leaf nat44-support {
- type boolean;
- description
- "Indicates NAT44 support";
- }
-
- leaf nat64-support {
- type boolean;
- description
- "Indicates NAT64 support";
- }
-
- leaf static-mapping-support {
- type boolean;
- description
- "Indicates whether static mappings are
- supported.";
- }
-
- leaf port-set-support {
- type boolean;
- description
- "Indicates port set assignment
- support ";
- }
-
- leaf port-randomization-support {
- type boolean;
- description
- "Indicates whether port randomization is
- supported.";
- }
-
- leaf port-range-preservation-support {
- type boolean;
- description
- "Indicates whether port range
- preservation is supported.";
- }
-
- leaf port-preservation-suport {
- type boolean;
- description
- "Indicates whether port preservation
- is supported.";
- }
-
- leaf port-parity-preservation-support {
- type boolean;
- description
- "Indicates whether port parity
- preservation is supported.";
- }
-
- leaf address-roundrobin-support {
- type boolean;
- description
- "Indicates whether address allocation
- round robin is supported.";
- }
-
- leaf ftp-alg-support {
- type boolean;
- description
- "Indicates whether FTP ALG is supported";
- }
-
- leaf dns-alg-support {
- type boolean;
- description
- "Indicates whether DNSALG is supported";
- }
-
- leaf tftp-support {
- type boolean;
- description
- "Indicates whether TFTP ALG is supported";
- }
-
- leaf msrpc-alg-support {
- type boolean;
- description
- "Indicates whether MS-RPC ALG is supported";
- }
-
- leaf netbios-alg-support {
- type boolean;
- description
- "Indicates whether NetBIOS ALG is supported";
- }
-
- leaf rcmd-alg-support {
- type boolean;
- description
- "Indicates whether rcmd ALG is supported";
- }
-
- leaf ldap-alg-support {
- type boolean;
- description
- "Indicates whether LDAP ALG is supported";
- }
-
- leaf sip-alg-support {
- type boolean;
- description
- "Indicates whether SIP ALG is supported";
- }
-
- leaf rtsp-alg-support {
- type boolean;
- description
- "Indicates whether RTSP ALG is supported";
- }
-
- leaf h323-alg-support {
- type boolean;
- description
- "Indicates whether H323 ALG is supported";
- }
-
- leaf paired-address-pooling-support {
- type boolean;
- description
- "Indicates whether paired-address-pooling is
- supported";
- }
-
- leaf endpoint-independent-mapping-support {
- type boolean;
- description
- "Indicates whether endpoint-independent-mapping
- in Section 4 of RFC 4787 is supported.";
- }
-
- leaf address-dependent-mapping-support {
- type boolean;
- description
- "Indicates whether endpoint-independent-mapping
- in Section 4 of RFC 4787 is supported.";
- }
-
- leaf address-and-port-dependent-mapping-support {
- type boolean;
- description
- "Indicates whether endpoint-independent-mapping in
- section 4 of RFC 4787 is supported.";
- }
-
- leaf endpoint-independent-filtering-support {
- type boolean;
- description
- "Indicates whether endpoint-independent-mapping in
- section 5 of RFC 4787 is supported.";
- }
-
- leaf address-dependent-filtering {
- type boolean;
- description
- "Indicates whether endpoint-independent-mapping in
- section 5 of RFC 4787 is supported.";
- }
-
- leaf address-and-port-dependent-filtering {
- type boolean;
- description
- "Indicates whether endpoint-independent-mapping in
- section 5 of RFC 4787 is supported.";
- }
-
- leaf stealth-mode-support {
- type boolean;
- description
- "Indicates whether to respond for unsolicited
- traffic.";
- }
-
- }
-
- container nat-current-config {
- description
- "current config";
-
- uses nat-parameters;
- }
-
- container mapping-table {
- description
- "Mapping table";
- list mapping-entry {
- key "index";
- description
- "mapping entry";
- uses mapping-entry;
- }
- }
-
- container statistics {
- description
- "Statistics related to the NAT instance";
-
- leaf total-mappings {
- type uint32;
- description
- "Total number of NAT Mappings present
- at the time. This includes all the
- static and dynamic mappings";
- }
- leaf total-tcp-mappings {
- type uint32;
- description
- "Total number of TCP Mappings present
- at the time.";
- }
- leaf total-udp-mappings {
- type uint32;
- description
- "Total number of UDP Mappings present
- at the time.";
- }
- leaf total-icmp-mappings {
- type uint32;
- description
- "Total number of ICMP Mappings present
- at the time.";
- }
- container pool-stats {
- description
- "Statistics related to Pool usage";
- leaf pool-id {
- type uint32;
- description
- "Unique Identifier that represents
- a pool";
- }
- leaf address-allocated {
- type uint32;
- description
- "Number of allocated addresses in
- the pool";
- }
- leaf address-free {
- type uint32;
- description
- "Number of free addresses in
- the pool.The sum of free
- addresses and allocated
- addresses are the total
- addresses in the pool";
- }
- container port-stats {
- description
- "Statistics related to port
- usage.";
-
- leaf ports-allocated {
- type uint32;
- description
- "Number of allocated ports
- in the pool";
- }
-
- leaf ports-free {
- type uint32;
- description
- "Number of free addresses
- in the pool";
- }
- }
- }
- } //statistics
- } //nat-instance
- } //nat-instances
- } //nat-state
- /*
- * Notifications
- */
- notification nat-event {
- description
- "Notifications must be generated when the defined
- high/low threshold is reached. Related configuration
- parameters must be provided to trigger
- the notifications.";
-
- leaf id {
- type leafref {
- path
- "/nat-state/nat-instances/"
- + "nat-instance/id";
- }
- description
- "NAT instance ID.";
- }
-
- leaf notify-pool-threshold {
- type percent;
- // mandatory true;
- description
- "A treshhold has been fired.";
- }
- }
-} //module nat \ No newline at end of file
diff --git a/nat/nat-api/src/main/yang/interface-nat.yang b/nat/nat-api/src/main/yang/interface-nat.yang
deleted file mode 100644
index 43a6bf0c4..000000000
--- a/nat/nat-api/src/main/yang/interface-nat.yang
+++ /dev/null
@@ -1,44 +0,0 @@
-module interface-nat {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:interface:nat";
- prefix "ifc-nat";
-
- revision "2016-12-14" {
- description "Initial revision of v3po model";
- }
-
- import ietf-interfaces {
- prefix "if";
- }
- import ietf-nat {
- prefix "nat";
- }
- import yang-ext {
- prefix "ext";
- }
-
- description "Augmentations to interfaces model to connect interfaces with nat configuration";
-
- grouping interface-nat-attributes {
- container nat {
- container inbound {
- presence "Enables inbound NAT";
- }
- container outbound {
- presence "Enables outbound NAT";
- }
- }
- }
-
- augment /if:interfaces/if:interface {
- ext:augment-identifier "nat-interface-augmentation";
-
- uses interface-nat-attributes;
- }
-
- augment /if:interfaces-state/if:interface {
- ext:augment-identifier "nat-interface-state-augmentation";
-
- uses interface-nat-attributes;
- }
-} \ No newline at end of file
diff --git a/nat/nat-api/src/main/yang/nat-context.yang b/nat/nat-api/src/main/yang/nat-context.yang
deleted file mode 100644
index dd17ed58c..000000000
--- a/nat/nat-api/src/main/yang/nat-context.yang
+++ /dev/null
@@ -1,64 +0,0 @@
-module nat-context {
- yang-version 1;
- namespace "urn:honeycomb:params:xml:ns:yang:nat:context";
- prefix "nc";
-
- description "Context for nat mapping";
-
- revision "2016-12-14" {
- description "Initial revision.";
- }
-
- import ietf-inet-types {
- prefix "inet";
- }
-
- import naming-context {
- prefix "nc";
- }
-
- import yang-ext {
- prefix "ext";
- }
-
- grouping mapping-entry-context-attributes {
- container nat-mapping-entry-context {
- list nat-instance {
- key "id";
-
- leaf id {
- type uint32;
- description "ID of the NAT instance from ietf-nat. Maps to VRF-ID in VPP";
- }
-
- container mapping-table {
- list mapping-entry {
-
- key "internal external";
- unique "index";
-
- leaf internal {
- type inet:ip-address;
- description "Local IP address set in VPP";
- }
-
- leaf external {
- type inet:ip-address;
- description "Extarnal IP address set in VPP";
- }
-
- leaf index {
- type uint32;
- description "ID of the NAT's mapping entry from ietf-nat";
- }
- }
- }
- }
- }
- }
-
- augment /nc:contexts {
- ext:augment-identifier "nat-mapping-entry-ctx-augmentation";
- uses mapping-entry-context-attributes;
- }
-} \ No newline at end of file
diff --git a/nat/nat2vpp/asciidoc/Readme.adoc b/nat/nat2vpp/asciidoc/Readme.adoc
deleted file mode 100644
index 732401198..000000000
--- a/nat/nat2vpp/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= nat2vpp
-
-Uses jvpp-snat to work with VPP's SNAT plugin. \ No newline at end of file
diff --git a/nat/nat2vpp/pom.xml b/nat/nat2vpp/pom.xml
deleted file mode 100644
index ad81e0662..000000000
--- a/nat/nat2vpp/pom.xml
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-impl-parent</artifactId>
- <relativePath>../../vpp-common/vpp-impl-parent</relativePath>
- <version>1.16.12-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.nat</groupId>
- <artifactId>nat2vpp</artifactId>
- <name>${project.artifactId}</name>
- <version>1.16.12-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <properties>
- <honeycomb.infra.version>1.16.12-SNAPSHOT</honeycomb.infra.version>
- <honeycomb.vpp.common.version>1.16.12-SNAPSHOT</honeycomb.vpp.common.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>nat-api</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!--VPP common-->
- <dependency>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-translate-utils</artifactId>
- </dependency>
-
- <!-- JVPP -->
- <dependency>
- <groupId>io.fd.vpp</groupId>
- <artifactId>jvpp-registry</artifactId>
- </dependency>
- <dependency>
- <groupId>io.fd.vpp</groupId>
- <artifactId>jvpp-snat</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
-
- <!-- Honeycomb infrastructure-->
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>minimal-distribution</artifactId>
- <version>${honeycomb.infra.version}</version>
- </dependency>
-
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>translate-api</artifactId>
- <version>${honeycomb.infra.version}</version>
- </dependency>
-
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>translate-spi</artifactId>
- <version>${honeycomb.infra.version}</version>
- </dependency>
-
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>cfg-init</artifactId>
- <version>${honeycomb.infra.version}</version>
- </dependency>
-
- <!-- DI -->
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- </dependency>
- <dependency>
- <groupId>net.jmob</groupId>
- <artifactId>guice.conf</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-multibindings</artifactId>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-translate-test</artifactId>
- <version>${honeycomb.vpp.common.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-testlib</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-all</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/NatModule.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/NatModule.java
deleted file mode 100644
index adaaca9c3..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/NatModule.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.nat;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.inject.AbstractModule;
-import com.google.inject.Provider;
-import com.google.inject.Singleton;
-import com.google.inject.multibindings.Multibinder;
-import io.fd.honeycomb.nat.jvpp.JVppSnatProvider;
-import io.fd.honeycomb.nat.read.NatReaderFactory;
-import io.fd.honeycomb.nat.read.ifc.IfcNatReaderFactory;
-import io.fd.honeycomb.nat.util.MappingEntryContext;
-import io.fd.honeycomb.nat.write.NatWriterFactory;
-import io.fd.honeycomb.nat.write.ifc.IfcNatWriterFactory;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Module class instantiating nat plugin components.
- */
-public final class NatModule extends AbstractModule {
-
- private static final Logger LOG = LoggerFactory.getLogger(NatModule.class);
- private final Class<? extends Provider<FutureJVppSnatFacade>> jvppSnatProviderClass;
-
- public NatModule() {
- this(JVppSnatProvider.class);
- }
-
- @VisibleForTesting
- NatModule(Class<? extends Provider<FutureJVppSnatFacade>> jvppSnatProvider) {
- this.jvppSnatProviderClass = jvppSnatProvider;
- }
-
- @Override
- protected void configure() {
- // Mapping entry context util
- bind(MappingEntryContext.class).toInstance(new MappingEntryContext());
-
- LOG.debug("Installing NAT module");
-
- // Bind to Plugin's JVPP
- bind(FutureJVppSnatFacade.class).toProvider(jvppSnatProviderClass).in(Singleton.class);
-
- final Multibinder<ReaderFactory> readBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class);
- readBinder.addBinding().to(IfcNatReaderFactory.class).in(Singleton.class);
- readBinder.addBinding().to(NatReaderFactory.class).in(Singleton.class);
-
- final Multibinder<WriterFactory> writeBinder = Multibinder.newSetBinder(binder(), WriterFactory.class);
- writeBinder.addBinding().to(IfcNatWriterFactory.class).in(Singleton.class);
- writeBinder.addBinding().to(NatWriterFactory.class).in(Singleton.class);
- LOG.info("Module NAT successfully configured");
- }
-}
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/jvpp/JVppSnatProvider.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/jvpp/JVppSnatProvider.java
deleted file mode 100755
index b83665679..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/jvpp/JVppSnatProvider.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.nat.jvpp;
-
-import com.google.inject.Inject;
-import io.fd.honeycomb.infra.distro.ProviderTrait;
-import io.fd.vpp.jvpp.JVppRegistry;
-import io.fd.vpp.jvpp.snat.JVppSnatImpl;
-import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade;
-import java.io.IOException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Provides future API for jvpp-nsh plugin. Must be a singleton due to shutdown hook usage.
- * Registers shutdown hook to free plugin's resources on shutdown.
- */
-public final class JVppSnatProvider extends ProviderTrait<FutureJVppSnatFacade> {
-
- private static final Logger LOG = LoggerFactory.getLogger(JVppSnatProvider.class);
-
- @Inject
- private JVppRegistry registry;
-
- @Override
- protected FutureJVppSnatFacade create() {
- try {
- final JVppSnatImpl jvppSnat = new JVppSnatImpl();
- // Free jvpp-nsh plugin's resources on shutdown
- Runtime.getRuntime().addShutdownHook(new Thread() {
- @Override
- public void run() {
- LOG.info("Unloading jvpp-snat plugin");
- jvppSnat.close();
- LOG.info("Successfully unloaded jvpp-snat plugin");
- }
- });
-
- LOG.info("Successfully loaded jvpp-snat plugin");
- return new FutureJVppSnatFacade(registry, jvppSnat);
- } catch (IOException e) {
- throw new IllegalStateException("Unable to open VPP management connection", e);
- }
- }
-}
-
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ExternalIpPoolCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ExternalIpPoolCustomizer.java
deleted file mode 100644
index 0650280f1..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ExternalIpPoolCustomizer.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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.nat.read;
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.snat.dto.SnatAddressDetails;
-import io.fd.vpp.jvpp.snat.dto.SnatAddressDetailsReplyDump;
-import io.fd.vpp.jvpp.snat.dto.SnatAddressDump;
-import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.LongStream;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.parameters.ExternalIpAddressPool;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.parameters.ExternalIpAddressPoolBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.parameters.ExternalIpAddressPoolKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.NatInstance;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.NatInstanceKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.nat.instance.NatCurrentConfigBuilder;
-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;
-
-final class ExternalIpPoolCustomizer implements
- InitializingListReaderCustomizer<ExternalIpAddressPool, ExternalIpAddressPoolKey, ExternalIpAddressPoolBuilder>,
- JvppReplyConsumer, Ipv4Translator {
-
- private static final Logger LOG = LoggerFactory.getLogger(ExternalIpPoolCustomizer.class);
-
- private final DumpCacheManager<SnatAddressDetailsReplyDump, Void> dumpMgr;
-
- ExternalIpPoolCustomizer(final DumpCacheManager<SnatAddressDetailsReplyDump, Void> dumpMgr) {
- this.dumpMgr = dumpMgr;
- }
-
- @Nonnull
- @Override
- public ExternalIpAddressPoolBuilder getBuilder(@Nonnull final InstanceIdentifier<ExternalIpAddressPool> id) {
- return new ExternalIpAddressPoolBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<ExternalIpAddressPool> id,
- @Nonnull final ExternalIpAddressPoolBuilder builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- LOG.trace("Reading current attributes for external IP pool: {}", id);
-
- final Long poolId = id.firstKeyOf(ExternalIpAddressPool.class).getPoolId();
- final SnatAddressDetails details =
- dumpMgr.getDump(id, ctx.getModificationCache(), null)
- .or(new SnatAddressDetailsReplyDump()).snatAddressDetails.get(Math.toIntExact(poolId));
-
- builder.setExternalIpPool(
- new Ipv4Prefix(arrayToIpv4AddressNoZoneReversed(details.ipAddress).getValue() + "/32"));
- builder.setPoolId(poolId);
-
- LOG.trace("External IP pool: {}. Read as: {}", id, builder);
- }
-
- @Nonnull
- @Override
- public List<ExternalIpAddressPoolKey> getAllIds(@Nonnull final InstanceIdentifier<ExternalIpAddressPool> id,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- final NatInstanceKey natKey = id.firstKeyOf(NatInstance.class);
- if (!natKey.equals(NatInstanceCustomizer.DEFAULT_VRF_ID)) {
- // IP Pools are not vrf aware ... so they are only visible under default vrf (nat-instance)
- return Collections.emptyList();
- }
-
- LOG.trace("Listing IDs for all external IP pools within nat-instance(vrf):{}", natKey);
-
- // Since VPP returns every single (unordered) address instead of address range,
- // there is no way to determine what the original ranges were when writing the data into VPP.
-
- // That's why the write and read is not symmetrical in terms of data structure, instead,
- // this customizer also returns every single address as a 32 prefix and assigns an artificial key to them
-
- final long addressCount = dumpMgr.getDump(id, ctx.getModificationCache(), null)
- .or(new SnatAddressDetailsReplyDump()).snatAddressDetails.stream()
- .count();
-
- final List<ExternalIpAddressPoolKey> ids = LongStream.range(0, addressCount)
- .mapToObj(ExternalIpAddressPoolKey::new)
- .collect(Collectors.toList());
-
- LOG.trace("List of external IP pool ids: {}", ids);
- return ids;
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder,
- @Nonnull final List<ExternalIpAddressPool> readData) {
- ((NatCurrentConfigBuilder) builder).setExternalIpAddressPool(readData);
- }
-
- @Override
- public Initialized<ExternalIpAddressPool> init(
- @Nonnull final InstanceIdentifier<ExternalIpAddressPool> id,
- @Nonnull final ExternalIpAddressPool readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id), readValue);
- }
-
- static InstanceIdentifier<ExternalIpAddressPool> getCfgId(final @Nonnull InstanceIdentifier<ExternalIpAddressPool> id) {
- return NatInstanceCustomizer.getCfgId(RWUtils.cutId(id, NatInstance.class))
- .child(ExternalIpAddressPool.class, id.firstKeyOf(ExternalIpAddressPool.class));
- }
-
- static final class AddressRangeDumpExecutor implements EntityDumpExecutor<SnatAddressDetailsReplyDump, Void>,
- JvppReplyConsumer {
- private final FutureJVppSnatFacade jvppSnat;
-
- AddressRangeDumpExecutor(final FutureJVppSnatFacade jvppSnat) {
- this.jvppSnat = jvppSnat;
- }
-
- @Nonnull
- @Override
- public SnatAddressDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier, final Void params)
- throws ReadFailedException {
- return getReplyForRead(jvppSnat.snatAddressDump(new SnatAddressDump()).toCompletableFuture(), identifier);
- }
- }
-}
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/MappingEntryCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/MappingEntryCustomizer.java
deleted file mode 100644
index df0a8e886..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/MappingEntryCustomizer.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * 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.nat.read;
-
-import io.fd.honeycomb.nat.util.MappingEntryContext;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.snat.dto.SnatStaticMappingDetails;
-import io.fd.vpp.jvpp.snat.dto.SnatStaticMappingDetailsReplyDump;
-import io.fd.vpp.jvpp.snat.dto.SnatStaticMappingDump;
-import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade;
-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.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.mapping.entry.ExternalSrcPortBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.mapping.entry.InternalSrcPortBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.nat.instance.MappingTable;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.NatInstance;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.nat.instance.MappingTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.nat.instance.mapping.table.MappingEntry;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.nat.instance.mapping.table.MappingEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.nat.instance.mapping.table.MappingEntryKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.port.number.port.type.SinglePortNumberBuilder;
-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;
-
-final class MappingEntryCustomizer implements Ipv4Translator,
- InitializingListReaderCustomizer<MappingEntry, MappingEntryKey, MappingEntryBuilder> {
-
- private static final Logger LOG = LoggerFactory.getLogger(MappingEntryCustomizer.class);
-
- private final DumpCacheManager<SnatStaticMappingDetailsReplyDump, Void> dumpCacheManager;
- private final MappingEntryContext mappingEntryContext;
-
- MappingEntryCustomizer(
- final DumpCacheManager<SnatStaticMappingDetailsReplyDump, Void> dumpCacheManager,
- final MappingEntryContext mappingEntryContext) {
- this.dumpCacheManager = dumpCacheManager;
- this.mappingEntryContext = mappingEntryContext;
- }
-
- @Nonnull
- @Override
- public MappingEntryBuilder getBuilder(@Nonnull final InstanceIdentifier<MappingEntry> id) {
- return new MappingEntryBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<MappingEntry> id,
- @Nonnull final MappingEntryBuilder builder, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
- LOG.trace("Reading current attributes for mapping-entry: {}", id);
-
- final int idx = id.firstKeyOf(MappingEntry.class).getIndex().intValue();
- final int natInstanceId = id.firstKeyOf(NatInstance.class).getId().intValue();
- final List<SnatStaticMappingDetails> details =
- dumpCacheManager.getDump(id, ctx.getModificationCache(), null)
- .or(new SnatStaticMappingDetailsReplyDump()).snatStaticMappingDetails;
- final SnatStaticMappingDetails snatStaticMappingDetails =
- mappingEntryContext.findDetails(details, natInstanceId, idx, ctx.getMappingContext());
-
- builder.setIndex((long) idx);
- builder.setType(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.MappingEntry.Type.Static);
- // Snat only supports ipv4 for now
- builder.setExternalSrcAddress(arrayToIpv4AddressNoZoneReversed(snatStaticMappingDetails.externalIpAddress));
- builder.setInternalSrcAddress(
- new IpAddress(arrayToIpv4AddressNoZoneReversed(snatStaticMappingDetails.localIpAddress)));
-
- if (snatStaticMappingDetails.addrOnly == 0) {
- builder.setExternalSrcPort(new ExternalSrcPortBuilder()
- .setPortType(new SinglePortNumberBuilder().setSinglePortNumber(new PortNumber(
- (int) snatStaticMappingDetails.externalPort))
- .build())
- .build());
- builder.setInternalSrcPort(new InternalSrcPortBuilder()
- .setPortType(new SinglePortNumberBuilder().setSinglePortNumber(new PortNumber(
- (int) snatStaticMappingDetails.localPort))
- .build())
- .build());
- }
-
- LOG.trace("Mapping-entry read as: {}", builder);
- }
-
- @Nonnull
- @Override
- public List<MappingEntryKey> getAllIds(@Nonnull final InstanceIdentifier<MappingEntry> id,
- @Nonnull final ReadContext context) throws ReadFailedException {
- final Long natInstanceId = id.firstKeyOf(NatInstance.class).getId();
- LOG.trace("Listing IDs for all mapping-entries within nat-instance(vrf):{}", natInstanceId);
-
- final List<MappingEntryKey> entryKeys =
- dumpCacheManager.getDump(id, context.getModificationCache(), null)
- .or(new SnatStaticMappingDetailsReplyDump()).snatStaticMappingDetails.stream()
- .filter(detail -> natInstanceId == detail.vrfId)
- .map(detail -> mappingEntryContext
- .getStoredOrArtificialIndex(natInstanceId, detail, context.getMappingContext()))
- .map(MappingEntryKey::new)
- .collect(Collectors.toList());
- LOG.debug("List of mapping-entry keys within nat-instance(vrf):{} : {}", natInstanceId, entryKeys);
-
- return entryKeys;
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder,
- @Nonnull final List<MappingEntry> readData) {
- ((MappingTableBuilder) builder).setMappingEntry(readData);
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.nat.instance.mapping.table.MappingEntry> init(@Nonnull final InstanceIdentifier<MappingEntry> id,
- @Nonnull final MappingEntry readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id),
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.nat.instance.mapping.table.MappingEntryBuilder(readValue)
- .build());
- }
-
- static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.nat.instance.mapping.table.MappingEntry> getCfgId(final @Nonnull InstanceIdentifier<MappingEntry> id) {
- return NatInstanceCustomizer.getCfgId(RWUtils.cutId(id, NatInstance.class))
- .child(MappingTable.class)
- .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.nat.instance.mapping.table.MappingEntry.class,
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.nat.instance.mapping.table.MappingEntryKey(id.firstKeyOf(MappingEntry.class).getIndex()));
- }
-
- static final class MappingEntryDumpExecutor
- implements EntityDumpExecutor<SnatStaticMappingDetailsReplyDump, Void>, JvppReplyConsumer {
-
- private final FutureJVppSnatFacade jvppSnat;
-
- MappingEntryDumpExecutor(final FutureJVppSnatFacade jvppSnat) {
- this.jvppSnat = jvppSnat;
- }
-
- @Nonnull
- @Override
- public SnatStaticMappingDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier, final Void params)
- throws ReadFailedException {
- return getReplyForRead(jvppSnat.snatStaticMappingDump(new SnatStaticMappingDump()).toCompletableFuture(),
- identifier);
- }
- }
-}
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/NatInstanceCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/NatInstanceCustomizer.java
deleted file mode 100644
index 56965f7b4..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/NatInstanceCustomizer.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.nat.read;
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.vpp.jvpp.snat.dto.SnatStaticMappingDetailsReplyDump;
-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.nat.rev150908.NatConfig;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.NatInstancesBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.NatInstance;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.NatInstanceBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.NatInstanceKey;
-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;
-
-/**
- * Nat instance ID is mapped to VRF-ID in VPP.
- */
-final class NatInstanceCustomizer implements InitializingListReaderCustomizer<NatInstance, NatInstanceKey, NatInstanceBuilder> {
-
- private static final Logger LOG = LoggerFactory.getLogger(NatInstanceCustomizer.class);
- static final NatInstanceKey DEFAULT_VRF_ID = new NatInstanceKey(0L);
-
- private final DumpCacheManager<SnatStaticMappingDetailsReplyDump, Void> dumpCacheManager;
-
- NatInstanceCustomizer(
- final DumpCacheManager<SnatStaticMappingDetailsReplyDump, Void> dumpCacheManager) {
- this.dumpCacheManager = dumpCacheManager;
- }
-
- @Nonnull
- @Override
- public NatInstanceBuilder getBuilder(@Nonnull final InstanceIdentifier<NatInstance> id) {
- return new NatInstanceBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<NatInstance> id,
- @Nonnull final NatInstanceBuilder builder, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
- LOG.trace("Reading current attributes for nat-instance: {}", id);
- builder.setId(id.firstKeyOf(NatInstance.class).getId());
- }
-
- @Nonnull
- @Override
- public List<NatInstanceKey> getAllIds(@Nonnull final InstanceIdentifier<NatInstance> id,
- @Nonnull final ReadContext context) throws ReadFailedException {
- LOG.trace("Listing IDs for all nat-instances");
-
- // Find the nat instance IDs (vrf-ids) by listing all static mappings and their VRF assignment
- final List<NatInstanceKey> vrfIds =
- dumpCacheManager.getDump(id, context.getModificationCache(), null)
- .or(new SnatStaticMappingDetailsReplyDump()).snatStaticMappingDetails.stream()
- .map(detail -> detail.vrfId)
- .map(vrfId -> new NatInstanceKey((long) vrfId))
- .collect(Collectors.toList());
-
- // Add default vrf id if not present
- if (!vrfIds.contains(DEFAULT_VRF_ID)) {
- vrfIds.add(0, DEFAULT_VRF_ID);
- }
-
- LOG.debug("List of nat-instance keys (vrf-ids): {}", vrfIds);
- return vrfIds;
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder, @Nonnull final List<NatInstance> readData) {
- ((NatInstancesBuilder) builder).setNatInstance(readData);
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.NatInstance> init(@Nonnull final InstanceIdentifier<NatInstance> id,
- @Nonnull final NatInstance readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id),
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.NatInstanceBuilder()
- .setId(readValue.getId())
- .build());
- }
-
- static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.NatInstance> getCfgId(
- @Nonnull final InstanceIdentifier<NatInstance> id) {
- return InstanceIdentifier.create(NatConfig.class)
- .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.NatInstances.class)
- .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.NatInstance.class,
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.NatInstanceKey(
- id.firstKeyOf(NatInstance.class).getId()));
- }
-}
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/NatReaderFactory.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/NatReaderFactory.java
deleted file mode 100644
index ff0d1880c..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/NatReaderFactory.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.nat.read;
-
-import com.google.common.collect.Sets;
-import com.google.inject.Inject;
-import io.fd.honeycomb.nat.util.MappingEntryContext;
-import io.fd.honeycomb.translate.impl.read.GenericInitListReader;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.vpp.jvpp.snat.dto.SnatAddressDetailsReplyDump;
-import io.fd.vpp.jvpp.snat.dto.SnatStaticMappingDetailsReplyDump;
-import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.NatState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.NatStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.mapping.entry.ExternalSrcPort;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.mapping.entry.InternalSrcPort;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.parameters.ExternalIpAddressPool;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.NatInstances;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.NatInstancesBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.NatInstance;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.nat.instance.MappingTable;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.nat.instance.MappingTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.nat.instance.NatCurrentConfig;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.nat.instance.NatCurrentConfigBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.nat.instance.mapping.table.MappingEntry;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class NatReaderFactory implements ReaderFactory {
-
- private static final InstanceIdentifier<NatState> NAT_OPER_ID = InstanceIdentifier.create(NatState.class);
- private static final InstanceIdentifier<NatInstances> NAT_INSTANCES_ID = NAT_OPER_ID.child(NatInstances.class);
- private static final InstanceIdentifier<NatInstance> NAT_INSTANCE_ID = NAT_INSTANCES_ID.child(NatInstance.class);
- private static final InstanceIdentifier<NatCurrentConfig> CURRENT_CONFIG =
- NAT_INSTANCE_ID.child(NatCurrentConfig.class);
- private static final InstanceIdentifier<MappingTable> MAP_TABLE_ID = NAT_INSTANCE_ID.child(MappingTable.class);
- private static final InstanceIdentifier<MappingEntry> MAP_ENTRY_ID = MAP_TABLE_ID.child(MappingEntry.class);
-
- private final MappingEntryContext mappingEntryContext;
- private final DumpCacheManager<SnatStaticMappingDetailsReplyDump, Void> mapEntryDumpMgr;
- private final DumpCacheManager<SnatAddressDetailsReplyDump, Void> addressRangeDumpMgr;
-
-
- @Inject
- public NatReaderFactory(final FutureJVppSnatFacade jvppSnat,
- final MappingEntryContext mappingEntryContext) {
- this.mappingEntryContext = mappingEntryContext;
- this.mapEntryDumpMgr =
- new DumpCacheManager.DumpCacheManagerBuilder<SnatStaticMappingDetailsReplyDump, Void>()
- .withExecutor(new MappingEntryCustomizer.MappingEntryDumpExecutor(jvppSnat))
- .build();
-
- this.addressRangeDumpMgr =
- new DumpCacheManager.DumpCacheManagerBuilder<SnatAddressDetailsReplyDump, Void>()
- .withExecutor(new ExternalIpPoolCustomizer.AddressRangeDumpExecutor(jvppSnat))
- .build();
- }
-
- @Override
- public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
- registry.addStructuralReader(NAT_OPER_ID, NatStateBuilder.class);
- registry.addStructuralReader(NAT_INSTANCES_ID, NatInstancesBuilder.class);
- registry.add(new GenericInitListReader<>(NAT_INSTANCE_ID, new NatInstanceCustomizer(mapEntryDumpMgr)));
- registry.addStructuralReader(MAP_TABLE_ID, MappingTableBuilder.class);
- registry.subtreeAdd(Sets.newHashSet(InstanceIdentifier.create(MappingEntry.class).child(ExternalSrcPort.class),
- InstanceIdentifier.create(MappingEntry.class).child(InternalSrcPort.class)),
- new GenericInitListReader<>(MAP_ENTRY_ID,
- new MappingEntryCustomizer(mapEntryDumpMgr, mappingEntryContext)));
-
- registry.addStructuralReader(CURRENT_CONFIG, NatCurrentConfigBuilder.class);
- registry.add(new GenericInitListReader<>(CURRENT_CONFIG.child(ExternalIpAddressPool.class),
- new ExternalIpPoolCustomizer(addressRangeDumpMgr)));
- }
-}
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ifc/AbstractInterfaceNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ifc/AbstractInterfaceNatCustomizer.java
deleted file mode 100644
index f4d45900c..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ifc/AbstractInterfaceNatCustomizer.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.nat.read.ifc;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetails;
-import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetailsReplyDump;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-
-abstract class AbstractInterfaceNatCustomizer<C extends DataObject, B extends Builder<C>>
- implements InitializingReaderCustomizer<C, B> {
-
- private final DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> dumpMgr;
- private final NamingContext ifcContext;
-
- AbstractInterfaceNatCustomizer(@Nonnull final DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> dumpMgr,
- @Nonnull final NamingContext ifcContext) {
- this.dumpMgr = dumpMgr;
- this.ifcContext = ifcContext;
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<C> id,
- @Nonnull final B builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- // NOOP
- }
-
- @Override
- public boolean isPresent(final InstanceIdentifier<C> id, final C built, final ReadContext ctx) throws ReadFailedException {
- final String ifcName = id.firstKeyOf(Interface.class).getName();
- getLog().debug("Reading NAT features on interface: {}", ifcName);
- final int index = ifcContext.getIndex(ifcName, ctx.getMappingContext());
-
- // Cache dump for each interface under the same key since this is all ifc dump
- final Optional<SnatInterfaceDetailsReplyDump> dump =
- dumpMgr.getDump(id, ctx.getModificationCache(), null);
-
- // Find entries for current ifc and if is marked as inside set the builder to return presence container
- return dump.or(new SnatInterfaceDetailsReplyDump()).snatInterfaceDetails.stream()
- .filter(snatIfcDetail -> snatIfcDetail.swIfIndex == index)
- .filter(this::isExpectedNatType)
- .findFirst()
- .isPresent();
- // Not setting data, just marking the builder to propagate empty container to indicate presence
- }
-
- protected abstract Logger getLog();
-
- abstract boolean isExpectedNatType(final SnatInterfaceDetails snatInterfaceDetails);
-}
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ifc/IfcNatReaderFactory.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ifc/IfcNatReaderFactory.java
deleted file mode 100644
index 761986fc1..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ifc/IfcNatReaderFactory.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.nat.read.ifc;
-
-
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import io.fd.honeycomb.translate.impl.read.GenericInitReader;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetailsReplyDump;
-import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDump;
-import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214.NatInterfaceStateAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214.NatInterfaceStateAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.Nat;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.NatBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.nat.Inbound;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.nat.Outbound;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * Factory producing readers for nat plugin's data.
- */
-public final class IfcNatReaderFactory implements ReaderFactory {
-
- private static final InstanceIdentifier<Interface>
- IFC_ID = InstanceIdentifier.create(InterfacesState.class).child(Interface.class);
- private static final InstanceIdentifier<NatInterfaceStateAugmentation> NAT_AUG_ID =
- IFC_ID.augmentation(NatInterfaceStateAugmentation.class);
- private static final InstanceIdentifier<Nat> NAT_AUG_CONTAINER_ID = NAT_AUG_ID.child(Nat.class);
-
- private final DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> snatIfcDumpMgr;
- private final NamingContext ifcContext;
-
- @Inject
- public IfcNatReaderFactory(final FutureJVppSnatFacade jvppSnat,
- @Named("interface-context") final NamingContext ifcContext) {
- this.snatIfcDumpMgr = new DumpCacheManager.DumpCacheManagerBuilder<SnatInterfaceDetailsReplyDump, Void>()
- .withExecutor(new SnatInterfaceExecutor(jvppSnat))
- .build();
- this.ifcContext = ifcContext;
- }
-
- @Override
- public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
- registry.addStructuralReader(NAT_AUG_ID, NatInterfaceStateAugmentationBuilder.class);
- registry.addStructuralReader(NAT_AUG_CONTAINER_ID, NatBuilder.class);
-
- registry.addAfter(new GenericInitReader<>(NAT_AUG_CONTAINER_ID.child(Inbound.class),
- new InterfaceInboundNatCustomizer(snatIfcDumpMgr, ifcContext)), IFC_ID);
- registry.addAfter(new GenericInitReader<>(NAT_AUG_CONTAINER_ID.child(Outbound.class),
- new InterfaceOutboundNatCustomizer(snatIfcDumpMgr, ifcContext)), IFC_ID);
- }
-
- private static final class SnatInterfaceExecutor implements
- EntityDumpExecutor<SnatInterfaceDetailsReplyDump, Void>,
- JvppReplyConsumer {
-
- private final FutureJVppSnatFacade jvppSnat;
-
- SnatInterfaceExecutor(final FutureJVppSnatFacade jvppSnat) {
- this.jvppSnat = jvppSnat;
- }
-
- @Nonnull
- @Override
- public SnatInterfaceDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier, final Void params)
- throws ReadFailedException {
- return getReplyForRead(
- jvppSnat.snatInterfaceDump(new SnatInterfaceDump()).toCompletableFuture(), identifier);
- }
- }
-}
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ifc/InterfaceInboundNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ifc/InterfaceInboundNatCustomizer.java
deleted file mode 100644
index 3e4b60fb4..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ifc/InterfaceInboundNatCustomizer.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.nat.read.ifc;
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetails;
-import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetailsReplyDump;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214.NatInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.Nat;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.NatBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.nat.Inbound;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.nat.InboundBuilder;
-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;
-
-final class InterfaceInboundNatCustomizer extends AbstractInterfaceNatCustomizer<Inbound, InboundBuilder> {
-
- private static final Logger LOG = LoggerFactory.getLogger(InterfaceInboundNatCustomizer.class);
-
- InterfaceInboundNatCustomizer(
- @Nonnull final DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> dumpMgr,
- @Nonnull final NamingContext ifcContext) {
- super(dumpMgr, ifcContext);
- }
-
- @Override
- protected Logger getLog() {
- return LOG;
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Inbound> id,
- @Nonnull final InboundBuilder builder, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
- super.readCurrentAttributes(id, builder, ctx);
- }
-
- @Override
- boolean isExpectedNatType(final SnatInterfaceDetails snatInterfaceDetails) {
- return snatInterfaceDetails.isInside == 1;
- }
-
- @Nonnull
- @Override
- public InboundBuilder getBuilder(@Nonnull final InstanceIdentifier<Inbound> id) {
- // Return not present value by default
- return new InboundBuilder();
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final Inbound readValue) {
- ((NatBuilder) parentBuilder).setInbound(readValue);
- }
-
- @Nonnull
- @Override
- public Initialized<? extends DataObject> init(@Nonnull final InstanceIdentifier<Inbound> id,
- @Nonnull final Inbound readValue,
- @Nonnull final ReadContext ctx) {
- final InstanceIdentifier<Inbound> cfgId =
- InstanceIdentifier.create(Interfaces.class)
- .child(Interface.class,
- new InterfaceKey(id.firstKeyOf(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.class).getName()))
- .augmentation(NatInterfaceAugmentation.class)
- .child(Nat.class)
- .child(Inbound.class);
- return Initialized.create(cfgId, readValue);
- }
-}
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ifc/InterfaceOutboundNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ifc/InterfaceOutboundNatCustomizer.java
deleted file mode 100644
index da940c835..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/read/ifc/InterfaceOutboundNatCustomizer.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.nat.read.ifc;
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetails;
-import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetailsReplyDump;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214.NatInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.Nat;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.NatBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.nat.Outbound;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.nat.OutboundBuilder;
-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;
-
-final class InterfaceOutboundNatCustomizer extends AbstractInterfaceNatCustomizer<Outbound, OutboundBuilder> {
-
- private static final Logger LOG = LoggerFactory.getLogger(InterfaceOutboundNatCustomizer.class);
-
- InterfaceOutboundNatCustomizer(
- @Nonnull final DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> dumpMgr,
- @Nonnull final NamingContext ifcContext) {
- super(dumpMgr, ifcContext);
- }
-
- @Override
- protected Logger getLog() {
- return LOG;
- }
-
- @Override
- boolean isExpectedNatType(final SnatInterfaceDetails snatInterfaceDetails) {
- return snatInterfaceDetails.isInside == 0;
- }
-
- @Nonnull
- @Override
- public OutboundBuilder getBuilder(@Nonnull final InstanceIdentifier<Outbound> id) {
- return new OutboundBuilder();
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final Outbound readValue) {
- ((NatBuilder) parentBuilder).setOutbound(readValue);
- }
-
- @Nonnull
- @Override
- public Initialized<? extends DataObject> init(@Nonnull final InstanceIdentifier<Outbound> id,
- @Nonnull final Outbound readValue,
- @Nonnull final ReadContext ctx) {
- final InstanceIdentifier<Outbound> cfgId =
- InstanceIdentifier.create(Interfaces.class)
- .child(Interface.class,
- new InterfaceKey(id.firstKeyOf(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.class).getName()))
- .augmentation(NatInterfaceAugmentation.class)
- .child(Nat.class)
- .child(Outbound.class);
- return Initialized.create(cfgId, readValue);
- }
-}
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/util/MappingEntryContext.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/util/MappingEntryContext.java
deleted file mode 100644
index 0f2df7e1d..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/util/MappingEntryContext.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * 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.nat.util;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
-import io.fd.vpp.jvpp.snat.dto.SnatStaticMappingDetails;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import javax.annotation.Nonnull;
-import javax.annotation.concurrent.ThreadSafe;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.Contexts;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.nat.context.rev161214.NatMappingEntryCtxAugmentation;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.nat.context.rev161214.mapping.entry.context.attributes.NatMappingEntryContext;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.nat.context.rev161214.mapping.entry.context.attributes.nat.mapping.entry.context.NatInstance;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.nat.context.rev161214.mapping.entry.context.attributes.nat.mapping.entry.context.NatInstanceKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.nat.context.rev161214.mapping.entry.context.attributes.nat.mapping.entry.context.nat.instance.MappingTable;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.nat.context.rev161214.mapping.entry.context.attributes.nat.mapping.entry.context.nat.instance.mapping.table.MappingEntry;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.nat.context.rev161214.mapping.entry.context.attributes.nat.mapping.entry.context.nat.instance.mapping.table.MappingEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.nat.context.rev161214.mapping.entry.context.attributes.nat.mapping.entry.context.nat.instance.mapping.table.MappingEntryKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Context tracker for Nat Mapping entries.
- */
-@ThreadSafe
-public class MappingEntryContext implements Ipv4Translator {
-
- private static final Logger LOG = LoggerFactory.getLogger(MappingEntryContext.class);
-
- /**
- * Add mapping entry to index mapping to context.
- */
- public synchronized void addEntry(final long natInstanceId,
- final long entryId,
- @Nonnull final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.nat.instance.mapping.table.MappingEntry entry,
- @Nonnull final MappingContext mappingContext) {
- final InstanceIdentifier<MappingEntry> id = getId(natInstanceId, entryToKey(entry));
- checkArgument(!containsEntry(natInstanceId, entry, mappingContext), "Mapping for %s already present", id);
- mappingContext.put(id, toCtxMapEntry(entry, entryId));
- }
-
- /**
- * Check whether mapping entry to index mapping already exists in context.
- */
- public synchronized boolean containsEntry(final long natInstanceId,
- @Nonnull final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.nat.instance.mapping.table.MappingEntry entry,
- @Nonnull final MappingContext mappingContext) {
- final InstanceIdentifier<MappingEntry> id = getId(natInstanceId, entryToKey(entry));
- return mappingContext.read(id).isPresent();
- }
-
- @VisibleForTesting
- static InstanceIdentifier<MappingEntry> getId(final Long natInstanceId, final MappingEntryKey key) {
- return getTableId(natInstanceId).child(MappingEntry.class, key);
- }
-
- @VisibleForTesting
- static InstanceIdentifier<MappingTable> getTableId(final long natInstanceId) {
- return InstanceIdentifier.create(Contexts.class)
- .augmentation(NatMappingEntryCtxAugmentation.class)
- .child(NatMappingEntryContext.class)
- .child(NatInstance.class, new NatInstanceKey(natInstanceId))
- .child(MappingTable.class);
- }
-
- @VisibleForTesting
- static MappingEntryKey entryToKey(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.nat.instance.mapping.table.MappingEntry entry) {
- // Only IPv4
- return new MappingEntryKey(new IpAddress(entry.getExternalSrcAddress()), entry.getInternalSrcAddress());
- }
-
- private MappingEntryKey entryToKey(final SnatStaticMappingDetails entry) {
- // Only IPv4
- return new MappingEntryKey(
- new IpAddress(new Ipv4Address(arrayToIpv4AddressNoZoneReversed(entry.externalIpAddress))),
- new IpAddress(new Ipv4Address(arrayToIpv4AddressNoZoneReversed(entry.localIpAddress))));
- }
-
- private boolean equalEntries(final SnatStaticMappingDetails detail, final MappingEntry ctxMappingEntry) {
- final IpAddress internalAddrFromDetails =
- new IpAddress(new Ipv4Address(arrayToIpv4AddressNoZoneReversed(detail.localIpAddress)));
- // Only IPv4
- if (!ctxMappingEntry.getInternal().equals(internalAddrFromDetails)) {
- return false;
- }
- // Only IPv4
- final IpAddress externalAddrFromDetails =
- new IpAddress(new Ipv4Address(arrayToIpv4AddressNoZoneReversed(detail.externalIpAddress)));
- if (!ctxMappingEntry.getExternal().equals(externalAddrFromDetails)) {
- return false;
- }
- return true;
- }
-
- @VisibleForTesting
- static MappingEntry toCtxMapEntry(
- @Nonnull final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.nat.instance.mapping.table.MappingEntry entry,
- final long entryId) {
- return new MappingEntryBuilder()
- .setKey(entryToKey(entry))
- .setIndex(entryId)
- .build();
- }
-
- private MappingEntry toCtxMapEntry(@Nonnull final SnatStaticMappingDetails details, final long entryId) {
- return new MappingEntryBuilder()
- .setKey(entryToKey(details))
- .setIndex(entryId)
- .build();
- }
-
- /**
- * Delete mapping of mapping entry to index from context.
- */
- public synchronized void removeEntry(final long natInstanceId,
- @Nonnull final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.nat.instance.mapping.table.MappingEntry entry,
- @Nonnull final MappingContext mappingContext) {
- mappingContext.delete(getId(natInstanceId, entryToKey(entry)));
- }
-
- /**
- * Find specific details in provided collection identified with provided index.
- */
- public synchronized SnatStaticMappingDetails findDetails(@Nonnull final List<SnatStaticMappingDetails> details,
- final long natInstanceId, final long idx,
- @Nonnull final MappingContext mappingContext) {
- // Find mapping entry for Index
- final MappingEntry ctxMappingEntry = mappingContext.read(getTableId(natInstanceId))
- .transform(MappingTable::getMappingEntry)
- .or(Collections.emptyList())
- .stream()
- .filter(entry -> entry.getIndex() == idx)
- .findFirst()
- .orElseThrow(() -> new IllegalStateException("Unable to find context mapping for nat-instance: "
- + natInstanceId + " and ID: " + idx));
-
- // Find which details matches the context stored entry under index
- return details.stream()
- .filter(detail -> equalEntries(detail, ctxMappingEntry))
- .findFirst()
- .orElseThrow(() -> new IllegalStateException("Unable to match mapping for nat-instance: "
- + natInstanceId + " and match: " + ctxMappingEntry + " in: " + details));
- }
-
- /**
- * Get index for a mapping entry details or create an artificial one.
- */
- public synchronized long getStoredOrArtificialIndex(final Long natInstanceId,
- @Nonnull final SnatStaticMappingDetails details,
- @Nonnull final MappingContext mappingContext) {
- return mappingContext.read(getId(natInstanceId, entryToKey(details)))
- .transform(MappingEntry::getIndex)
- .or(() -> getArtificialId(details, natInstanceId, mappingContext));
- }
-
- /**
- * Get index for a stored mapping entry.
- */
- public synchronized Optional<Long> getStoredIndex(final long natInstanceId,
- @Nonnull final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.nat.instance.mapping.table.MappingEntry entry,
- @Nonnull final MappingContext mappingContext) {
- return mappingContext.read(getId(natInstanceId, entryToKey(entry)))
- .transform(MappingEntry::getIndex);
- }
-
- private long getArtificialId(final SnatStaticMappingDetails details, final Long natInstanceId,
- final MappingContext mappingContext) {
- LOG.trace("Assigning artificial ID for {}", details);
- final long artificialIdx = findFreeIndex(natInstanceId, mappingContext);
- LOG.debug("Artificial ID for {} assigned as: {}", details, artificialIdx);
- mappingContext.put(getId(natInstanceId, entryToKey(details)), toCtxMapEntry(details, artificialIdx));
- return artificialIdx;
- }
-
- private long findFreeIndex(final long natInstanceId, final MappingContext mappingContext) {
- return mappingContext.read(getTableId(natInstanceId))
- .transform(MappingTable::getMappingEntry)
- .or(Collections.emptyList())
- .stream()
- .map(MappingEntry::getIndex)
- .max(Comparator.naturalOrder())
- .map(i -> i + 1)
- .orElse(0L);
- }
-}
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ExternalIpPoolCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ExternalIpPoolCustomizer.java
deleted file mode 100644
index 856bc1355..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ExternalIpPoolCustomizer.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.nat.write;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.Ipv4AddressRange;
-import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
-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.snat.dto.SnatAddAddressRange;
-import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.NatInstance;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.parameters.ExternalIpAddressPool;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.parameters.ExternalIpAddressPoolKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-final class ExternalIpPoolCustomizer implements ListWriterCustomizer<ExternalIpAddressPool, ExternalIpAddressPoolKey>,
- JvppReplyConsumer, Ipv4Translator {
-
- private static final Logger LOG = LoggerFactory.getLogger(ExternalIpPoolCustomizer.class);
-
- private final FutureJVppSnatFacade jvppSnat;
-
- ExternalIpPoolCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat) {
- this.jvppSnat = jvppSnat;
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<ExternalIpAddressPool> id,
- @Nonnull final ExternalIpAddressPool dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- checkArgument(id.firstKeyOf(NatInstance.class).getId() == 0,
- "External IP pools are only assignable for nat instance(vrf-id) with ID 0");
- LOG.trace("Adding address range:{}, as: {}", id, dataAfter);
- // TODO check overlaps ? VPP-478 maybe no necessary, depending on how VPP handles them
- getReplyForCreate(jvppSnat.snatAddAddressRange(
- getRequest(dataAfter.getExternalIpPool(), true)).toCompletableFuture(), id, dataAfter);
- LOG.debug("Address range: {} added successfully", id);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<ExternalIpAddressPool> id,
- @Nonnull final ExternalIpAddressPool dataBefore,
- @Nonnull final ExternalIpAddressPool dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter,
- new UnsupportedOperationException("Address range update is not supported"));
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<ExternalIpAddressPool> id,
- @Nonnull final ExternalIpAddressPool dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- LOG.trace("Deleting address range:{}, as: {}", id, dataBefore);
- getReplyForDelete(jvppSnat.snatAddAddressRange(
- getRequest(dataBefore.getExternalIpPool(), false)).toCompletableFuture(), id);
- LOG.debug("Deleting range: {} added successfully", id);
- }
-
- private SnatAddAddressRange getRequest(final Ipv4Prefix externalIpPool, boolean isAdd) {
- SnatAddAddressRange request = new SnatAddAddressRange();
- // SNAT supports only IPv4 now, so does the model
- final Ipv4AddressRange range = Ipv4AddressRange.fromPrefix(externalIpPool);
- LOG.trace("Handling address range: {}", range);
- request.isIp4 = 1;
- request.isAdd = (byte) (isAdd ? 1 : 0);
- request.firstIpAddress = ipv4AddressNoZoneToArray(range.getStart());
- request.lastIpAddress = ipv4AddressNoZoneToArray(range.getEnd());
- return request;
- }
-}
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/MappingEntryCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/MappingEntryCustomizer.java
deleted file mode 100644
index 785606942..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/MappingEntryCustomizer.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * 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.nat.write;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.nat.util.MappingEntryContext;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
-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.snat.dto.SnatAddStaticMapping;
-import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.PortNumber;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.NatInstance;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.nat.instance.mapping.table.MappingEntry;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.nat.instance.mapping.table.MappingEntryKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.port.number.PortType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.port.number.port.type.SinglePortNumber;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-final class MappingEntryCustomizer implements ListWriterCustomizer<MappingEntry, MappingEntryKey>,
- JvppReplyConsumer, Ipv4Translator {
-
- private static final Logger LOG = LoggerFactory.getLogger(MappingEntryCustomizer.class);
-
- private final FutureJVppSnatFacade jvppSnat;
- private final MappingEntryContext mappingEntryContext;
-
- MappingEntryCustomizer(final FutureJVppSnatFacade jvppSnat, final MappingEntryContext mappingEntryContext) {
- this.jvppSnat = jvppSnat;
- this.mappingEntryContext = mappingEntryContext;
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<MappingEntry> id,
- @Nonnull final MappingEntry dataAfter,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- // Only static mapping supported by SNAT for now
- checkArgument(dataAfter.getType() ==
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.MappingEntry.Type.Static,
- "Only static NAT entries are supported currently. Trying to write: %s entry", dataAfter.getType());
- final Long natInstanceId = id.firstKeyOf(NatInstance.class).getId();
- final Long mappingEntryId = id.firstKeyOf(MappingEntry.class).getIndex();
- LOG.debug("Writing mapping entry: {} for nat-instance(vrf): {}", natInstanceId, mappingEntryId);
-
- final SnatAddStaticMapping request = getRequest(id, dataAfter, natInstanceId, true);
- getReplyForWrite(jvppSnat.snatAddStaticMapping(request).toCompletableFuture(), id);
-
- // Store context mapping only if not already present under the same exact mapping
- synchronized (mappingEntryContext) {
- if (shouldStoreContextMapping(natInstanceId, mappingEntryId, dataAfter, writeContext)) {
- mappingEntryContext
- .addEntry(natInstanceId, mappingEntryId, dataAfter, writeContext.getMappingContext());
- }
- }
- LOG.trace("Mapping entry: {} for nat-instance(vrf): {} written successfully", request.vrfId, id);
- }
-
- /**
- * Check whether entry is already stored in context under the same index.
- *
- * @return true if it's not yet stored under same index, false otherwise.
- */
- private boolean shouldStoreContextMapping(final long natInstanceId, final long mappingEntryId,
- final MappingEntry dataAfter,
- final WriteContext writeCtx) {
- if (!mappingEntryContext.containsEntry(natInstanceId, dataAfter, writeCtx.getMappingContext())) {
- return true;
- }
-
- final Optional<Long> storedIndex =
- mappingEntryContext.getStoredIndex(natInstanceId, dataAfter, writeCtx.getMappingContext());
- if (!storedIndex.isPresent()) {
- return true;
- }
-
- if (storedIndex.get() != mappingEntryId) {
- return true;
- }
-
- return false;
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<MappingEntry> id,
- @Nonnull final MappingEntry dataBefore,
- @Nonnull final MappingEntry dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter,
- new UnsupportedOperationException("Mapping entry update not supported"));
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<MappingEntry> id,
- @Nonnull final MappingEntry dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- final long natInstanceId = id.firstKeyOf(NatInstance.class).getId();
- final MappingEntryKey mappingEntryKey = id.firstKeyOf(MappingEntry.class);
- LOG.debug("Deleting mapping entry: {} for nat-instance(vrf): {}", natInstanceId, mappingEntryKey);
-
- final SnatAddStaticMapping request = getRequest(id, dataBefore, natInstanceId, false);
- getReplyForWrite(jvppSnat.snatAddStaticMapping(request).toCompletableFuture(), id);
- mappingEntryContext.removeEntry(natInstanceId, dataBefore, writeContext.getMappingContext());
- LOG.trace("Mapping entry: {} for nat-instance(vrf): {} deleted successfully", request.vrfId, id);
- }
-
- private SnatAddStaticMapping getRequest(final InstanceIdentifier<MappingEntry> id,
- final MappingEntry dataAfter,
- final Long natInstanceId,
- final boolean isAdd)
- throws WriteFailedException.CreateFailedException {
- final SnatAddStaticMapping request = new SnatAddStaticMapping();
- request.isAdd = isAdd
- ? (byte) 1
- : 0;
- request.isIp4 = 1;
- // VPP uses int, model long
- request.vrfId = natInstanceId.intValue();
-
- // Snat supports only ipv4 now
- if (dataAfter.getInternalSrcAddress().getIpv4Address() == null) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter,
- new UnsupportedOperationException(
- String.format("No Ipv4 present for in address %s. Ipv6 not supported",
- dataAfter.getInternalSrcAddress())));
- }
-
- request.addrOnly = 1;
- request.localIpAddress =
- ipv4AddressNoZoneToArray(dataAfter.getInternalSrcAddress().getIpv4Address().getValue());
- request.externalIpAddress = ipv4AddressNoZoneToArray(dataAfter.getExternalSrcAddress().getValue());
-
- Optional<Short> internalPortNumber = getPortNumber(id, dataAfter,
- (entry) -> Optional.fromNullable(entry.getInternalSrcPort()).transform(PortNumber::getPortType));
- Optional<Short> externalPortNumber = getPortNumber(id, dataAfter,
- (entry) -> Optional.fromNullable(entry.getExternalSrcPort()).transform(PortNumber::getPortType));
- if (internalPortNumber.isPresent() && externalPortNumber.isPresent()) {
- request.addrOnly = 0;
- request.localPort = internalPortNumber.get();
- request.externalPort = externalPortNumber.get();
- }
- return request;
- }
-
- private Optional<Short> getPortNumber(final InstanceIdentifier<MappingEntry> id, final MappingEntry dataAfter,
- final PortGetter portGetter) {
- return portGetter.getPortType(dataAfter).transform(port -> {
- if (port instanceof SinglePortNumber) {
- return ((SinglePortNumber) port).getSinglePortNumber().getValue().shortValue();
- } else {
- throw new IllegalArgumentException(
- String.format("Only single port number supported. Submitted: %s for entry: %s",
- dataAfter.getInternalSrcPort(), id));
- }
- });
- }
-
- interface PortGetter {
- Optional<PortType> getPortType(MappingEntry entry);
- }
-}
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/NatInstaceCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/NatInstaceCustomizer.java
deleted file mode 100644
index 3cc477dd0..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/NatInstaceCustomizer.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.nat.write;
-
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.NatInstance;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.NatInstanceKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-final class NatInstaceCustomizer implements ListWriterCustomizer<NatInstance, NatInstanceKey> {
-
- private static final Logger LOG = LoggerFactory.getLogger(NatInstaceCustomizer.class);
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<NatInstance> id,
- @Nonnull final NatInstance dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- LOG.trace("Writing nat-instance: {}", id);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<NatInstance> id,
- @Nonnull final NatInstance dataBefore, @Nonnull final NatInstance dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- LOG.trace("Updating nat-instance: {}", id);
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<NatInstance> id,
- @Nonnull final NatInstance dataBefore, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- LOG.trace("Deleting nat-instance: {}", id);
- }
-}
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/NatWriterFactory.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/NatWriterFactory.java
deleted file mode 100644
index 7887d463a..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/NatWriterFactory.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.nat.write;
-
-import com.google.common.collect.Sets;
-import com.google.inject.Inject;
-import io.fd.honeycomb.nat.util.MappingEntryContext;
-import io.fd.honeycomb.translate.impl.write.GenericListWriter;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
-import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.NatConfig;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.mapping.entry.ExternalSrcPort;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.mapping.entry.InternalSrcPort;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.NatInstances;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.NatInstance;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.nat.instance.MappingTable;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.nat.instance.mapping.table.MappingEntry;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.parameters.ExternalIpAddressPool;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * Nat Writers registration.
- */
-public final class NatWriterFactory implements WriterFactory {
-
- private static final InstanceIdentifier<NatConfig> NAT_CFG_ID = InstanceIdentifier.create(NatConfig.class);
- private static final InstanceIdentifier<NatInstance> NAT_INSTANCE_ID =
- NAT_CFG_ID.child(NatInstances.class).child(NatInstance.class);
- private static final InstanceIdentifier<MappingEntry> MAP_ENTRY_ID =
- NAT_INSTANCE_ID.child(MappingTable.class).child(MappingEntry.class);
-
- private final FutureJVppSnatFacade jvppSnat;
- private final MappingEntryContext mappingEntryContext;
-
- @Inject
- public NatWriterFactory(final FutureJVppSnatFacade jvppSnat,
- final MappingEntryContext mappingEntryContext) {
- this.jvppSnat = jvppSnat;
- this.mappingEntryContext = mappingEntryContext;
- }
-
- @Override
- public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
- // Nat-instance
- registry.add(new GenericListWriter<>(NAT_INSTANCE_ID, new NatInstaceCustomizer()));
- // Mapping-entry
- registry.subtreeAdd(Sets.newHashSet(InstanceIdentifier.create(MappingEntry.class).child(ExternalSrcPort.class),
- InstanceIdentifier.create(MappingEntry.class).child(InternalSrcPort.class)),
- new GenericListWriter<>(MAP_ENTRY_ID, new MappingEntryCustomizer(jvppSnat, mappingEntryContext)));
-
- // External address pool has to be executed before mapping entry. Because adding mapping entries requires to
- // already have an IP range predefined ... in some cases
- registry.addBefore(new GenericListWriter<>(NAT_INSTANCE_ID.child(ExternalIpAddressPool.class),
- new ExternalIpPoolCustomizer(jvppSnat)),
- MAP_ENTRY_ID);
- }
-}
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ifc/AbstractInterfaceNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ifc/AbstractInterfaceNatCustomizer.java
deleted file mode 100644
index 64e714241..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ifc/AbstractInterfaceNatCustomizer.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.nat.write.ifc;
-
-import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-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.snat.dto.SnatInterfaceAddDelFeature;
-import io.fd.vpp.jvpp.snat.dto.SnatInterfaceAddDelFeatureReply;
-import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-
-abstract class AbstractInterfaceNatCustomizer<D extends DataObject> implements JvppReplyConsumer, WriterCustomizer<D> {
-
- private final FutureJVppSnatFacade jvppSnat;
- private final NamingContext ifcContext;
-
- AbstractInterfaceNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat,
- @Nonnull final NamingContext ifcContext) {
- this.jvppSnat = jvppSnat;
- this.ifcContext = ifcContext;
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<D> id, @Nonnull final D dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- final String ifcName = id.firstKeyOf(Interface.class).getName();
- getLog().debug("Enabling " + getType() + " NAT on interface: {}", ifcName);
- getLog().debug("Enabling " + getType() + " NAT: {}", id);
-
- final int ifcIndex = ifcContext.getIndex(ifcName, writeContext.getMappingContext());
- final SnatInterfaceAddDelFeature request = getRequest(ifcIndex, (byte)1);
- final CompletionStage<SnatInterfaceAddDelFeatureReply> future = jvppSnat.snatInterfaceAddDelFeature(request);
-
- final SnatInterfaceAddDelFeatureReply reply = getReplyForWrite(future.toCompletableFuture(), id);
- getLog().debug("NAT " + getType() + " enabled successfully on: {}, reply: {}", ifcName, reply);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<D> id,
- @Nonnull final D dataBefore, @Nonnull final D dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter,
- new UnsupportedOperationException("Unable to update NAT feature"));
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<D> id,
- @Nonnull final D dataBefore, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String ifcName = id.firstKeyOf(Interface.class).getName();
- getLog().debug("Disabling " + getType() + " NAT on interface: {}", ifcName);
- getLog().debug("Disabling " + getType() + " NAT: {}", id);
-
- final int ifcIndex = ifcContext.getIndex(ifcName, writeContext.getMappingContext());
- final SnatInterfaceAddDelFeature request = getRequest(ifcIndex, (byte)0);
- final CompletionStage<SnatInterfaceAddDelFeatureReply> future = jvppSnat.snatInterfaceAddDelFeature(request);
-
- final SnatInterfaceAddDelFeatureReply reply = getReplyForWrite(future.toCompletableFuture(), id);
- getLog().debug("NAT " + getType() + " disabled successfully on: {}, reply: {}", ifcName, reply);
- }
-
- enum NatType {
- INBOUND((byte)1), OUTBOUND((byte)0);
-
- private final byte isInside;
-
- NatType(final byte isInside) {
- this.isInside = isInside;
- }
- }
-
- abstract NatType getType();
- abstract Logger getLog();
-
- private SnatInterfaceAddDelFeature getRequest(final int ifcIdx, final byte isAdd) {
- final SnatInterfaceAddDelFeature request = new SnatInterfaceAddDelFeature();
- request.isAdd = isAdd;
- request.isInside = getType().isInside;
- request.swIfIndex = ifcIdx;
- return request;
- }
-
-}
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ifc/IfcNatWriterFactory.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ifc/IfcNatWriterFactory.java
deleted file mode 100644
index bf2c600a2..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ifc/IfcNatWriterFactory.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.nat.write.ifc;
-
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-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.snat.future.FutureJVppSnatFacade;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214.NatInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.Nat;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.nat.Inbound;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.nat.Outbound;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * Nat Writers registration.
- */
-public final class IfcNatWriterFactory implements WriterFactory {
-
- private static final InstanceIdentifier<Interface>
- IFC_ID = InstanceIdentifier.create(Interfaces.class).child(Interface.class);
- private static final InstanceIdentifier<Nat> NAT_AUG_ID =
- IFC_ID .augmentation(NatInterfaceAugmentation.class).child(Nat.class);
-
- private final FutureJVppSnatFacade jvppSnat;
- private final NamingContext ifcContext;
-
- @Inject
- public IfcNatWriterFactory(final FutureJVppSnatFacade jvppSnat,
- @Named("interface-context") final NamingContext ifcContext) {
- this.jvppSnat = jvppSnat;
- this.ifcContext = ifcContext;
- }
-
- @Override
- public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
- registry.addAfter(new GenericWriter<>(NAT_AUG_ID.child(Inbound.class),
- new InterfaceInboundNatCustomizer(jvppSnat, ifcContext)), IFC_ID);
- registry.addAfter(new GenericWriter<>(NAT_AUG_ID.child(Outbound.class),
- new InterfaceOutboundNatCustomizer(jvppSnat, ifcContext)), IFC_ID);
- }
-}
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ifc/InterfaceInboundNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ifc/InterfaceInboundNatCustomizer.java
deleted file mode 100644
index e72e12ada..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ifc/InterfaceInboundNatCustomizer.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.nat.write.ifc;
-
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.nat.Inbound;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-final class InterfaceInboundNatCustomizer extends AbstractInterfaceNatCustomizer<Inbound> {
-
- private static final Logger LOG = LoggerFactory.getLogger(InterfaceInboundNatCustomizer.class);
-
- InterfaceInboundNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat,
- @Nonnull final NamingContext ifcContext) {
- super(jvppSnat, ifcContext);
- }
-
- @Override
- NatType getType() {
- return NatType.INBOUND;
- }
-
- @Override
- Logger getLog() {
- return LOG;
- }
-}
diff --git a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ifc/InterfaceOutboundNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ifc/InterfaceOutboundNatCustomizer.java
deleted file mode 100644
index 488edc73c..000000000
--- a/nat/nat2vpp/src/main/java/io/fd/honeycomb/nat/write/ifc/InterfaceOutboundNatCustomizer.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.nat.write.ifc;
-
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.nat.Outbound;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-final class InterfaceOutboundNatCustomizer extends AbstractInterfaceNatCustomizer<Outbound> {
-
- private static final Logger LOG = LoggerFactory.getLogger(InterfaceOutboundNatCustomizer.class);
-
- InterfaceOutboundNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat,
- @Nonnull final NamingContext ifcContext) {
- super(jvppSnat, ifcContext);
- }
-
- @Override
- NatType getType() {
- return NatType.OUTBOUND;
- }
-
- @Override
- Logger getLog() {
- return LOG;
- }
-}
diff --git a/nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/NatModuleTest.java b/nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/NatModuleTest.java
deleted file mode 100644
index f69672e15..000000000
--- a/nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/NatModuleTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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.nat;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.Matchers.empty;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import com.google.inject.Guice;
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.google.inject.multibindings.Multibinder;
-import com.google.inject.name.Named;
-import com.google.inject.testing.fieldbinder.Bind;
-import com.google.inject.testing.fieldbinder.BoundFieldModule;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
-import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade;
-import java.util.HashSet;
-import java.util.Set;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class NatModuleTest {
-
- @Named("honeycomb-context")
- @Bind
- @Mock
- private DataBroker honeycombContext;
-
- @Bind
- private ReaderFactory ietfIfcReaderFactory;
-
- @Named("honeycomb-initializer")
- @Bind
- @Mock
- private DataBroker honeycombInitializer;
-
- @Named("interface-context")
- @Bind
- private NamingContext ifcContext;
-
- @Inject
- private Set<ReaderFactory> readerFactories = new HashSet<>();
-
- @Inject
- private Set<WriterFactory> writerFactories = new HashSet<>();
-
- @Before
- public void setUp() throws Exception {
- ietfIfcReaderFactory = registry -> {
- registry.addStructuralReader(InstanceIdentifier.create(InterfacesState.class), InterfacesStateBuilder.class);
- registry.addStructuralReader(InstanceIdentifier.create(InterfacesState.class).child(Interface.class), InterfaceBuilder.class);
- };
- initMocks(this);
- ifcContext = new NamingContext("interface-", "interface-context");
- // Nat Module adds readers under InterfacesState/Interface and since readers for parents that do nothing need to
- // be present, add structural readers (or add V3poModule here, but adding the full Module is not the best solution)
- Guice.createInjector(binder -> Multibinder.newSetBinder(binder, ReaderFactory.class)
- .addBinding().toInstance(registry -> {
- registry.addStructuralReader(InstanceIdentifier.create(InterfacesState.class),
- InterfacesStateBuilder.class);
- registry.addStructuralReader(InstanceIdentifier.create(InterfacesState.class).child(Interface.class),
- InterfaceBuilder.class);
- }), new NatModule(MockJVppSnatProvider.class), BoundFieldModule.of(this)).injectMembers(this);
- }
-
- @Test
- public void testReaderFactories() throws Exception {
- assertThat(readerFactories, is(not(empty())));
-
- // Test registration process (all dependencies present, topological order of readers does exist, etc.)
- final CompositeReaderRegistryBuilder registryBuilder = new CompositeReaderRegistryBuilder();
- readerFactories.forEach(factory -> factory.init(registryBuilder));
- assertNotNull(registryBuilder.build());
- }
-
- @Test
- public void testWriterFactories() throws Exception {
- assertThat(writerFactories, is(not(empty())));
-
- // Test registration process (all dependencies present, topological order of writers does exist, etc.)
- final FlatWriterRegistryBuilder registryBuilder = new FlatWriterRegistryBuilder();
- writerFactories.forEach(factory -> factory.init(registryBuilder));
- assertNotNull(registryBuilder.build());
- }
-
- private static final class MockJVppSnatProvider implements Provider<FutureJVppSnatFacade> {
-
- @Override
- public FutureJVppSnatFacade get() {
- return mock(FutureJVppSnatFacade.class);
- }
- }
-} \ No newline at end of file
diff --git a/nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/read/ifc/InterfaceInboundNatCustomizerTest.java b/nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/read/ifc/InterfaceInboundNatCustomizerTest.java
deleted file mode 100644
index 3cef1880e..000000000
--- a/nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/read/ifc/InterfaceInboundNatCustomizerTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.nat.read.ifc;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import com.google.common.collect.Lists;
-import io.fd.honeycomb.translate.impl.read.GenericReader;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetails;
-import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetailsReplyDump;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214.NatInterfaceStateAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.Nat;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.NatBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.nat.Inbound;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.nat.InboundBuilder;
-import org.opendaylight.yangtools.yang.binding.ChildOf;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class InterfaceInboundNatCustomizerTest
- extends ReaderCustomizerTest<Inbound, InboundBuilder> {
-
- private static final String IFC_NAME = "a";
- private static final int IFC_IDX = 0;
- private static final String CTX_NAME = "ifc";
-
- @Mock
- private EntityDumpExecutor<SnatInterfaceDetailsReplyDump, Void> natExecutor;
- private DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> dumpMgr;
- private NamingContext ifcContext = new NamingContext(CTX_NAME, CTX_NAME);
- private InstanceIdentifier<Inbound> id;
-
- public InterfaceInboundNatCustomizerTest() {
- super(Inbound.class, NatBuilder.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- id = getId(Inbound.class);
- defineMapping(mappingContext, IFC_NAME, IFC_IDX, CTX_NAME);
- // empty dump
- Mockito.doReturn(new SnatInterfaceDetailsReplyDump()).when(natExecutor).executeDump(id, null);
- dumpMgr = new DumpCacheManager.DumpCacheManagerBuilder<SnatInterfaceDetailsReplyDump, Void>()
- .withExecutor(natExecutor)
- .build();
- }
-
- static <T extends ChildOf<Nat>> InstanceIdentifier<T> getId(Class<T> boundType) {
- return InstanceIdentifier.create(InterfacesState.class)
- .child(Interface.class, new InterfaceKey(IFC_NAME))
- .augmentation(NatInterfaceStateAugmentation.class)
- .child(Nat.class)
- .child(boundType);
- }
-
- @Test
- public void testNoPresence() throws Exception {
- assertFalse(getReader().read(id, ctx).isPresent());
- }
-
- private GenericReader<Inbound, InboundBuilder> getReader() {
- return new GenericReader<>(RWUtils.makeIidWildcarded(id), customizer);
- }
-
- @Test
- public void testPresence() throws Exception {
- final SnatInterfaceDetailsReplyDump details = new SnatInterfaceDetailsReplyDump();
- final SnatInterfaceDetails detail = new SnatInterfaceDetails();
- detail.isInside = 1;
- detail.swIfIndex = IFC_IDX;
- details.snatInterfaceDetails = Lists.newArrayList(detail);
- Mockito.doReturn(details).when(natExecutor).executeDump(id, null);
-
- assertTrue(getReader().read(id, ctx).isPresent());
- }
-
- @Override
- protected ReaderCustomizer<Inbound, InboundBuilder> initCustomizer() {
- return new InterfaceInboundNatCustomizer(dumpMgr, ifcContext);
- }
-} \ No newline at end of file
diff --git a/nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/read/ifc/InterfaceOutboundNatCustomizerTest.java b/nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/read/ifc/InterfaceOutboundNatCustomizerTest.java
deleted file mode 100644
index c33e040bb..000000000
--- a/nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/read/ifc/InterfaceOutboundNatCustomizerTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.nat.read.ifc;
-
-import static io.fd.honeycomb.nat.read.ifc.InterfaceInboundNatCustomizerTest.getId;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import com.google.common.collect.Lists;
-import io.fd.honeycomb.translate.impl.read.GenericReader;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetails;
-import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetailsReplyDump;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.NatBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.nat.Outbound;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev161214._interface.nat.attributes.nat.OutboundBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class InterfaceOutboundNatCustomizerTest
- extends ReaderCustomizerTest<Outbound, OutboundBuilder> {
-
- private static final String IFC_NAME = "a";
- private static final int IFC_IDX = 0;
- private static final String CTX_NAME = "ifc";
-
- @Mock
- private EntityDumpExecutor<SnatInterfaceDetailsReplyDump, Void> abc;
- private DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> dumpMgr;
- private NamingContext ifcContext = new NamingContext(CTX_NAME, CTX_NAME);
- private InstanceIdentifier<Outbound> id;
-
- public InterfaceOutboundNatCustomizerTest() {
- super(Outbound.class, NatBuilder.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- id = getId(Outbound.class);
- defineMapping(mappingContext, IFC_NAME, IFC_IDX, CTX_NAME);
- // empty dump
- Mockito.doReturn(new SnatInterfaceDetailsReplyDump()).when(abc).executeDump(id, null);
- dumpMgr = new DumpCacheManager.DumpCacheManagerBuilder<SnatInterfaceDetailsReplyDump, Void>()
- .withExecutor(abc)
- .build();
- }
-
- @Test
- public void testNoPresence() throws Exception {
- assertFalse(getReader().read(id, ctx).isPresent());
- }
-
- private GenericReader<Outbound, OutboundBuilder> getReader() {
- return new GenericReader<>(RWUtils.makeIidWildcarded(id), customizer);
- }
-
- @Test
- public void testPresence() throws Exception {
- final SnatInterfaceDetailsReplyDump details = new SnatInterfaceDetailsReplyDump();
- final SnatInterfaceDetails detail = new SnatInterfaceDetails();
- detail.isInside = 0;
- detail.swIfIndex = IFC_IDX;
- details.snatInterfaceDetails = Lists.newArrayList(detail);
- Mockito.doReturn(details).when(abc).executeDump(id, null);
-
- assertTrue(getReader().read(id, ctx).isPresent());
- }
-
- @Override
- protected ReaderCustomizer<Outbound, OutboundBuilder> initCustomizer() {
- return new InterfaceOutboundNatCustomizer(dumpMgr, ifcContext);
- }
-} \ No newline at end of file
diff --git a/nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/util/MappingEntryContextTest.java b/nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/util/MappingEntryContextTest.java
deleted file mode 100644
index fee8def89..000000000
--- a/nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/util/MappingEntryContextTest.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * 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.nat.util;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.Lists;
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
-import io.fd.vpp.jvpp.snat.dto.SnatStaticMappingDetails;
-import java.util.Collections;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.nat.context.rev161214.mapping.entry.context.attributes.nat.mapping.entry.context.nat.instance.MappingTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-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.nat.rev150908.nat.config.nat.instances.nat.instance.mapping.table.MappingEntry;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.nat.instance.mapping.table.MappingEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.nat.instance.mapping.table.MappingEntryKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-@SuppressWarnings("unchecked")
-public class MappingEntryContextTest implements Ipv4Translator {
-
- private MappingEntryContext ctx = new MappingEntryContext();
- @Mock
- private MappingContext mappingCtx;
-
- @Before
- public void setUp() throws Exception {
- initMocks(this);
- }
-
- @Test
- public void testAdd() throws Exception {
- when(mappingCtx.read(any(InstanceIdentifier.class))).thenReturn(Optional.absent());
- final long natId = 7;
- final long entryId = 99;
- final MappingEntry entry = getEntry(natId, "192.168.1.5", "17.14.4.6");
-
- ctx.addEntry(natId, entryId, entry, mappingCtx);
-
- verify(mappingCtx).put(MappingEntryContext.getId(natId, MappingEntryContext.entryToKey(entry)), MappingEntryContext.toCtxMapEntry(entry, entryId));
- }
-
- @Test
- public void testRemove() throws Exception {
- final long natId = 0;
- final MappingEntry entry = getEntry(natId, "192.168.1.5", "17.14.4.6");
-
- ctx.removeEntry(natId, entry, mappingCtx);
-
- verify(mappingCtx).delete(MappingEntryContext.getId(natId, MappingEntryContext.entryToKey(entry)));
- }
-
- @Test
- public void testGetExistingIndex() throws Exception {
- final long natId = 0;
- final long entryId = 12;
- final MappingEntry entry = getEntry(entryId, "192.168.1.5", "17.14.4.6");
- final SnatStaticMappingDetails details = getDetails(entryId, "192.168.1.5", "17.14.4.6");
-
- when(mappingCtx.read(MappingEntryContext.getId(natId, MappingEntryContext.entryToKey(entry))))
- .thenReturn(Optional.of(MappingEntryContext.toCtxMapEntry(entry, entryId)));
-
- assertEquals(12, ctx.getStoredOrArtificialIndex(natId, details, mappingCtx));
- verify(mappingCtx).read(MappingEntryContext.getId(natId, MappingEntryContext.entryToKey(entry)));
- }
-
- @Test
- public void testFindDetails() throws Exception {
- final long natId = 0;
- final MappingEntry entry = getEntry(0, "192.168.1.5", "17.14.4.6");
- final SnatStaticMappingDetails details = getDetails(0, "192.168.1.5", "17.14.4.6");
- final MappingEntry entry2 = getEntry(1, "192.168.1.8", "17.14.4.10");
- final SnatStaticMappingDetails details2 = getDetails(1, "192.168.1.8", "17.14.4.10");
-
- final List<SnatStaticMappingDetails> someDetails = Lists.newArrayList(details, details2);
-
- when(mappingCtx.read(MappingEntryContext.getTableId(natId)))
- .thenReturn(Optional.of(new MappingTableBuilder()
- .setMappingEntry(Lists.newArrayList(
- MappingEntryContext.toCtxMapEntry(entry, 0),
- MappingEntryContext.toCtxMapEntry(entry2, 1)))
- .build()));
-
- assertSame(details, ctx.findDetails(someDetails, natId, 0, mappingCtx));
- }
-
- @Test(expected = IllegalStateException.class)
- public void testFindDetailsNoMappingStored() throws Exception {
- final long natId = 0;
- final long entryId = 12;
- final SnatStaticMappingDetails details = getDetails(entryId, "192.168.1.5", "17.14.4.6");
- final List<SnatStaticMappingDetails> someDetails = Lists.newArrayList(details);
- when(mappingCtx.read(MappingEntryContext.getTableId(natId))).thenReturn(Optional.absent());
-
- ctx.findDetails(someDetails, natId, entryId, mappingCtx);
- }
-
- @Test(expected = IllegalStateException.class)
- public void testFindDetailsNoMappingStored2() throws Exception {
- final long natId = 0;
- final long entryId = 12;
- final SnatStaticMappingDetails details = getDetails(entryId, "192.168.1.5", "17.14.4.6");
- final List<SnatStaticMappingDetails> someDetails = Lists.newArrayList(details);
-
- when(mappingCtx.read(MappingEntryContext.getTableId(natId)))
- .thenReturn(Optional.of(new MappingTableBuilder().setMappingEntry(Collections.emptyList()).build()));
-
- ctx.findDetails(someDetails, natId, entryId, mappingCtx);
- }
-
- @Test
- public void testGetArtificialIndex() throws Exception {
- final long natId = 0;
- final long entryId = 0;
- final MappingEntry entry = getEntry(entryId, "192.168.1.5", "17.14.4.6");
- final long entryId2 = 55;
- final MappingEntry entry2 = getEntry(entryId2, "192.168.1.6", "17.14.4.7");
- final long entryId3 = 18954;
- final MappingEntry entry3 = getEntry(entryId3, "192.168.1.7", "17.14.4.8");
- final long entryId4 = 18955;
- final MappingEntry entry4 = getEntry(entryId4, "192.168.1.8", "17.14.4.9");
-
- final long newEntryId = 18956;
- final MappingEntry newEntry = getEntry(newEntryId, "192.168.1.99", "17.14.4.99");
- final SnatStaticMappingDetails newDetails = getDetails(newEntryId, "192.168.1.99", "17.14.4.99");
- when(mappingCtx.read(MappingEntryContext.getId(natId, MappingEntryContext.entryToKey(newEntry))))
- .thenReturn(Optional.absent());
-
- when(mappingCtx.read(MappingEntryContext.getTableId(natId)))
- .thenReturn(Optional.of(new MappingTableBuilder()
- .setMappingEntry(Lists.newArrayList(
- MappingEntryContext.toCtxMapEntry(entry, entryId),
- MappingEntryContext.toCtxMapEntry(entry3, entryId3),
- MappingEntryContext.toCtxMapEntry(entry4, entryId4),
- MappingEntryContext.toCtxMapEntry(entry2, entryId2)))
- .build()));
-
- assertFalse(ctx.getStoredIndex(natId, newEntry, mappingCtx).isPresent());
- assertEquals(newEntryId, ctx.getStoredOrArtificialIndex(natId, newDetails, mappingCtx));
- }
-
- private SnatStaticMappingDetails getDetails(final long vrfId, final String localIp, final String externIp) {
- final SnatStaticMappingDetails snatStaticMappingDetails = new SnatStaticMappingDetails();
- snatStaticMappingDetails.vrfId = (int) vrfId;
- snatStaticMappingDetails.addrOnly = 1;
- snatStaticMappingDetails.isIp4 = 1;
- snatStaticMappingDetails.localIpAddress = ipv4AddressNoZoneToArray(localIp);
- snatStaticMappingDetails.externalIpAddress = ipv4AddressNoZoneToArray(externIp);
- return snatStaticMappingDetails;
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testAddExisting() throws Exception {
- final long natId = 7;
- final long entryId = 99;
- final MappingEntry entry = getEntry(natId, "192.168.1.5", "17.14.4.6");
- final org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.nat.context.rev161214.mapping.entry.context.attributes.nat.mapping.entry.context.nat.instance.mapping.table.MappingEntry
- data = MappingEntryContext.toCtxMapEntry(entry, entryId);
- when(mappingCtx.read(any(InstanceIdentifier.class))).thenReturn(Optional.of(data));
-
- ctx.addEntry(natId, entryId, entry, mappingCtx);
- }
-
- private static MappingEntry getEntry(final long id, final String longernalIpv4, final String externalIpv4) {
- return new MappingEntryBuilder()
- .setKey(new MappingEntryKey(id))
- .setType(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.MappingEntry.Type.Static)
- .setInternalSrcAddress(new IpAddress(new Ipv4Address(longernalIpv4)))
- .setExternalSrcAddress(new Ipv4Address(externalIpv4))
- .build();
- }
-} \ No newline at end of file
diff --git a/nat/nat2vpp/src/test/resources/nat.json b/nat/nat2vpp/src/test/resources/nat.json
deleted file mode 100644
index c7d9afeb3..000000000
--- a/nat/nat2vpp/src/test/resources/nat.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "enabled": "true"
-} \ No newline at end of file
diff --git a/nat/pom.xml b/nat/pom.xml
deleted file mode 100644
index 94d035d02..000000000
--- a/nat/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>honeycomb-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../common/honeycomb-parent</relativePath>
- </parent>
-
- <groupId>io.fd.honeycomb.nat</groupId>
- <artifactId>nat-aggregator</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <name>nat-aggregator</name>
- <packaging>pom</packaging>
- <modelVersion>4.0.0</modelVersion>
-
- <modules>
- <module>nat-api</module>
- <module>nat2vpp</module>
- </modules>
-
- <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/nat/postman_rest_collection.json b/nat/postman_rest_collection.json
deleted file mode 100644
index 348d60338..000000000
--- a/nat/postman_rest_collection.json
+++ /dev/null
@@ -1,222 +0,0 @@
-{
- "id": "f9258895-49e9-596f-d413-698cbcadfbde",
- "name": "Honeycomb NAT RESTCONF calls",
- "description": "Common management operations for Honeycomb + VPP + SNAT plugin",
- "order": [
- "d2961af7-47f7-8960-1b00-f5dcd2beafb9",
- "c00f25d2-f194-2e90-30e5-ca31e8fbd630",
- "1ffc71e4-9d1e-0c99-7901-605ac8e364b6",
- "f3a7e1b5-c1d0-ab2f-3cef-3c902f8e72d5"
- ],
- "folders": [
- {
- "id": "ce93ade0-47c3-a82d-a768-058a2e18e2bb",
- "name": "1:1 static",
- "description": "",
- "order": [
- "bca19675-d674-0cde-8639-df3d2ecbfd27",
- "153f5720-fafc-22e6-6282-cf9e18226dbc",
- "830c4ab3-2e48-5654-8aa5-2d2f9eed84b4",
- "2c53651a-e31c-24da-122e-c0ce65544c8e",
- "b54693d5-9226-1c27-77b2-8b1313da2e80"
- ],
- "owner": "45557",
- "collectionId": "f9258895-49e9-596f-d413-698cbcadfbde"
- }
- ],
- "timestamp": 1475147449190,
- "owner": "45557",
- "public": false,
- "published": false,
- "requests": [
- {
- "id": "153f5720-fafc-22e6-6282-cf9e18226dbc",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/naming-context:contexts",
- "pathVariables": {},
- "preRequestScript": "",
- "method": "GET",
- "collectionId": "f9258895-49e9-596f-d413-698cbcadfbde",
- "data": [],
- "dataMode": "raw",
- "name": "Get NAT context -context",
- "description": "Read nat context ",
- "descriptionFormat": "html",
- "time": 1475678940763,
- "version": 2,
- "responses": [],
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "folder": "ce93ade0-47c3-a82d-a768-058a2e18e2bb",
- "rawModeData": "{\r\n \r\n \"inbound\" : {}\r\n \r\n}"
- },
- {
- "id": "1ffc71e4-9d1e-0c99-7901-605ac8e364b6",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/interface-nat:nat/outbound",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1475154424741,
- "name": "Set NAT outbound for ifc - cfg",
- "description": "Setting intarface NAT outbound feature\n\nCLI: set interface snat in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT",
- "collectionId": "f9258895-49e9-596f-d413-698cbcadfbde",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"outbound\" : {}\r\n \r\n}"
- },
- {
- "id": "2c53651a-e31c-24da-122e-c0ce65544c8e",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-nat:nat-config",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1475678997603,
- "name": "Get NAT - config",
- "description": "Read nat-state",
- "collectionId": "f9258895-49e9-596f-d413-698cbcadfbde",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"inbound\" : {}\r\n \r\n}"
- },
- {
- "id": "830c4ab3-2e48-5654-8aa5-2d2f9eed84b4",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/ietf-nat:nat-state",
- "pathVariables": {},
- "preRequestScript": "",
- "method": "GET",
- "collectionId": "f9258895-49e9-596f-d413-698cbcadfbde",
- "data": [],
- "dataMode": "raw",
- "name": "Get NAT -state",
- "description": "Read nat-state\n\nCLI: show snat [detail|verbose]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT",
- "descriptionFormat": "html",
- "time": 1475677867416,
- "version": 2,
- "responses": [],
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "folder": "ce93ade0-47c3-a82d-a768-058a2e18e2bb",
- "rawModeData": "{\r\n \r\n \"inbound\" : {}\r\n \r\n}"
- },
- {
- "id": "b54693d5-9226-1c27-77b2-8b1313da2e80",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-nat:nat-config/nat-instances/nat-instance/0/mapping-table/mapping-entry/1/",
- "pathVariables": {},
- "preRequestScript": "",
- "method": "DELETE",
- "collectionId": "f9258895-49e9-596f-d413-698cbcadfbde",
- "data": [],
- "dataMode": "raw",
- "name": "Delete SNAT 1:1 static entry IPv4 -cfg",
- "description": "",
- "descriptionFormat": "html",
- "time": 1475761660317,
- "version": 2,
- "responses": [],
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "folder": "ce93ade0-47c3-a82d-a768-058a2e18e2bb",
- "rawModeData": "{\r\n\t\"mapping-entry\" : {\r\n\t\t\"index\": 1,\r\n\t\t\"type\": \"static\",\r\n\t\t\"internal-src-address\": \"192.168.1.87\",\r\n\t\t\"external-src-address\": \"45.1.5.7\"\r\n\t}\r\n}"
- },
- {
- "id": "bca19675-d674-0cde-8639-df3d2ecbfd27",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-nat:nat-config/nat-instances/nat-instance/0/mapping-table/mapping-entry/1/",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1475758450889,
- "name": "Add SNAT 1:1 static entry IPv4 -cfg",
- "description": "CLI: snat add static mapping local 10.0.0.3 external 4.4.4.4\n\nMore information: https://wiki.fd.io/view/VPP/SNAT",
- "collectionId": "f9258895-49e9-596f-d413-698cbcadfbde",
- "responses": [],
- "rawModeData": "{\r\n\t\"mapping-entry\" : {\r\n\t\t\"index\": 1,\r\n\t\t\"type\": \"static\",\r\n\t\t\"internal-src-address\": \"192.168.1.87\",\r\n\t\t\"external-src-address\": \"45.1.5.7\"\r\n\t}\r\n}"
- },
- {
- "id": "c00f25d2-f194-2e90-30e5-ca31e8fbd630",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/interface-nat:nat/inbound",
- "pathVariables": {},
- "preRequestScript": "",
- "method": "DELETE",
- "collectionId": "f9258895-49e9-596f-d413-698cbcadfbde",
- "data": [],
- "dataMode": "raw",
- "name": "Disable NAT inbound for ifc - cfg",
- "description": "Unsetting intarface NAT inbound feature\n\nCLI: set interface snat in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT",
- "descriptionFormat": "html",
- "time": 1475835912474,
- "version": 2,
- "responses": [],
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "rawModeData": "{\r\n \r\n \"inbound\" : {}\r\n \r\n}"
- },
- {
- "id": "d2961af7-47f7-8960-1b00-f5dcd2beafb9",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/interface-nat:nat/inbound",
- "pathVariables": {},
- "preRequestScript": "",
- "method": "PUT",
- "collectionId": "f9258895-49e9-596f-d413-698cbcadfbde",
- "data": [],
- "dataMode": "raw",
- "name": "Set NAT inbound for ifc - cfg",
- "description": "Setting intarface NAT inbound feature\n\nCLI: set interface snat in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT",
- "descriptionFormat": "html",
- "time": 1475154374071,
- "version": 2,
- "responses": [],
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "rawModeData": "{\r\n \r\n \"inbound\" : {}\r\n \r\n}"
- },
- {
- "id": "f3a7e1b5-c1d0-ab2f-3cef-3c902f8e72d5",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/interface-nat:nat/outbound",
- "pathVariables": {},
- "preRequestScript": "",
- "method": "DELETE",
- "collectionId": "f9258895-49e9-596f-d413-698cbcadfbde",
- "data": [],
- "dataMode": "raw",
- "name": "Disable NAT outbound for ifc - cfg",
- "description": "Unsetting intarface NAT outbound feature\n\nCLI: set interface snat in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT",
- "descriptionFormat": "html",
- "time": 1475835941689,
- "version": 2,
- "responses": [],
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "rawModeData": "{\r\n \r\n \"outbound\" : {}\r\n \r\n}"
- }
- ]
-} \ No newline at end of file
diff --git a/nsh/api/asciidoc/Readme.adoc b/nsh/api/asciidoc/Readme.adoc
deleted file mode 100644
index 4d78ad6c1..000000000
--- a/nsh/api/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= vppnsh-api
-
-Overview of vppnsh-api \ No newline at end of file
diff --git a/nsh/api/pom.xml b/nsh/api/pom.xml
deleted file mode 100644
index a6dc0416e..000000000
--- a/nsh/api/pom.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2015 Intel 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>api-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../../common/api-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.vppnsh</groupId>
- <artifactId>vppnsh-api</artifactId>
- <name>${project.artifactId}</name>
- <version>1.16.12-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>iana-if-type-2014-05-08</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-yang-types-20130715</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-interfaces</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-inet-types-2013-07-15</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>yang-ext</artifactId>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.v3po</groupId>
- <artifactId>v3po-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/nsh/api/src/main/yang/vpp-nsh.yang b/nsh/api/src/main/yang/vpp-nsh.yang
deleted file mode 100644
index d4914f4fd..000000000
--- a/nsh/api/src/main/yang/vpp-nsh.yang
+++ /dev/null
@@ -1,303 +0,0 @@
-module vpp-nsh {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:vpp:nsh";
- prefix "vpp-nsh";
-
- revision "2016-06-24" {
- description "Initial revision of vpp-nsh model";
- }
-
- import iana-if-type {
- prefix "ianaift";
- }
- import ietf-interfaces {
- prefix "if";
- }
- import ietf-yang-types {
- prefix "yang";
- }
- import ietf-inet-types {
- prefix "inet";
- }
- import yang-ext {
- prefix "ext";
- }
- import v3po {
- prefix "v3po";
- }
- /*
- * Defines the supported next protocols that can be used for
- * NSH next-protocol field.
- */
- identity next-protocol {
- description "Base identity from which all nsh next protocols
- are derived from";
- }
-
- identity ipv4 {
- base next-protocol;
- description
- "Support ipv4 to act as next protocol";
- }
-
- identity ipv6 {
- base next-protocol;
- description
- "Support ipv6 to act as next protocol";
- }
-
- identity ethernet {
- base next-protocol;
- description
- "Support ethernet to act as next protocol";
- }
-
- typedef nsh-next-protocol {
- type identityref {
- base "next-protocol";
- }
- description "Identifies a specific next protocol for nsh";
- }
-
- /*
- * Defines the supported nsh header action.
- */
- identity action-type {
- description "nsh header action type";
- }
-
- identity swap {
- base "action-type";
- description "swap action type";
- }
-
- identity push {
- base "action-type";
- description "push action type";
- }
-
- identity pop {
- base "action-type";
- description "pop action type";
- }
-
- typedef nsh-action-type {
- type identityref {
- base "action-type";
- }
- }
-
- /*
- * Defines the supported encap type.
- */
- identity encap-type {
- description "encap type";
- }
-
- identity vxlan-gpe {
- base "encap-type";
- description "vxlan-gpe encap type";
- }
-
- identity vxlan {
- base "encap-type";
- description "vxlan encap type";
- }
-
- typedef nsh-encap-type {
- type identityref {
- base "encap-type";
- }
- }
-
- /*
- * Defines the supported MD-types.
- */
- identity md-type {
- description "md type";
- }
-
- identity md-type1 {
- base "md-type";
- description "nsh md-type1";
- }
-
- identity md-type2 {
- base "md-type";
- description "nsh md-type2";
- }
-
- typedef nsh-md-type {
- type identityref {
- base "md-type";
- }
- }
-
- grouping nsh-md-type1-attributes {
- leaf c1 {
- type uint32;
- }
- leaf c2 {
- type uint32;
- }
- leaf c3 {
- type uint32;
- }
- leaf c4 {
- type uint32;
- }
- }
-
- grouping nsh-md-type2-attributes {
- leaf type {
- type uint32;
- }
- }
-
- grouping nsh-entry-base-attributes {
- leaf name {
- type string;
- description "NSH Entry Name";
- }
- leaf nsp {
- type uint32 {
- range "0..16777215";
- }
- }
- leaf nsi {
- type uint8 {
- range "1..255";
- }
- }
- leaf md-type {
- type nsh-md-type;
- }
- leaf version {
- type uint8;
- }
- leaf length {
- type uint8;
- }
- leaf next-protocol {
- type nsh-next-protocol;
- }
- }
-
- grouping nsh-map-base-attributes {
- leaf name {
- type string;
- description "NSH Map Name";
- }
- leaf nsp {
- type uint32 {
- range "0..16777215";
- }
- }
- leaf nsi {
- type uint8 {
- range "1..255";
- }
- }
- leaf mapped-nsp {
- type uint32 {
- range "0..16777215";
- }
- }
- leaf mapped-nsi {
- type uint8 {
- range "1..255";
- }
- }
- leaf nsh-action {
- type nsh-action-type;
- default "swap";
- }
- leaf encap-type {
- type nsh-encap-type;
- }
- leaf encap-if-name {
- type string;
- description "Interface Name";
- }
- }
-
- container vpp-nsh {
- description
- "NSH config data";
-
- container nsh-entries {
- list nsh-entry {
- key "name";
-
- uses nsh-entry-base-attributes;
-
- description
- "nsh-entry configuration";
- }
- }
-
- container nsh-maps {
- list nsh-map {
- key "name";
-
- uses nsh-map-base-attributes;
-
- description
- "nsh-map configuration";
- }
- }
- }
-
- augment /vpp-nsh/nsh-entries/nsh-entry {
- ext:augment-identifier nsh-md-type-1-augment;
- when "/md-type = 'vpp-nsh:md-type1' ";
- uses nsh-md-type1-attributes;
- }
-
- augment /vpp-nsh/nsh-entries/nsh-entry {
- ext:augment-identifier nsh-md-type-2-augment;
- when "/md-type = 'vpp-nsh:md-type2' ";
- uses nsh-md-type2-attributes;
- }
-
- container vpp-nsh-state {
- config false;
-
- description
- "NSH operational data";
-
- container nsh-entries {
- list nsh-entry {
- key "name";
-
- uses nsh-entry-base-attributes;
-
- description
- "nsh-entry operational data";
- }
- }
-
- container nsh-maps {
- list nsh-map {
- key "name";
-
- uses nsh-map-base-attributes;
-
- description
- "nsh-map operational data";
- }
- }
- }
-
- augment /vpp-nsh-state/nsh-entries/nsh-entry {
- ext:augment-identifier nsh-md-type-1-state-augment;
- when "/md-type = 'vpp-nsh:md-type1' ";
- uses nsh-md-type1-attributes;
- }
-
- augment /vpp-nsh-state/nsh-entries/nsh-entry {
- ext:augment-identifier nsh-md-type-2-state-augment;
- when "/md-type = 'vpp-nsh:md-type2' ";
- uses nsh-md-type2-attributes;
- }
-} \ No newline at end of file
diff --git a/nsh/asciidoc/Readme.adoc b/nsh/asciidoc/Readme.adoc
deleted file mode 100644
index 1ae29484a..000000000
--- a/nsh/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,14 +0,0 @@
-= nsh
-
-This is a Honeycomb plugin providing mapping code between HC and NSH_SFC Plugin APIs.
-
-== Usage
-
-Refer to nsh_postman_collection.json for sample requests. All capabilities of NSH_SFC are demo-ed there.
-
-In order to make HC NSH plugin work, need to start vpp and load nsh_sfc plugin first.
-
-Please follow the right order to support NSH_SFC feature:
-(1). Creates vxlan-gpe interface.
-(2). Creates nsh-entry.
-(3). Creates nsh-map. \ No newline at end of file
diff --git a/nsh/impl/asciidoc/Readme.adoc b/nsh/impl/asciidoc/Readme.adoc
deleted file mode 100644
index 5c0fb4705..000000000
--- a/nsh/impl/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= vppnsh-impl
-
-Overview of vppnsh-impl \ No newline at end of file
diff --git a/nsh/impl/pom.xml b/nsh/impl/pom.xml
deleted file mode 100644
index 8cd0dabbb..000000000
--- a/nsh/impl/pom.xml
+++ /dev/null
@@ -1,130 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2015 Intel 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>impl-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../../common/impl-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.vppnsh</groupId>
- <artifactId>vppnsh-impl</artifactId>
- <name>${project.artifactId}</name>
- <version>1.16.12-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <properties>
- <guice.version>4.1.0</guice.version>
- <guice.config.version>1.2.0</guice.config.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>vppnsh-api</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- <version>${guice.version}</version>
- </dependency>
- <dependency>
- <groupId>net.jmob</groupId>
- <artifactId>guice.conf</artifactId>
- <version>${guice.config.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-multibindings</artifactId>
- <version>${guice.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-testlib</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-all</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>translate-impl</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>translate-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>notification-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>cfg-init</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.vpp</groupId>
- <artifactId>jvpp-registry</artifactId>
- <version>16.12-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>io.fd.nsh_sfc</groupId>
- <artifactId>nsh-sfc</artifactId>
- <version>16.12-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-translate-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-translate-test</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>minimal-distribution</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.v3po</groupId>
- <artifactId>v3po2vpp</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/VppNshModule.java b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/VppNshModule.java
deleted file mode 100755
index 90c826dc7..000000000
--- a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/VppNshModule.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2016 Intel 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.vppnsh.impl;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.inject.AbstractModule;
-import com.google.inject.Provider;
-import com.google.inject.Singleton;
-import com.google.inject.multibindings.Multibinder;
-import com.google.inject.name.Names;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import io.fd.honeycomb.vppnsh.impl.config.VppNshWriterFactory;
-import io.fd.honeycomb.vppnsh.impl.oper.VppNshReaderFactory;
-import io.fd.honeycomb.vppnsh.impl.util.JVppNshProvider;
-import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh;
-import io.fd.vpp.jvpp.nsh.future.FutureJVppNshFacade;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This is some glue code necessary for Honeycomb distribution to pick up the plugin classes
- */
-public final class VppNshModule extends AbstractModule {
-
- private static final Logger LOG = LoggerFactory.getLogger(VppNshModule.class);
- private final Class<? extends Provider<FutureJVppNshFacade>> jvppNshProviderClass;
-
- public VppNshModule() {
- this(JVppNshProvider.class);
- }
- @VisibleForTesting
- VppNshModule(Class<? extends Provider<FutureJVppNshFacade>> jvppNshProvider) {
- this.jvppNshProviderClass = jvppNshProvider;
- }
-
- @Override
- protected void configure() {
- LOG.debug("Installing NSH module");
-
- // Naming contexts
- bind(NamingContext.class)
- .annotatedWith(Names.named("nsh-entry-context"))
- .toInstance(new NamingContext("nsh-entry-", "nsh-entry-context"));
-
- bind(NamingContext.class)
- .annotatedWith(Names.named("nsh-map-context"))
- .toInstance(new NamingContext("nsh-map-", "nsh-map-context"));
-
- // Bind to Plugin's JVPP.
- bind(FutureJVppNsh.class).toProvider(jvppNshProviderClass).in(Singleton.class);
-
- // Below are classes picked up by HC framework
- Multibinder.newSetBinder(binder(), WriterFactory.class).addBinding().to(VppNshWriterFactory.class);
- Multibinder.newSetBinder(binder(), ReaderFactory.class).addBinding().to(VppNshReaderFactory.class);
- LOG.info("Module NSH successfully configured");
- }
-}
diff --git a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshEntryWriterCustomizer.java b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshEntryWriterCustomizer.java
deleted file mode 100755
index 795e8b9ad..000000000
--- a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshEntryWriterCustomizer.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2016 Intel 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.vppnsh.impl.config;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-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.honeycomb.vppnsh.impl.util.FutureJVppNshCustomizer;
-import io.fd.vpp.jvpp.nsh.dto.NshAddDelEntry;
-import io.fd.vpp.jvpp.nsh.dto.NshAddDelEntryReply;
-import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Ethernet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Ipv6;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.MdType1;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.NshMdType1Augment;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.entries.NshEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.entries.NshEntryKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Writer customizer responsible for NshEntry create/delete.
- */
-public class NshEntryWriterCustomizer extends FutureJVppNshCustomizer
- implements ListWriterCustomizer<NshEntry, NshEntryKey>, ByteDataTranslator, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(NshEntryWriterCustomizer.class);
- private final NamingContext nshEntryContext;
-
- public NshEntryWriterCustomizer(@Nonnull final FutureJVppNsh futureJVppNsh,
- @Nonnull final NamingContext nshEntryContext) {
- super(futureJVppNsh);
- this.nshEntryContext = checkNotNull(nshEntryContext, "nshEntryContext should not be null");
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<NshEntry> id,
- @Nonnull final NshEntry dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("Creating nsh entry: iid={} dataAfter={}", id, dataAfter);
- final int newEntryIndex =
- nshAddDelEntry(true, id, dataAfter, ~0 /* value not present */, writeContext.getMappingContext());
- // Add nsh entry name <-> vpp index mapping to the naming context:
- nshEntryContext.addName(newEntryIndex, dataAfter.getName(), writeContext.getMappingContext());
- LOG.debug("Successfully created nsh entry(id={]): iid={} dataAfter={}", newEntryIndex, id, dataAfter);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<NshEntry> id,
- @Nonnull final NshEntry dataBefore, @Nonnull final NshEntry dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- throw new UnsupportedOperationException("Nsh entry update is not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<NshEntry> id,
- @Nonnull final NshEntry dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- LOG.debug("Removing nsh entry: iid={} dataBefore={}", id, dataBefore);
- final String entryName = dataBefore.getName();
- checkState(nshEntryContext.containsIndex(entryName, writeContext.getMappingContext()),
- "Removing nsh entry {}, but index could not be found in the nsh entry context", entryName);
-
- final int entryIndex = nshEntryContext.getIndex(entryName, writeContext.getMappingContext());
- nshAddDelEntry(false, id, dataBefore, entryIndex, writeContext.getMappingContext());
-
- // Remove deleted interface from interface context:
- nshEntryContext.removeName(dataBefore.getName(), writeContext.getMappingContext());
- LOG.debug("Successfully removed nsh entry(id={]): iid={} dataAfter={}", entryIndex, id, dataBefore);
- }
-
- private int nshAddDelEntry(final boolean isAdd, @Nonnull final InstanceIdentifier<NshEntry> id,
- @Nonnull final NshEntry entry, final int entryId, final MappingContext ctx)
- throws WriteFailedException {
- final CompletionStage<NshAddDelEntryReply> createNshEntryReplyCompletionStage =
- getFutureJVppNsh().nshAddDelEntry(getNshAddDelEntryRequest(isAdd, entryId, entry, ctx));
-
- final NshAddDelEntryReply reply =
- getReplyForWrite(createNshEntryReplyCompletionStage.toCompletableFuture(), id);
- return reply.entryIndex;
-
- }
-
- private void getNshEntryMdType1Request(@Nonnull final NshEntry entry,
- @Nonnull NshAddDelEntry request) {
- final NshMdType1Augment nshMdType1Augment = entry.getAugmentation(NshMdType1Augment.class);
- if (nshMdType1Augment != null) {
- request.c1 = (int) nshMdType1Augment.getC1().longValue();
- request.c2 = (int) nshMdType1Augment.getC2().longValue();
- request.c3 = (int) nshMdType1Augment.getC3().longValue();
- request.c4 = (int) nshMdType1Augment.getC4().longValue();
- }
- }
-
- private NshAddDelEntry getNshAddDelEntryRequest(final boolean isAdd, final int entryIndex,
- @Nonnull final NshEntry entry,
- @Nonnull final MappingContext ctx) {
- final NshAddDelEntry request = new NshAddDelEntry();
- request.isAdd = booleanToByte(isAdd);
-
- request.verOC = (byte) entry.getVersion().shortValue();
- request.length = (byte) entry.getLength().intValue();
- if (entry.getNextProtocol() == Ipv4.class) {
- request.nextProtocol = 1;
- } else if (entry.getNextProtocol() == Ipv6.class) {
- request.nextProtocol = 2;
- } else if (entry.getNextProtocol() == Ethernet.class) {
- request.nextProtocol = 3;
- } else {
- request.nextProtocol = 0;
- }
-
- if (entry.getMdType() == MdType1.class) {
- request.mdType = 1;
- getNshEntryMdType1Request(entry, request);
- } else if (entry.getMdType() == MdType1.class) {
- request.mdType = 2;
- } else {
- request.mdType = 0;
- }
-
- request.nspNsi = (entry.getNsp().intValue() << 8) | entry.getNsi();
-
- return request;
- }
-}
diff --git a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshMapWriterCustomizer.java b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshMapWriterCustomizer.java
deleted file mode 100755
index 701475936..000000000
--- a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshMapWriterCustomizer.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2016 Intel 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.vppnsh.impl.config;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-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.honeycomb.vppnsh.impl.util.FutureJVppNshCustomizer;
-import io.fd.vpp.jvpp.nsh.dto.NshAddDelMap;
-import io.fd.vpp.jvpp.nsh.dto.NshAddDelMapReply;
-import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Pop;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Push;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Swap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.VxlanGpe;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMapKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Writer customizer responsible for NshMap create/delete.
- */
-public class NshMapWriterCustomizer extends FutureJVppNshCustomizer
- implements ListWriterCustomizer<NshMap, NshMapKey>, ByteDataTranslator, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(NshMapWriterCustomizer.class);
- private final NamingContext nshMapContext;
- private final NamingContext interfaceContext;
-
- public NshMapWriterCustomizer(@Nonnull final FutureJVppNsh futureJVppNsh,
- @Nonnull final NamingContext nshMapContext,
- @Nonnull final NamingContext interfaceContext) {
- super(futureJVppNsh);
- this.nshMapContext = checkNotNull(nshMapContext, "nshMapContext should not be null");
- this.interfaceContext = checkNotNull(interfaceContext, "interfaceContext should not be null");
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<NshMap> id,
- @Nonnull final NshMap dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("Creating nsh map: iid={} dataAfter={}", id, dataAfter);
- final int newMapIndex =
- nshAddDelMap(true, id, dataAfter, ~0 /* value not present */, writeContext.getMappingContext());
-
- // Add nsh map name <-> vpp index mapping to the naming context:
- nshMapContext.addName(newMapIndex, dataAfter.getName(), writeContext.getMappingContext());
- LOG.debug("Successfully created nsh map(id={]): iid={} dataAfter={}", newMapIndex, id, dataAfter);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<NshMap> id,
- @Nonnull final NshMap dataBefore, @Nonnull final NshMap dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- throw new UnsupportedOperationException("Nsh map update is not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<NshMap> id,
- @Nonnull final NshMap dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- LOG.debug("Removing nsh map: iid={} dataBefore={}", id, dataBefore);
- final String mapName = dataBefore.getName();
- checkState(nshMapContext.containsIndex(mapName, writeContext.getMappingContext()),
- "Removing nsh map {}, but index could not be found in the nsh map context", mapName);
-
- final int mapIndex = nshMapContext.getIndex(mapName, writeContext.getMappingContext());
- nshAddDelMap(false, id, dataBefore, mapIndex, writeContext.getMappingContext());
-
- // Remove deleted interface from interface context:
- nshMapContext.removeName(dataBefore.getName(), writeContext.getMappingContext());
- LOG.debug("Successfully removed nsh map(id={]): iid={} dataAfter={}", mapIndex, id, dataBefore);
- }
-
- private int nshAddDelMap(final boolean isAdd, @Nonnull final InstanceIdentifier<NshMap> id,
- @Nonnull final NshMap map, final int mapId, final MappingContext ctx)
- throws WriteFailedException {
- final CompletionStage<NshAddDelMapReply> createNshMapReplyCompletionStage =
- getFutureJVppNsh().nshAddDelMap(getNshAddDelMapRequest(isAdd, mapId, map, ctx));
-
- final NshAddDelMapReply reply = getReplyForWrite(createNshMapReplyCompletionStage.toCompletableFuture(), id);
- return reply.mapIndex;
-
- }
-
- private NshAddDelMap getNshAddDelMapRequest(final boolean isAdd, final int mapIndex,
- @Nonnull final NshMap map,
- @Nonnull final MappingContext ctx) {
- final NshAddDelMap request = new NshAddDelMap();
- request.isAdd = booleanToByte(isAdd);
-
- request.nspNsi = (map.getNsp().intValue() << 8) | map.getNsi();
- request.mappedNspNsi = (map.getMappedNsp().intValue() << 8) | map.getMappedNsi();
-
- if (map.getNshAction() == Swap.class) {
- request.nshAction = 0;
- } else if (map.getNshAction() == Push.class) {
- request.nshAction = 1;
- } else if (map.getNshAction() == Pop.class) {
- request.nshAction = 2;
- }
-
- if (map.getEncapType() == VxlanGpe.class) {
- request.nextNode = 2;
- }
-
- checkState(interfaceContext.containsIndex(map.getEncapIfName(), ctx),
- "Mapping does not contains mapping for provider interface Name ".concat(map.getEncapIfName()));
- request.swIfIndex = interfaceContext.getIndex(map.getEncapIfName(), ctx);
-
- return request;
- }
-}
diff --git a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/VppNshWriterFactory.java b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/VppNshWriterFactory.java
deleted file mode 100755
index 61c442e18..000000000
--- a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/VppNshWriterFactory.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2016 Intel 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.vppnsh.impl.config;
-
-import com.google.common.collect.Sets;
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import io.fd.honeycomb.translate.impl.write.GenericListWriter;
-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.nsh.future.FutureJVppNsh;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.NshMdType1Augment;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.NshMdType2Augment;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.VppNsh;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.NshEntries;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.NshMaps;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.entries.NshEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMap;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class VppNshWriterFactory implements WriterFactory {
-
- @Nonnull
- private final FutureJVppNsh jvppNsh;
- private final NamingContext nshEntryContext;
- private final NamingContext nshMapContext;
- private final NamingContext interfaceContext;
-
- @Inject
- public VppNshWriterFactory(@Nonnull final FutureJVppNsh jvppNsh,
- @Named("nsh-entry-context") @Nonnull final NamingContext nshEntryContext,
- @Named("nsh-map-context") @Nonnull final NamingContext nshMapContext,
- @Named("interface-context") @Nonnull final NamingContext interfaceContext) {
- this.jvppNsh = jvppNsh;
- this.nshEntryContext = nshEntryContext;
- this.nshMapContext = nshMapContext;
- this.interfaceContext = interfaceContext;
- }
-
- @Override
- public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
- // WriterFactory is intended for registering Writers into HC framework
- // Writers handle ONLY config (config "true") data coming from upper layers and propagate them into lower layer/device
- // they are triggered when RESTCONF PUT/POST on config is invoked or when NETCONF edit-config + commit operation is executed
-
- // VppNsh has no handlers
- // NshEntries has no handlers
- // NshEntry =
- final InstanceIdentifier<NshEntries> nshEntriesId = InstanceIdentifier.create(VppNsh.class).child(NshEntries.class);
- final InstanceIdentifier<NshEntry> nshEntryId = nshEntriesId.child(NshEntry.class);
- registry.subtreeAdd(
- Sets.newHashSet(
- InstanceIdentifier.create(NshEntry.class).augmentation(NshMdType1Augment.class),
- InstanceIdentifier.create(NshEntry.class).augmentation(NshMdType2Augment.class)),
- new GenericListWriter<>(nshEntryId, new NshEntryWriterCustomizer(jvppNsh, nshEntryContext)));
-
- // VppNsh has no handlers
- // NshMaps has no handlers
- // NshMap =
- final InstanceIdentifier<NshMap> nshMapId =
- InstanceIdentifier.create(VppNsh.class).child(NshMaps.class).child(NshMap.class);
- registry.add(new GenericListWriter<>(nshMapId, new NshMapWriterCustomizer(jvppNsh, nshMapContext, interfaceContext)));
-
- }
-}
diff --git a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizer.java b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizer.java
deleted file mode 100755
index 066fb103d..000000000
--- a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizer.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright (c) 2016 Intel 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.vppnsh.impl.oper;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vppnsh.impl.util.FutureJVppNshCustomizer;
-import io.fd.vpp.jvpp.nsh.dto.NshEntryDetails;
-import io.fd.vpp.jvpp.nsh.dto.NshEntryDetailsReplyDump;
-import io.fd.vpp.jvpp.nsh.dto.NshEntryDump;
-import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Ethernet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Ipv6;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.MdType1;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.NshMdType1StateAugment;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.NshMdType1StateAugmentBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.VppNsh;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.NshEntriesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.nsh.entries.NshEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.nsh.entries.NshEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.nsh.entries.NshEntryKey;
-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;
-
-/**
- * Reader customizer responsible for nsh entry read.<br> to VPP.
- */
-public class NshEntryReaderCustomizer extends FutureJVppNshCustomizer
- implements InitializingListReaderCustomizer<NshEntry, NshEntryKey, NshEntryBuilder>, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(NshEntryReaderCustomizer.class);
- private final NamingContext nshEntryContext;
-
- public NshEntryReaderCustomizer(@Nonnull final FutureJVppNsh futureJVppNsh,
- @Nonnull final NamingContext nshEntryContext) {
- super(futureJVppNsh);
- this.nshEntryContext = checkNotNull(nshEntryContext, "nshEntryContext should not be null");
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder,
- @Nonnull final List<NshEntry> readData) {
- ((NshEntriesBuilder) builder).setNshEntry(readData);
- }
-
- @Nonnull
- @Override
- public NshEntryBuilder getBuilder(@Nonnull final InstanceIdentifier<NshEntry> id) {
- return new NshEntryBuilder();
- }
-
- private void setNshEntryMdType1Augment(@Nonnull final NshEntryBuilder builder,
- @Nonnull NshEntryDetails nshEntryDetails) {
- final NshMdType1StateAugmentBuilder augmentBuilder = new NshMdType1StateAugmentBuilder();
- augmentBuilder.setC1((long) nshEntryDetails.c1);
- augmentBuilder.setC2((long) nshEntryDetails.c2);
- augmentBuilder.setC3((long) nshEntryDetails.c3);
- augmentBuilder.setC4((long) nshEntryDetails.c4);
-
- builder.addAugmentation(NshMdType1StateAugment.class, augmentBuilder.build());
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<NshEntry> id,
- @Nonnull final NshEntryBuilder builder, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading attributes for nsh entry: {}", id);
- final NshEntryKey key = id.firstKeyOf(NshEntry.class);
- checkArgument(key != null, "could not find NshEntry key in {}", id);
- final NshEntryDump request = new NshEntryDump();
-
- final String entryName = key.getName();
- if (!nshEntryContext.containsIndex(entryName, ctx.getMappingContext())) {
- LOG.debug("Could not find nsh entry {} in the naming context", entryName);
- return;
- }
- request.entryIndex = nshEntryContext.getIndex(entryName, ctx.getMappingContext());
-
- final CompletionStage<NshEntryDetailsReplyDump> nshEntryDetailsReplyDumpCompletionStage =
- getFutureJVppNsh().nshEntryDump(request);
- final NshEntryDetailsReplyDump reply =
- getReplyForRead(nshEntryDetailsReplyDumpCompletionStage.toCompletableFuture(), id);
-
- if (reply == null || reply.nshEntryDetails == null || reply.nshEntryDetails.isEmpty()) {
- LOG.debug("Has no Nsh Entry {} in VPP. ", key.getName());
- return;
- }
-
- LOG.trace("Nsh Entry : {} attributes returned from VPP: {}", key.getName(), reply);
-
- final NshEntryDetails nshEntryDetails = reply.nshEntryDetails.get(0);
- builder.setName(entryName);
- builder.setKey(key);
- builder.setVersion((short) nshEntryDetails.verOC);
- builder.setLength((short) nshEntryDetails.length);
-
- switch (nshEntryDetails.nextProtocol) {
- case 1:
- builder.setNextProtocol(Ipv4.class);
- break;
- case 2:
- builder.setNextProtocol(Ipv6.class);
- break;
- case 3:
- builder.setNextProtocol(Ethernet.class);
- break;
- default:
- LOG.trace("Unsupported next protocol for nsh entry: {}", nshEntryDetails.nextProtocol);
- return;
- }
-
- switch (nshEntryDetails.mdType) {
- case 1: {
- builder.setMdType(MdType1.class);
- setNshEntryMdType1Augment(builder, nshEntryDetails);
- break;
- }
- case 2: {
- builder.setMdType(MdType1.class);
- break;
- }
- default:
- LOG.trace("Unsupported Mdtype for nsh entry: {}", nshEntryDetails.mdType);
- return;
- }
-
- builder.setNsp((long) ((nshEntryDetails.nspNsi >> 8) & 0xFFFFFF));
- builder.setNsi((short) (nshEntryDetails.nspNsi & 0xFF));
-
- if (LOG.isTraceEnabled()) {
- LOG.trace("Attributes for nsh entry {} successfully read: {}", id, builder.build());
- }
- }
-
- @Nonnull
- @Override
- public List<NshEntryKey> getAllIds(@Nonnull final InstanceIdentifier<NshEntry> id,
- @Nonnull final ReadContext context) throws ReadFailedException {
- LOG.debug("Reading list of keys for nsh entry: {}", id);
-
- final NshEntryDump request = new NshEntryDump();
- request.entryIndex = -1; // dump call
-
- NshEntryDetailsReplyDump reply;
- try {
- reply = getFutureJVppNsh().nshEntryDump(request).toCompletableFuture().get();
- } catch (Exception e) {
- throw new IllegalStateException("Nsh Entry dump failed", e);
- }
-
- if (reply == null || reply.nshEntryDetails == null) {
- return Collections.emptyList();
- }
-
- final int nIdsLength = reply.nshEntryDetails.size();
- LOG.debug("vppstate.NshEntryCustomizer.getAllIds: nIds.length={}", nIdsLength);
- if (nIdsLength == 0) {
- return Collections.emptyList();
- }
-
- final List<NshEntryKey> allIds = new ArrayList<>(nIdsLength);
- for (NshEntryDetails detail : reply.nshEntryDetails) {
- final String nshName = nshEntryContext.getName(detail.entryIndex, context.getMappingContext());
- LOG.debug("vppstate.NshEntryCustomizer.getAllIds: nName={}", nshName);
- allIds.add(new NshEntryKey(nshName));
- }
-
- return allIds;
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.entries.NshEntry> init(
- @Nonnull final InstanceIdentifier<NshEntry> id, @Nonnull final NshEntry readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(
- InstanceIdentifier.create(VppNsh.class).child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.NshEntries.class).child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.entries.NshEntry.class,
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.entries.NshEntryKey(id.firstKeyOf(NshEntry.class).getName())),
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.entries.NshEntryBuilder(readValue)
- .setName(readValue.getName())
- .build());
- }
-}
diff --git a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshMapReaderCustomizer.java b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshMapReaderCustomizer.java
deleted file mode 100755
index 75ff21f27..000000000
--- a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshMapReaderCustomizer.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright (c) 2016 Intel 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.vppnsh.impl.oper;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vppnsh.impl.util.FutureJVppNshCustomizer;
-import io.fd.vpp.jvpp.nsh.dto.NshMapDetails;
-import io.fd.vpp.jvpp.nsh.dto.NshMapDetailsReplyDump;
-import io.fd.vpp.jvpp.nsh.dto.NshMapDump;
-import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Pop;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Push;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Swap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.VppNsh;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.VxlanGpe;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.NshMapsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.nsh.maps.NshMap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.nsh.maps.NshMapBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.nsh.maps.NshMapKey;
-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;
-
-/**
- * Reader customizer responsible for nsh map read.<br> to VPP.
- */
-public class NshMapReaderCustomizer extends FutureJVppNshCustomizer
- implements InitializingListReaderCustomizer<NshMap, NshMapKey, NshMapBuilder>, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(NshMapReaderCustomizer.class);
- private final NamingContext nshMapContext;
- private final NamingContext interfaceContext;
-
- public NshMapReaderCustomizer(@Nonnull final FutureJVppNsh futureJVppNsh,
- @Nonnull final NamingContext nshMapContext,
- @Nonnull final NamingContext interfaceContext) {
- super(futureJVppNsh);
- this.nshMapContext = checkNotNull(nshMapContext, "nshMapContext should not be null");
- this.interfaceContext = checkNotNull(interfaceContext, "interfaceContext should not be null");
- }
-
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder,
- @Nonnull final List<NshMap> readData) {
- ((NshMapsBuilder) builder).setNshMap(readData);
- }
-
- @Nonnull
- @Override
- public NshMapBuilder getBuilder(@Nonnull final InstanceIdentifier<NshMap> id) {
- return new NshMapBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<NshMap> id,
- @Nonnull final NshMapBuilder builder, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading attributes for nsh map: {}", id);
- final NshMapKey key = id.firstKeyOf(NshMap.class);
- checkArgument(key != null, "could not find NshMap key in {}", id);
- final NshMapDump request = new NshMapDump();
-
- final String mapName = key.getName();
- if (!nshMapContext.containsIndex(mapName, ctx.getMappingContext())) {
- LOG.debug("Could not find nsh map {} in the naming context", mapName);
- return;
- }
- request.mapIndex = nshMapContext.getIndex(mapName, ctx.getMappingContext());
-
- final CompletionStage<NshMapDetailsReplyDump> nshMapDetailsReplyDumpCompletionStage =
- getFutureJVppNsh().nshMapDump(request);
- final NshMapDetailsReplyDump reply =
- getReplyForRead(nshMapDetailsReplyDumpCompletionStage.toCompletableFuture(), id);
-
- if (reply == null || reply.nshMapDetails == null || reply.nshMapDetails.isEmpty()) {
- LOG.debug("Has no Nsh Map {} in VPP. ", key.getName());
- return;
- }
-
- LOG.trace("Nsh Map : {} attributes returned from VPP: {}", key.getName(), reply);
-
- final NshMapDetails nshMapDetails = reply.nshMapDetails.get(0);
- builder.setName(mapName);
- builder.setKey(key);
-
- builder.setNsp((long) ((nshMapDetails.nspNsi >> 8) & 0xFFFFFF));
- builder.setNsi((short) (nshMapDetails.nspNsi & 0xFF));
-
- builder.setMappedNsp((long) ((nshMapDetails.mappedNspNsi >> 8) & 0xFFFFFF));
- builder.setMappedNsi((short) (nshMapDetails.mappedNspNsi & 0xFF));
-
- switch (nshMapDetails.nshAction) {
- case 0:
- builder.setNshAction(Swap.class);
- break;
- case 1:
- builder.setNshAction(Push.class);
- break;
- case 2:
- builder.setNshAction(Pop.class);
- break;
- default:
- LOG.trace("Unsupported nsh_action for nsh map: {}", nshMapDetails.nshAction);
- return;
- }
-
- switch (nshMapDetails.nextNode) {
- case 2:
- builder.setEncapType(VxlanGpe.class);
- break;
- default:
- LOG.trace("Unsupported encap type for nsh map: {}", nshMapDetails.nextNode);
- return;
- }
-
- checkState(interfaceContext.containsName(nshMapDetails.swIfIndex, ctx.getMappingContext()),
- "Mapping does not contains mapping for provider interface Index ");
- final String interfaceName = interfaceContext.getName(nshMapDetails.swIfIndex, ctx.getMappingContext());
- builder.setEncapIfName(interfaceName);
-
- if (LOG.isTraceEnabled()) {
- LOG.trace("Attributes for nsh map {} successfully read: {}", id, builder.build());
- }
- }
-
- @Nonnull
- @Override
- public List<NshMapKey> getAllIds(@Nonnull final InstanceIdentifier<NshMap> id,
- @Nonnull final ReadContext context) throws ReadFailedException {
- LOG.debug("Reading list of keys for nsh map: {}", id);
-
- final NshMapDump request = new NshMapDump();
- request.mapIndex = -1; // dump call
-
- NshMapDetailsReplyDump reply;
- try {
- reply = getFutureJVppNsh().nshMapDump(request).toCompletableFuture().get();
- } catch (Exception e) {
- throw new IllegalStateException("Nsh Map dump failed", e);
- }
-
- if (reply == null || reply.nshMapDetails == null) {
- return Collections.emptyList();
- }
-
- final int nIdsLength = reply.nshMapDetails.size();
- LOG.debug("vppstate.NshMapCustomizer.getAllIds: nIds.length={}", nIdsLength);
- if (nIdsLength == 0) {
- return Collections.emptyList();
- }
-
- final List<NshMapKey> allIds = new ArrayList<>(nIdsLength);
- for (NshMapDetails detail : reply.nshMapDetails) {
- final String nshName = nshMapContext.getName(detail.mapIndex, context.getMappingContext());
- LOG.debug("vppstate.NshMapCustomizer.getAllIds: nName={}", nshName);
- allIds.add(new NshMapKey(nshName));
- }
-
- return allIds;
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMap> init(
- @Nonnull final InstanceIdentifier<NshMap> id,
- @Nonnull final NshMap readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(
- InstanceIdentifier.create(VppNsh.class).child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.NshMaps.class).child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMap.class,
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMapKey(id.firstKeyOf(NshMap.class).getName())),
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMapBuilder(readValue).setName(readValue.getName()).build());
- }
-}
diff --git a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/VppNshReaderFactory.java b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/VppNshReaderFactory.java
deleted file mode 100755
index 5eb54669a..000000000
--- a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/VppNshReaderFactory.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2016 Intel 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.vppnsh.impl.oper;
-
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import io.fd.honeycomb.translate.impl.read.GenericInitListReader;
-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.nsh.future.FutureJVppNsh;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.VppNshState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.VppNshStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.NshEntries;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.NshEntriesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.NshMaps;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.NshMapsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.nsh.entries.NshEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.nsh.maps.NshMap;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class VppNshReaderFactory implements ReaderFactory {
-
- private final FutureJVppNsh jvppNsh;
- private final NamingContext nshEntryContext;
- private final NamingContext nshMapContext;
- private final NamingContext interfaceContext;
-
- @Inject
- public VppNshReaderFactory(final FutureJVppNsh jvppNsh,
- @Named("nsh-entry-context") final NamingContext nshEntryContext,
- @Named("nsh-map-context") final NamingContext nshMapContext,
- @Named("interface-context") @Nonnull final NamingContext interfaceContext) {
- this.jvppNsh = jvppNsh;
- this.nshEntryContext = nshEntryContext;
- this.nshMapContext = nshMapContext;
- this.interfaceContext = interfaceContext;
- }
- @Override
- public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
- // ReaderFactory is intended for registering Readers into HC framework
- // Readers provide ONLY operational (config "false") data straight from underlying device/layer
- // they are triggered when RESTCONF GET on operational is invoked or when NETCONF get operation is executed
-
- // VppNshState(Structural)
- final InstanceIdentifier<VppNshState> vppNshStateId = InstanceIdentifier.create(VppNshState.class);
- registry.addStructuralReader(vppNshStateId, VppNshStateBuilder.class);
-
- // NshENtries(Structural)
- final InstanceIdentifier<NshEntries> nshEntriesId = vppNshStateId.child(NshEntries.class);
- registry.addStructuralReader(nshEntriesId, NshEntriesBuilder.class);
- // NshENtry
- final InstanceIdentifier<NshEntry> nshEntryId = nshEntriesId.child(NshEntry.class);
- registry.add(new GenericInitListReader<>(nshEntryId, new NshEntryReaderCustomizer(jvppNsh, nshEntryContext)));
-
- // NshMaps(Structural)
- final InstanceIdentifier<NshMaps> nshMapsId = vppNshStateId.child(NshMaps.class);
- registry.addStructuralReader(nshMapsId, NshMapsBuilder.class);
- // NshMap
- final InstanceIdentifier<NshMap> nshMapId = nshMapsId.child(NshMap.class);
- registry.add(new GenericInitListReader<>(nshMapId, new NshMapReaderCustomizer(jvppNsh, nshMapContext, interfaceContext)));
- }
-}
diff --git a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/util/FutureJVppNshCustomizer.java b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/util/FutureJVppNshCustomizer.java
deleted file mode 100755
index f9b0b3b98..000000000
--- a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/util/FutureJVppNshCustomizer.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2016 Intel 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.vppnsh.impl.util;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh;
-import javax.annotation.Nonnull;
-
-/**
- * Abstract utility to hold the NshApi reference.
- */
-@Beta
-public abstract class FutureJVppNshCustomizer {
-
- private final FutureJVppNsh futureJVppNsh;
-
- public FutureJVppNshCustomizer(@Nonnull final FutureJVppNsh futureJVppNsh) {
- this.futureJVppNsh = Preconditions.checkNotNull(futureJVppNsh, "futureJVppNsh should not be null");
- }
-
- /**
- * Get NshApi reference
- *
- * @return NshApi reference
- */
- public FutureJVppNsh getFutureJVppNsh() {
- return futureJVppNsh;
- }
-}
diff --git a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/util/JVppNshProvider.java b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/util/JVppNshProvider.java
deleted file mode 100755
index 6778bae2a..000000000
--- a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/util/JVppNshProvider.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2016 Intel and 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.vppnsh.impl.util;
-
-import com.google.inject.Inject;
-import io.fd.honeycomb.infra.distro.ProviderTrait;
-import io.fd.vpp.jvpp.JVppRegistry;
-import io.fd.vpp.jvpp.nsh.JVppNshImpl;
-import io.fd.vpp.jvpp.nsh.future.FutureJVppNshFacade;
-import java.io.IOException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Provides future API for jvpp-nsh plugin. Must be a singleton due to shutdown hook usage.
- * Registers shutdown hook to free plugin's resources on shutdown.
- */
-public final class JVppNshProvider extends ProviderTrait<FutureJVppNshFacade> {
-
- private static final Logger LOG = LoggerFactory.getLogger(JVppNshProvider.class);
-
- @Inject
- private JVppRegistry registry;
-
- @Override
- protected FutureJVppNshFacade create() {
- try {
- final JVppNshImpl jVppNsh = new JVppNshImpl();
- // Free jvpp-nsh plugin's resources on shutdown
- Runtime.getRuntime().addShutdownHook(new Thread() {
- @Override
- public void run() {
- LOG.info("Unloading jvpp-nsh plugin");
- jVppNsh.close();
- LOG.info("Successfully unloaded jvpp-nsh plugin");
- }
- });
-
- LOG.info("Successfully loaded jvpp-nsh plugin");
- return new FutureJVppNshFacade(registry, jVppNsh);
- } catch (IOException e) {
- throw new IllegalStateException("Unable to open VPP management connection", e);
- }
- }
-}
-
diff --git a/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/VppNshModuleTest.java b/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/VppNshModuleTest.java
deleted file mode 100644
index 0da2c1bc4..000000000
--- a/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/VppNshModuleTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2016 Intel 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.vppnsh.impl;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.Matchers.empty;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import com.google.inject.Guice;
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.google.inject.name.Named;
-import com.google.inject.testing.fieldbinder.Bind;
-import com.google.inject.testing.fieldbinder.BoundFieldModule;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
-import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import io.fd.vpp.jvpp.JVppRegistry;
-import io.fd.vpp.jvpp.nsh.future.FutureJVppNshFacade;
-import java.util.HashSet;
-import java.util.Set;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-
-public class VppNshModuleTest {
-
- @Named("honeycomb-context")
- @Bind
- @Mock
- private DataBroker honeycombContext;
-
- @Named("honeycomb-initializer")
- @Bind
- @Mock
- private DataBroker honeycombInitializer;
-
- @Named("interface-context")
- @Bind
- private NamingContext interfaceContext;
-
- @Bind
- @Mock
- private JVppRegistry registry;
-
- @Inject
- private Set<ReaderFactory> readerFactories = new HashSet<>();
-
- @Inject
- private Set<WriterFactory> writerFactories = new HashSet<>();
-
- @Before
- public void setUp() throws Exception {
-
- initMocks(this);
-
- interfaceContext = new NamingContext("interface-", "interface-context");
-
- Guice.createInjector(new VppNshModule(MockJVppNshProvider.class), BoundFieldModule.of(this)).injectMembers(this);
- }
-
- @Test
- public void testReaderFactories() throws Exception {
- assertThat(readerFactories, is(not(empty())));
-
- // Test registration process (all dependencies present, topological order of readers does exist, etc.)
- final CompositeReaderRegistryBuilder registryBuilder = new CompositeReaderRegistryBuilder();
- readerFactories.forEach(factory -> factory.init(registryBuilder));
- assertNotNull(registryBuilder.build());
- }
-
- @Test
- public void testWriterFactories() throws Exception {
- assertThat(writerFactories, is(not(empty())));
-
- // Test registration process (all dependencies present, topological order of writers does exist, etc.)
- final FlatWriterRegistryBuilder registryBuilder = new FlatWriterRegistryBuilder();
- writerFactories.forEach(factory -> factory.init(registryBuilder));
- assertNotNull(registryBuilder.build());
- }
-
- private static final class MockJVppNshProvider implements Provider<FutureJVppNshFacade> {
-
- @Override
- public FutureJVppNshFacade get() {
- return mock(FutureJVppNshFacade.class);
- }
- }
-}
-
diff --git a/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/config/NshEntryWriterCustomizerTest.java b/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/config/NshEntryWriterCustomizerTest.java
deleted file mode 100644
index 23f861073..000000000
--- a/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/config/NshEntryWriterCustomizerTest.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * 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.vppnsh.impl.config;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.nsh.dto.NshAddDelEntry;
-import io.fd.vpp.jvpp.nsh.dto.NshAddDelEntryReply;
-import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Ethernet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.MdType1;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.NshMdType1Augment;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.NshMdType1AugmentBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.NshEntries;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.entries.NshEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.entries.NshEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.entries.NshEntryKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class NshEntryWriterCustomizerTest extends WriterCustomizerTest {
-
- private static final String ENTRY_CTX_NAME = "nsh-entry-instance";
- private static final int ENTRY_INDEX = 1;
- private static final String ENTRY_NAME = "entry1";
-
- @Mock
- protected FutureJVppNsh jvppNsh;
-
- private NamingContext nshContext;
-
- private NshEntryWriterCustomizer customizer;
-
- @Override
- public void setUp() throws Exception {
- nshContext = new NamingContext("nsh_entry", ENTRY_CTX_NAME);
- defineMapping(mappingContext, ENTRY_NAME, ENTRY_INDEX, ENTRY_CTX_NAME);
-
- customizer = new NshEntryWriterCustomizer(jvppNsh, nshContext);
- }
-
- private static NshEntry generateNshEntry(final String name) {
- final NshEntryBuilder builder = new NshEntryBuilder();
- builder.setName(name);
- builder.setKey(new NshEntryKey(name));
- builder.setVersion((short) 0);
- builder.setLength((short) 6);
- builder.setMdType(MdType1.class);
- builder.setNextProtocol(Ethernet.class);
- builder.setNsp(123L);
- builder.setNsi((short) 4);
-
- final NshMdType1AugmentBuilder augmentBuilder = new NshMdType1AugmentBuilder();
- augmentBuilder.setC1((long) 1);
- augmentBuilder.setC2((long) 2);
- augmentBuilder.setC3((long) 3);
- augmentBuilder.setC4((long) 4);
- builder.addAugmentation(NshMdType1Augment.class, augmentBuilder.build());
-
- return builder.build();
- }
-
- private static InstanceIdentifier<NshEntry> getNshEntryId(final String name) {
- return InstanceIdentifier.create(NshEntries.class)
- .child(NshEntry.class, new NshEntryKey(name));
- }
-
- private void whenNshAddDelEntryThenSuccess() {
- final NshAddDelEntryReply reply = new NshAddDelEntryReply();
- reply.entryIndex = ENTRY_INDEX;
- doReturn(future(reply)).when(jvppNsh).nshAddDelEntry(any(NshAddDelEntry.class));
- }
-
- private void whenNshAddDelEntryThenFailure() {
- doReturn(failedFuture()).when(jvppNsh).nshAddDelEntry(any(NshAddDelEntry.class));
- }
-
- private static NshAddDelEntry generateNshAddDelEntry(final byte isAdd) {
- final NshAddDelEntry request = new NshAddDelEntry();
- request.isAdd = isAdd;
- request.verOC = 0;
- request.length = 6;
- request.mdType = 1;
- request.nextProtocol = 3;
- request.nspNsi = 123<<8 | 4;
- request.c1 = 1;
- request.c2 = 2;
- request.c3 = 3;
- request.c4 = 4;
-
- return request;
- }
-
- @Test
- public void testCreate() throws Exception {
- final NshEntry nshEntry = generateNshEntry(ENTRY_NAME);
- final InstanceIdentifier<NshEntry> id = getNshEntryId(ENTRY_NAME);
-
- whenNshAddDelEntryThenSuccess();
-
- customizer.writeCurrentAttributes(id, nshEntry, writeContext);
-
- verify(jvppNsh).nshAddDelEntry(generateNshAddDelEntry((byte) 1));
-
- }
-
- @Test
- public void testCreateFailed() throws Exception {
- final NshEntry nshEntry = generateNshEntry(ENTRY_NAME);
- final InstanceIdentifier<NshEntry> id = getNshEntryId(ENTRY_NAME);
-
- whenNshAddDelEntryThenFailure();
-
- try {
- customizer.writeCurrentAttributes(id, nshEntry, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(jvppNsh).nshAddDelEntry(generateNshAddDelEntry((byte) 1));
-
- return;
- }
- fail("WriteFailedException.CreateFailedException was expected");
- }
-
- @Test
- public void testDelete() throws Exception {
- final NshEntry nshEntry = generateNshEntry(ENTRY_NAME);
- final InstanceIdentifier<NshEntry> id = getNshEntryId(ENTRY_NAME);
-
- whenNshAddDelEntryThenSuccess();
-
- customizer.deleteCurrentAttributes(id, nshEntry, writeContext);
-
- verify(jvppNsh).nshAddDelEntry(generateNshAddDelEntry((byte) 0));
- }
-
- @Test
- public void testDeleteFailed() throws Exception {
- final NshEntry nshEntry = generateNshEntry(ENTRY_NAME);
- final InstanceIdentifier<NshEntry> id = getNshEntryId(ENTRY_NAME);
-
- whenNshAddDelEntryThenFailure();
-
- try {
- customizer.deleteCurrentAttributes(id, nshEntry, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(jvppNsh).nshAddDelEntry(generateNshAddDelEntry((byte) 0));
- return;
- }
- fail("WriteFailedException.DeleteFailedException was expected");
-
- customizer.deleteCurrentAttributes(id, nshEntry, writeContext);
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdate() throws Exception {
- final NshEntry nshEntryBefore = generateNshEntry(ENTRY_NAME);
- final InstanceIdentifier<NshEntry> id = getNshEntryId(ENTRY_NAME);
- customizer.updateCurrentAttributes(id, nshEntryBefore, new NshEntryBuilder().build(), writeContext);
- }
-} \ No newline at end of file
diff --git a/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/config/NshMapWriterCustomizerTest.java b/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/config/NshMapWriterCustomizerTest.java
deleted file mode 100644
index 39297d427..000000000
--- a/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/config/NshMapWriterCustomizerTest.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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.vppnsh.impl.config;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.nsh.dto.NshAddDelMap;
-import io.fd.vpp.jvpp.nsh.dto.NshAddDelMapReply;
-import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Swap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.VxlanGpe;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.NshMaps;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMapBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMapKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class NshMapWriterCustomizerTest extends WriterCustomizerTest {
-
- private static final String MAP_CTX_NAME = "nsh-map-instance";
- private static final int MAP_INDEX = 1;
- private static final String MAP_NAME = "map";
-
- private static final String INT_CTX_NAME = "interface-instance";
- private static final int ITF_INDEX = 3;
- private static final String ITF_NAME = "vxlanGpeTun3";
-
- @Mock
- protected FutureJVppNsh jvppNsh;
-
- private NamingContext nshContext;
-
- private NamingContext interfaceContext;
-
- private NshMapWriterCustomizer customizer;
-
- @Override
- public void setUp() throws Exception {
- nshContext = new NamingContext("nsh_map", MAP_CTX_NAME);
- defineMapping(mappingContext, MAP_NAME, MAP_INDEX, MAP_CTX_NAME);
- interfaceContext = new NamingContext("interface", INT_CTX_NAME);
- defineMapping(mappingContext, ITF_NAME, ITF_INDEX, INT_CTX_NAME);
-
- customizer = new NshMapWriterCustomizer(jvppNsh, nshContext, interfaceContext);
- }
-
- private static NshMap generateNshMap(final String name) {
- final NshMapBuilder builder = new NshMapBuilder();
- builder.setName(name);
- builder.setKey(new NshMapKey(name));
- builder.setNsp(184L);
- builder.setNsi((short) 255);
- builder.setMappedNsp(183L);
- builder.setMappedNsi((short) 254);
- builder.setNshAction(Swap.class);
- builder.setEncapType(VxlanGpe.class);
- builder.setEncapIfName("vxlanGpeTun3");
-
- return builder.build();
- }
-
- private static InstanceIdentifier<NshMap> getNshMapId(final String name) {
- return InstanceIdentifier.create(NshMaps.class)
- .child(NshMap.class, new NshMapKey(name));
- }
-
- private void whenNshAddDelMapThenSuccess() {
- final NshAddDelMapReply reply = new NshAddDelMapReply();
- reply.mapIndex = MAP_INDEX;
- doReturn(future(reply)).when(jvppNsh).nshAddDelMap(any(NshAddDelMap.class));
- }
-
- private void whenNshAddDelMapThenFailure() {
- doReturn(failedFuture()).when(jvppNsh).nshAddDelMap(any(NshAddDelMap.class));
- }
-
- private static NshAddDelMap generateNshAddDelMap(final byte isAdd) {
- final NshAddDelMap request = new NshAddDelMap();
- request.isAdd = isAdd;
- request.nspNsi = 184<<8 | 255;
- request.mappedNspNsi = 183<<8 | 254;
- request.nshAction = 0;
- request.swIfIndex = ITF_INDEX;
- request.nextNode = 2;
-
- return request;
- }
-
- @Test
- public void testCreate() throws Exception {
- final NshMap nshMap = generateNshMap(MAP_NAME);
- final InstanceIdentifier<NshMap> id = getNshMapId(MAP_NAME);
-
- whenNshAddDelMapThenSuccess();
-
- customizer.writeCurrentAttributes(id, nshMap, writeContext);
-
- verify(jvppNsh).nshAddDelMap(generateNshAddDelMap((byte) 1));
-
- }
-
- @Test
- public void testCreateFailed() throws Exception {
- final NshMap nshMap = generateNshMap(MAP_NAME);
- final InstanceIdentifier<NshMap> id = getNshMapId(MAP_NAME);
-
- whenNshAddDelMapThenFailure();
-
- try {
- customizer.writeCurrentAttributes(id, nshMap, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(jvppNsh).nshAddDelMap(generateNshAddDelMap((byte) 1));
-
- return;
- }
- fail("WriteFailedException.CreateFailedException was expected");
- }
-
- @Test
- public void testDelete() throws Exception {
- final NshMap nshMap = generateNshMap(MAP_NAME);
- final InstanceIdentifier<NshMap> id = getNshMapId(MAP_NAME);
-
- whenNshAddDelMapThenSuccess();
-
- customizer.deleteCurrentAttributes(id, nshMap, writeContext);
-
- verify(jvppNsh).nshAddDelMap(generateNshAddDelMap((byte) 0));
- }
-
- @Test
- public void testDeleteFailed() throws Exception {
- final NshMap nshMap = generateNshMap(MAP_NAME);
- final InstanceIdentifier<NshMap> id = getNshMapId(MAP_NAME);
-
- whenNshAddDelMapThenFailure();
-
- try {
- customizer.deleteCurrentAttributes(id, nshMap, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(jvppNsh).nshAddDelMap(generateNshAddDelMap((byte) 0));
- return;
- }
- fail("WriteFailedException.DeleteFailedException was expected");
-
- customizer.deleteCurrentAttributes(id, nshMap, writeContext);
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdate() throws Exception {
- final NshMap nshMapBefore = generateNshMap(MAP_NAME);
- final InstanceIdentifier<NshMap> id = getNshMapId(MAP_NAME);
- customizer.updateCurrentAttributes(id, nshMapBefore, new NshMapBuilder().build(), writeContext);
- }
-} \ No newline at end of file
diff --git a/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizerTest.java b/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizerTest.java
deleted file mode 100644
index 2921d07dd..000000000
--- a/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizerTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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.vppnsh.impl.oper;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-
-import com.google.common.collect.Lists;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.nsh.dto.NshEntryDetails;
-import io.fd.vpp.jvpp.nsh.dto.NshEntryDetailsReplyDump;
-import io.fd.vpp.jvpp.nsh.dto.NshEntryDump;
-import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh;
-import java.util.List;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Ethernet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.MdType1;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.NshMdType1StateAugment;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.NshEntries;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.NshEntriesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.nsh.entries.NshEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.nsh.entries.NshEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.nsh.entries.NshEntryKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-public class NshEntryReaderCustomizerTest extends
- ListReaderCustomizerTest<NshEntry, NshEntryKey, NshEntryBuilder> {
-
- private static final String ENTRY_CTX_NAME = "nsh-entry-instance";
- private static final int ENTRY_INDEX_1 = 1;
- private static final String ENTRY_NAME_1 = "entry1";
- private static final int ENTRY_INDEX_2 = 2;
- private static final String ENTRY_NAME_2 = "entry2";
-
- @Mock
- protected FutureJVppNsh jvppNsh;
-
- private NamingContext nshContext;
-
- public NshEntryReaderCustomizerTest() {
- super(NshEntry.class, NshEntriesBuilder.class);
- }
-
- @Override
- protected ReaderCustomizer<NshEntry, NshEntryBuilder> initCustomizer() {
- return new NshEntryReaderCustomizer(jvppNsh, nshContext);
- }
-
- private static InstanceIdentifier<NshEntry> getNshEntryId(final String name) {
- return InstanceIdentifier.create(NshEntries.class)
- .child(NshEntry.class, new NshEntryKey(name));
- }
-
- @Override
- public void setUp() throws VppBaseCallException {
- nshContext = new NamingContext("nsh_entry", ENTRY_CTX_NAME);
- defineMapping(mappingContext, ENTRY_NAME_1, ENTRY_INDEX_1, ENTRY_CTX_NAME);
- defineMapping(mappingContext, ENTRY_NAME_2, ENTRY_INDEX_2, ENTRY_CTX_NAME);
-
- final NshEntryDetailsReplyDump reply = new NshEntryDetailsReplyDump();
- final NshEntryDetails nshEntryDetails = new NshEntryDetails();
- nshEntryDetails.verOC = 0;
- nshEntryDetails.length = 6;
- nshEntryDetails.mdType = 1;
- nshEntryDetails.nextProtocol = 3;
- nshEntryDetails.nspNsi = (123<<8 | 4);
- nshEntryDetails.c1 = 1;
- nshEntryDetails.c2 = 2;
- nshEntryDetails.c3 = 3;
- nshEntryDetails.c4 = 4;
- reply.nshEntryDetails = Lists.newArrayList(nshEntryDetails);
- doReturn(future(reply)).when(jvppNsh).nshEntryDump(any(NshEntryDump.class));
- }
-
- @Test
- public void testreadCurrentAttributes() throws ReadFailedException {
-
- NshEntryBuilder builder = new NshEntryBuilder();
- getCustomizer().readCurrentAttributes(getNshEntryId(ENTRY_NAME_1), builder, ctx);
-
- assertEquals(0, builder.getVersion().intValue());
- assertEquals(6, builder.getLength().intValue());
- assertEquals(MdType1.class, builder.getMdType());
- assertEquals(Ethernet.class, builder.getNextProtocol());
- assertEquals(123, builder.getNsp().intValue());
- assertEquals(4, builder.getNsi().intValue());
- assertEquals(1, builder.getAugmentation(NshMdType1StateAugment.class).getC1().intValue());
- assertEquals(2, builder.getAugmentation(NshMdType1StateAugment.class).getC2().intValue());
- assertEquals(3, builder.getAugmentation(NshMdType1StateAugment.class).getC3().intValue());
- assertEquals(4, builder.getAugmentation(NshMdType1StateAugment.class).getC4().intValue());
-
- verify(jvppNsh).nshEntryDump(any(NshEntryDump.class));
- }
-
- @Test
- public void testGetAllIds() throws ReadFailedException {
- final NshEntryDetailsReplyDump reply = new NshEntryDetailsReplyDump();
-
- final NshEntryDetails nshEntryDetails_1 = new NshEntryDetails();
- nshEntryDetails_1.entryIndex = ENTRY_INDEX_1;
- nshEntryDetails_1.verOC = 0;
- nshEntryDetails_1.length = 6;
- nshEntryDetails_1.mdType = 1;
- nshEntryDetails_1.nextProtocol = 3;
- nshEntryDetails_1.nspNsi = (123<<8 | 4);
- nshEntryDetails_1.c1 = 1;
- nshEntryDetails_1.c2 = 2;
- nshEntryDetails_1.c3 = 3;
- nshEntryDetails_1.c4 = 4;
- reply.nshEntryDetails = Lists.newArrayList(nshEntryDetails_1);
-
- final NshEntryDetails nshEntryDetails_2 = new NshEntryDetails();
- nshEntryDetails_2.entryIndex = ENTRY_INDEX_2;
- nshEntryDetails_2.verOC = 0;
- nshEntryDetails_2.length = 6;
- nshEntryDetails_2.mdType = 1;
- nshEntryDetails_2.nextProtocol = 2;
- nshEntryDetails_2.nspNsi = (223<<8 | 24);
- nshEntryDetails_2.c1 = 21;
- nshEntryDetails_2.c2 = 22;
- nshEntryDetails_2.c3 = 23;
- nshEntryDetails_2.c4 = 24;
- reply.nshEntryDetails = Lists.newArrayList(nshEntryDetails_2);
-
- doReturn(future(reply)).when(jvppNsh).nshEntryDump(any(NshEntryDump.class));
-
- final List<NshEntryKey> allIds = getCustomizer().getAllIds(getNshEntryId(ENTRY_NAME_1), ctx);
-
- assertEquals(reply.nshEntryDetails.size(), allIds.size());
-
- }
-}
diff --git a/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/oper/NshMapReaderCustomizerTest.java b/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/oper/NshMapReaderCustomizerTest.java
deleted file mode 100644
index 868f851a3..000000000
--- a/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/oper/NshMapReaderCustomizerTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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.vppnsh.impl.oper;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-
-import com.google.common.collect.Lists;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.nsh.dto.NshMapDetails;
-import io.fd.vpp.jvpp.nsh.dto.NshMapDetailsReplyDump;
-import io.fd.vpp.jvpp.nsh.dto.NshMapDump;
-import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh;
-import java.util.List;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Swap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.VxlanGpe;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.NshMaps;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.NshMapsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.nsh.maps.NshMap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.nsh.maps.NshMapBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.nsh.maps.NshMapKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-public class NshMapReaderCustomizerTest extends
- ListReaderCustomizerTest<NshMap, NshMapKey, NshMapBuilder> {
-
- private static final String MAP_CTX_NAME = "nsh-map-instance";
- private static final int MAP_INDEX_1 = 1;
- private static final String MAP_NAME_1 = "map1";
-
- private static final int MAP_INDEX_2 = 2;
- private static final String MAP_NAME_2 = "map2";
-
- private static final String INT_CTX_NAME = "interface-instance";
- private static final int ITF_INDEX = 3;
- private static final String ITF_NAME = "vxlanGpeTun3";
-
- @Mock
- protected FutureJVppNsh jvppNsh;
-
- private NamingContext nshContext;
-
- private NamingContext interfaceContext;
-
- public NshMapReaderCustomizerTest() {
- super(NshMap.class, NshMapsBuilder.class);
- }
-
- @Override
- protected ReaderCustomizer<NshMap, NshMapBuilder> initCustomizer() {
- return new NshMapReaderCustomizer(jvppNsh, nshContext, interfaceContext);
- }
-
- private static InstanceIdentifier<NshMap> getNshMapId(final String name) {
- return InstanceIdentifier.create(NshMaps.class)
- .child(NshMap.class, new NshMapKey(name));
- }
-
- @Override
- public void setUp() throws VppBaseCallException {
- nshContext = new NamingContext("nsh_map", MAP_CTX_NAME);
- defineMapping(mappingContext, MAP_NAME_1, MAP_INDEX_1, MAP_CTX_NAME);
- defineMapping(mappingContext, MAP_NAME_2, MAP_INDEX_2, MAP_CTX_NAME);
-
- interfaceContext = new NamingContext("interface", INT_CTX_NAME);
- defineMapping(mappingContext, ITF_NAME, ITF_INDEX, INT_CTX_NAME);
-
- final NshMapDetailsReplyDump reply = new NshMapDetailsReplyDump();
- final NshMapDetails nshMapDetails = new NshMapDetails();
- nshMapDetails.nspNsi = (184<<8 | 255);
- nshMapDetails.mappedNspNsi = (183<<8 | 254);
- nshMapDetails.nshAction = 0;
- nshMapDetails.swIfIndex = ITF_INDEX;
- nshMapDetails.nextNode = 2;
- reply.nshMapDetails = Lists.newArrayList(nshMapDetails);
- doReturn(future(reply)).when(jvppNsh).nshMapDump(any(NshMapDump.class));
- }
-
- @Test
- public void testreadCurrentAttributes() throws ReadFailedException {
-
- NshMapBuilder builder = new NshMapBuilder();
- getCustomizer().readCurrentAttributes(getNshMapId(MAP_NAME_1), builder, ctx);
-
- assertEquals(184, builder.getNsp().intValue());
- assertEquals(255, builder.getNsi().intValue());
- assertEquals(183, builder.getMappedNsp().intValue());
- assertEquals(254, builder.getMappedNsi().intValue());
- assertEquals(Swap.class, builder.getNshAction());
- assertEquals(VxlanGpe.class, builder.getEncapType());
- assertEquals("vxlanGpeTun3", builder.getEncapIfName());
-
- verify(jvppNsh).nshMapDump(any(NshMapDump.class));
- }
-
- @Test
- public void testGetAllIds() throws ReadFailedException {
- final NshMapDetailsReplyDump reply = new NshMapDetailsReplyDump();
-
- final NshMapDetails nshMapDetails_1 = new NshMapDetails();
- nshMapDetails_1.mapIndex = MAP_INDEX_1;
- nshMapDetails_1.nspNsi = (184<<8 | 255);
- nshMapDetails_1.mappedNspNsi = (183<<8 | 254);
- nshMapDetails_1.swIfIndex = ITF_INDEX;
- nshMapDetails_1.nextNode = 2;
- reply.nshMapDetails = Lists.newArrayList(nshMapDetails_1);
-
- final NshMapDetails nshMapDetails_2 = new NshMapDetails();
- nshMapDetails_2.mapIndex = MAP_INDEX_2;
- nshMapDetails_2.nspNsi = (84<<8 | 255);
- nshMapDetails_2.mappedNspNsi = (83<<8 | 254);
- nshMapDetails_2.swIfIndex = ITF_INDEX;
- nshMapDetails_2.nextNode = 1;
- reply.nshMapDetails = Lists.newArrayList(nshMapDetails_2);
-
- doReturn(future(reply)).when(jvppNsh).nshMapDump(any(NshMapDump.class));
-
- final List<NshMapKey> allIds = getCustomizer().getAllIds(getNshMapId(MAP_NAME_1), ctx);
-
- assertEquals(reply.nshMapDetails.size(), allIds.size());
-
- }
-}
diff --git a/nsh/nsh_postman_collection.json b/nsh/nsh_postman_collection.json
deleted file mode 100644
index a3f3641b6..000000000
--- a/nsh/nsh_postman_collection.json
+++ /dev/null
@@ -1,343 +0,0 @@
-{
- "id": "a9a935b5-9481-e4f7-44fb-17d13ef726f9",
- "name": "Honeycomb RESTCONF calls for NSH_SFC",
- "description": "Common mgmt operations on VPP using Honeycomb REST interface",
- "order": [],
- "folders": [
- {
- "id": "c98829cd-4993-4e1d-58f1-97523ecb6e4f",
- "name": "NSH_SFC",
- "description": "",
- "order": [
- "2b4aaeb0-c7c1-57a9-c2a3-e07bc83dcde3",
- "3c13298c-3619-391b-c808-5206d17a84d5",
- "553e04ce-23d8-81de-b414-0a21b108d93d",
- "4d8de77e-5342-3144-e904-d067eaa6a5cc",
- "911beeb5-61c1-bdb5-a850-96171a6686ae",
- "df2ec9ba-6a30-fc30-45db-365b666487c8",
- "d19976f1-abc6-7c28-c69f-3bcfe8877658",
- "23796c20-8543-9f46-8e51-413e86dfb54e"
- ],
- "owner": "652751",
- "collectionId": "b6a0ef73-644b-01fc-93c4-a4b260b9acff"
- },
- {
- "id": "c957a93e-c4f6-53d1-0606-207eefd79ac2",
- "name": "VXLAN-GPE-TUNNEL",
- "description": "",
- "order": [
- "0a0c7d8e-6acf-96dc-81a0-6b93a65e9402",
- "1bb24338-457a-b9ba-6834-9402e60c8c6f",
- "ee2676f9-ce96-cae1-2d47-8515fc58dd78",
- "477b81e3-7735-c371-967b-91cbc0cdf991"
- ],
- "owner": "652751",
- "collectionId": "b6a0ef73-644b-01fc-93c4-a4b260b9acff"
- },
- {
- "id": "5cbd2f82-b01e-9ebe-11ef-b451d944a11b",
- "name": "VXLAN-TUNNEL",
- "description": "",
- "order": [
- "b18d5cc2-7c42-0aee-152b-27b822a7bc66",
- "db501b30-8ac3-f889-8892-c8c8245a05fa"
- ],
- "owner": "652751"
- }
- ],
- "timestamp": 1473313581383,
- "owner": "652751",
- "public": false,
- "hasRequests": true,
- "requests": [
- {
- "id": "0a0c7d8e-6acf-96dc-81a0-6b93a65e9402",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/vxlanGpeTun3",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1477449333942,
- "name": "Add vxlan-gpe - cfg",
- "description": "",
- "collectionId": "a9a935b5-9481-e4f7-44fb-17d13ef726f9",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"vxlanGpeTun3\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:vxlan-gpe-tunnel\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"routing\" : {\r\n \"vrf-id\" : \"0\"\r\n },\r\n \"vxlan-gpe\" : {\r\n \"local\" : \"192.168.50.76\",\r\n \"remote\" : \"192.168.50.71\",\r\n \"vni\" : \"9\",\r\n \"next-protocol\" : \"ethernet\",\r\n \"encap-vrf-id\" : \"0\",\r\n \"decap-vrf-id\" : \"0\"\r\n }\r\n }\r\n ]\r\n \r\n}"
- },
- {
- "id": "1bb24338-457a-b9ba-6834-9402e60c8c6f",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/vxlanGpeTun3",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1473679728872,
- "name": "Get vxlan-gpe - cfg",
- "description": "",
- "collectionId": "a9a935b5-9481-e4f7-44fb-17d13ef726f9",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"vxlanGpeTun3\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:vxlan-gpe-tunnel\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"routing\" : {\r\n \"vrf-id\" : \"0\"\r\n },\r\n \"vxlan-gpe\" : {\r\n \"local\" : \"192.168.50.76\",\r\n \"remote\" : \"192.168.50.71\",\r\n \"vni\" : \"9\",\r\n \"next-protocol\" : \"ethernet\",\r\n \"encap-vrf-id\" : \"0\",\r\n \"decap-vrf-id\" : \"0\"\r\n }\r\n }\r\n ]\r\n \r\n}",
- "folder": "c957a93e-c4f6-53d1-0606-207eefd79ac2"
- },
- {
- "id": "23796c20-8543-9f46-8e51-413e86dfb54e",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/vpp-nsh:vpp-nsh/nsh-maps/nsh-map/nshMap5",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1477449352823,
- "name": "Delete nsh-map - cfg",
- "description": "",
- "collectionId": "a9a935b5-9481-e4f7-44fb-17d13ef726f9",
- "responses": [],
- "rawModeData": "{\r\n \"nsh-map\": [\r\n {\r\n \"name\": \"nshMap5\",\r\n \"nsp\": \"184\",\r\n \"nsi\": \"255\",\r\n \"mapped-nsp\": \"183\",\r\n \"mapped-nsi\": \"254\" \r\n }\r\n ]\r\n}"
- },
- {
- "id": "2b4aaeb0-c7c1-57a9-c2a3-e07bc83dcde3",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/vpp-nsh:vpp-nsh/nsh-entries/nsh-entry/nshEntry3",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1477448840459,
- "name": "Add nsh-entry - cfg",
- "description": "",
- "collectionId": "a9a935b5-9481-e4f7-44fb-17d13ef726f9",
- "responses": [],
- "rawModeData": "{\r\n \"nsh-entry\": [\r\n {\r\n \"name\": \"nshEntry3\",\r\n \"version\": \"0\",\r\n \"length\": \"6\",\r\n \"md-type\": \"md-type1\",\r\n \"next-protocol\": \"ethernet\",\r\n \"nsp\": \"184\",\r\n \"nsi\": \"255\",\r\n \"c1\": \"1\",\r\n \"c2\": \"2\",\r\n \"c3\": \"3\",\r\n \"c4\": \"4\"\r\n }\r\n ]\r\n}"
- },
- {
- "id": "3c13298c-3619-391b-c808-5206d17a84d5",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/vpp-nsh:vpp-nsh/nsh-entries/nsh-entry/nshEntry3",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1473313729119,
- "name": "Get nsh-entry - cfg",
- "description": "",
- "collectionId": "a9a935b5-9481-e4f7-44fb-17d13ef726f9",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"nsh-entry\": [\r\n {\r\n \"name\": \"nshEntry5\",\r\n \"description\": \"for testing nshEntry\",\r\n \"version\": \"0\",\r\n \"length\": \"6\",\r\n \"next-protocol\": \"Ethernet\",\r\n \"md-type\": \"MdType1\",\r\n \"nsp\": \"185\",\r\n \"nsi\": \"255\" \r\n }\r\n ]\r\n \r\n}",
- "folder": "c98829cd-4993-4e1d-58f1-97523ecb6e4f"
- },
- {
- "id": "477b81e3-7735-c371-967b-91cbc0cdf991",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/vxlanGpeTun3",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1464764638498,
- "name": "Delete vxlan-gpe - cfg",
- "description": "",
- "collectionId": "a9a935b5-9481-e4f7-44fb-17d13ef726f9",
- "responses": [],
- "rawModeData": "",
- "folder": "c957a93e-c4f6-53d1-0606-207eefd79ac2"
- },
- {
- "id": "4d8de77e-5342-3144-e904-d067eaa6a5cc",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/vpp-nsh:vpp-nsh/nsh-entries/nsh-entry/nshEntry3",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1473313722940,
- "name": "Delete nsh-entry - cfg",
- "description": "",
- "collectionId": "a9a935b5-9481-e4f7-44fb-17d13ef726f9",
- "responses": [],
- "rawModeData": "{\r\n \"nsh-entry\": [\r\n {\r\n \"name\": \"nshEntry3\",\r\n \"version\": \"0\",\r\n \"length\": \"6\",\r\n \"md-type\": \"md-type1\",\r\n \"next-protocol\": \"ethernet\",\r\n \"nsp\": \"184\",\r\n \"nsi\": \"255\" \r\n }\r\n ]\r\n}",
- "folder": "c98829cd-4993-4e1d-58f1-97523ecb6e4f"
- },
- {
- "id": "553e04ce-23d8-81de-b414-0a21b108d93d",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/vpp-nsh:vpp-nsh-state/nsh-entries/",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1473313726281,
- "name": "Get nsh-entry - oper",
- "description": "",
- "collectionId": "a9a935b5-9481-e4f7-44fb-17d13ef726f9",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"nsh-entry\": [\r\n {\r\n \"name\": \"nshEntry5\",\r\n \"description\": \"for testing nshEntry\",\r\n \"version\": \"0\",\r\n \"length\": \"6\",\r\n \"next-protocol\": \"Ethernet\",\r\n \"md-type\": \"MdType1\",\r\n \"nsp\": \"185\",\r\n \"nsi\": \"255\" \r\n }\r\n ]\r\n \r\n}",
- "folder": "c98829cd-4993-4e1d-58f1-97523ecb6e4f"
- },
- {
- "id": "911beeb5-61c1-bdb5-a850-96171a6686ae",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/vpp-nsh:vpp-nsh/nsh-maps/nsh-map/nshMap5",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1477449346905,
- "name": "Add nsh-map - cfg",
- "description": "",
- "collectionId": "a9a935b5-9481-e4f7-44fb-17d13ef726f9",
- "responses": [],
- "rawModeData": "{\r\n \"nsh-map\": [\r\n {\r\n \"name\": \"nshMap5\",\r\n \"nsp\": \"184\",\r\n \"nsi\": \"255\",\r\n \"mapped-nsp\": \"183\",\r\n \"mapped-nsi\": \"254\",\r\n \"nsh-action\": \"push\",\r\n \"encap-type\": \"vxlan-gpe\",\r\n \"encap-if-name\": \"vxlanGpeTun3\"\r\n }\r\n ]\r\n}"
- },
- {
- "id": "b18d5cc2-7c42-0aee-152b-27b822a7bc66",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "https://localhost:8443/restconf/config/ietf-interfaces:interfaces/interface/vxlanTun1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1473679767979,
- "name": "Add virtual ifc - cfg",
- "description": "",
- "collectionId": "a9a935b5-9481-e4f7-44fb-17d13ef726f9",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"vxlanTun1\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:vxlan-tunnel\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"routing\" : {\r\n \"vrf-id\" : \"0\"\r\n },\r\n \"vxlan\" : {\r\n \"src\" : \"192.168.1.6\",\r\n \"dst\" : \"192.168.1.9\",\r\n \"vni\" : \"88\",\r\n \"encap-vrf-id\" : \"0\"\r\n }\r\n }\r\n ]\r\n \r\n}",
- "folder": "5cbd2f82-b01e-9ebe-11ef-b451d944a11b"
- },
- {
- "id": "d19976f1-abc6-7c28-c69f-3bcfe8877658",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/vpp-nsh:vpp-nsh-state/nsh-maps/",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1477449339914,
- "name": "Get nsh-map - oper",
- "description": "",
- "collectionId": "a9a935b5-9481-e4f7-44fb-17d13ef726f9",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"nsh-entry\": [\r\n {\r\n \"name\": \"nshEntry5\",\r\n \"description\": \"for testing nshEntry\",\r\n \"version\": \"0\",\r\n \"length\": \"6\",\r\n \"next-protocol\": \"Ethernet\",\r\n \"md-type\": \"MdType1\",\r\n \"nsp\": \"185\",\r\n \"nsi\": \"255\" \r\n }\r\n ]\r\n \r\n}"
- },
- {
- "id": "db501b30-8ac3-f889-8892-c8c8245a05fa",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/vxlanTun1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1462892071867,
- "name": "Delete virtual ifc - cfg",
- "description": "",
- "collectionId": "a9a935b5-9481-e4f7-44fb-17d13ef726f9",
- "responses": [],
- "timestamp": null,
- "rawModeData": "",
- "folder": "5cbd2f82-b01e-9ebe-11ef-b451d944a11b"
- },
- {
- "id": "df2ec9ba-6a30-fc30-45db-365b666487c8",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/vpp-nsh:vpp-nsh/nsh-maps/nsh-map/nshMap5",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1477449344219,
- "name": "Get nsh-map - cfg",
- "description": "",
- "collectionId": "a9a935b5-9481-e4f7-44fb-17d13ef726f9",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"nsh-entry\": [\r\n {\r\n \"name\": \"nshEntry5\",\r\n \"description\": \"for testing nshEntry\",\r\n \"version\": \"0\",\r\n \"length\": \"6\",\r\n \"next-protocol\": \"Ethernet\",\r\n \"md-type\": \"MdType1\",\r\n \"nsp\": \"185\",\r\n \"nsi\": \"255\" \r\n }\r\n ]\r\n \r\n}"
- },
- {
- "id": "ee2676f9-ce96-cae1-2d47-8515fc58dd78",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/ietf-interfaces:interfaces-state/interface/vxlanGpeTun3",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1473679726298,
- "name": "Get vxlan-gpe - oper",
- "description": "",
- "collectionId": "a9a935b5-9481-e4f7-44fb-17d13ef726f9",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"vxlanGpeTun3\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:vxlan-gpe-tunnel\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"routing\" : {\r\n \"vrf-id\" : \"0\"\r\n },\r\n \"vxlan-gpe\" : {\r\n \"local\" : \"192.168.50.76\",\r\n \"remote\" : \"192.168.50.71\",\r\n \"vni\" : \"9\",\r\n \"next-protocol\" : \"ethernet\",\r\n \"encap-vrf-id\" : \"0\",\r\n \"decap-vrf-id\" : \"0\"\r\n }\r\n }\r\n ]\r\n \r\n}",
- "folder": "c957a93e-c4f6-53d1-0606-207eefd79ac2"
- }
- ]
-} \ No newline at end of file
diff --git a/nsh/pom.xml b/nsh/pom.xml
deleted file mode 100644
index 52297d846..000000000
--- a/nsh/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2015 Intel 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>honeycomb-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../common/honeycomb-parent</relativePath>
- </parent>
-
- <groupId>io.fd.honeycomb.nsh</groupId>
- <artifactId>vppnsh-aggregator</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <name>${project.artifactId}</name>
- <packaging>pom</packaging>
- <modelVersion>4.0.0</modelVersion>
- <description>Aggregator for Honeycomb NSH_SFC plugin</description>
-
- <modules>
- <module>api</module>
- <module>impl</module>
- </modules>
- <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/packaging/deb/.gitignore b/packaging/deb/.gitignore
deleted file mode 100644
index f5316fb7b..000000000
--- a/packaging/deb/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-*.tar.xz
-*.tar.gz
-**/honeycomb-*/
-*.deb
-*.changes \ No newline at end of file
diff --git a/packaging/deb/common/debuild.sh b/packaging/deb/common/debuild.sh
deleted file mode 100755
index 8f766e0c0..000000000
--- a/packaging/deb/common/debuild.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-set -xe
-BUILD_DIR=$1
-
-# Build deb binary only package
-cd ${BUILD_DIR}
-dpkg-buildpackage -b
-cd - \ No newline at end of file
diff --git a/packaging/deb/common/prepare.sh b/packaging/deb/common/prepare.sh
deleted file mode 100755
index 9663bccbe..000000000
--- a/packaging/deb/common/prepare.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-set -xe
-# $1 - source dir root
-# $2 - $1/debian - just configurable for reuse
-# $3 - service definition file
-# $4 - service definition target during install
-SOURCE_DIR=$1
-VERSION=$(${SOURCE_DIR}/../../rpm/version)
-RELEASE=$(${SOURCE_DIR}/../../rpm/release)
-BUILD_DIR=${SOURCE_DIR}/honeycomb-${VERSION}
-
-# Copy and unpack the archive with vpp-integration distribution
-ARCHIVE_DIR=${SOURCE_DIR}/../../../vpp-integration/minimal-distribution/target/
-ARCHIVE=${ARCHIVE_DIR}/vpp-integration-distribution-1.16.12-SNAPSHOT-hc.tar.gz
-cp ${ARCHIVE} ${SOURCE_DIR}
-ARCHIVE=${SOURCE_DIR}/vpp-integration-distribution-${VERSION}-SNAPSHOT-hc.tar.gz
-tar -xf ${ARCHIVE} -C ${SOURCE_DIR}/
-
-# Create packaging root
-rm -rf ${BUILD_DIR}
-mkdir ${BUILD_DIR}
-
-# Copy contents of tar.gz
-mv ${SOURCE_DIR}/vpp-integration-distribution-${VERSION}-SNAPSHOT/ ${BUILD_DIR}/
-cp -r $2 ${BUILD_DIR}
-
-# OS service definition
-cp ${SOURCE_DIR}/$3 ${BUILD_DIR}
-
-# Changelog file
-cat <<EOT >> ${BUILD_DIR}/debian/changelog
-honeycomb (${VERSION}-${RELEASE}) unstable; urgency=low
-
- * 16.12 release
-
- -- mmarsale <mmarsale@cisco.com> Mon, 22 Aug 2016 09:41:37 +0200
-EOT
-
-# Install instructions
-cat <<EOT >> ${BUILD_DIR}/debian/install
-vpp-integration-distribution-${VERSION}-SNAPSHOT/* /opt/honeycomb/
-$3 $4
-EOT
-
-echo ${BUILD_DIR} \ No newline at end of file
diff --git a/packaging/deb/trusty/debian/compat b/packaging/deb/trusty/debian/compat
deleted file mode 100644
index ec635144f..000000000
--- a/packaging/deb/trusty/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-9
diff --git a/packaging/deb/trusty/debian/control b/packaging/deb/trusty/debian/control
deleted file mode 100644
index d84f7d98b..000000000
--- a/packaging/deb/trusty/debian/control
+++ /dev/null
@@ -1,14 +0,0 @@
-Source: honeycomb
-Section: misc
-Priority: optional
-Maintainer: fd.io/honeycomb <honeycomb-dev@lists.fd.io>
-Build-Depends: debhelper (>= 9)
-Standards-Version: 3.9.6
-Homepage: https://wiki.fd.io/view/Honeycomb
-Vcs-Browser: https://git.fd.io/cgit/honeycomb/tree/
-
-Package: honeycomb
-Architecture: all
-Depends: vpp, vpp-plugins, openjdk-8-jdk | openjdk-8-jre
-Suggests: vpp-nsh-plugin, vpp-ioam-plugin
-Description: Honeycomb agent for VPP
diff --git a/packaging/deb/trusty/debian/copyright b/packaging/deb/trusty/debian/copyright
deleted file mode 100644
index ad3a88c26..000000000
--- a/packaging/deb/trusty/debian/copyright
+++ /dev/null
@@ -1,23 +0,0 @@
-Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Upstream-Name: honeycomb
-Source: https://git.fd.io/cgit/honeycomb/tree/
-
-Files: *
-Copyright: 2016 Cisco and/or its affiliates <honeycomb-dev@lists.fd.io>
-License: Apache-2.0
- 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.
- .
- On Debian systems, the complete text of the GNU General
- Public License version 2 can be found in "/usr/share/common-licenses/Apache-2.0".
diff --git a/packaging/deb/trusty/debian/rules b/packaging/deb/trusty/debian/rules
deleted file mode 100755
index 5c1cebc20..000000000
--- a/packaging/deb/trusty/debian/rules
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/make -f
-# See debhelper(7) (uncomment to enable)
-# output every command that modifies files on the build system.
-#export DH_VERBOSE = 1
-
-# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
-DPKG_EXPORT_BUILDFLAGS = 1
-include /usr/share/dpkg/default.mk
-
-# see FEATURE AREAS in dpkg-buildflags(1)
-#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-
-# see ENVIRONMENT in dpkg-buildflags(1)
-# package maintainers to append CFLAGS
-#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
-# package maintainers to append LDFLAGS
-#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
-
-
-# main packaging script based on dh7 syntax
-%:
- dh $@
-
-# dh_make generated override targets
-# This is example for Cmake (See https://bugs.debian.org/641051 )
-#override_dh_auto_configure:
-# dh_auto_configure -- \
-# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)
-
-
-
-
diff --git a/packaging/deb/trusty/debian/source/format b/packaging/deb/trusty/debian/source/format
deleted file mode 100644
index 163aaf8d8..000000000
--- a/packaging/deb/trusty/debian/source/format
+++ /dev/null
@@ -1 +0,0 @@
-3.0 (quilt)
diff --git a/packaging/deb/trusty/debuild.sh b/packaging/deb/trusty/debuild.sh
deleted file mode 100755
index 84c38ae30..000000000
--- a/packaging/deb/trusty/debuild.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-set -xe
-DIR=$(dirname $0)
-DIR=$(readlink -f ${DIR})
-
-BUILD_FOLDER=$(${DIR}/../common/prepare.sh ${DIR} ${DIR}/debian honeycomb.conf /etc/init/)
-${DIR}/../common/debuild.sh ${BUILD_FOLDER} \ No newline at end of file
diff --git a/packaging/deb/trusty/honeycomb.conf b/packaging/deb/trusty/honeycomb.conf
deleted file mode 100644
index e9c7fb932..000000000
--- a/packaging/deb/trusty/honeycomb.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-description "honeycomb agent for VPP"
-author "fd.io/honeycomb <honeycomb-dev@lists.fd.io>"
-
-manual
-
-script
- exec /opt/honeycomb/honeycomb
-end script \ No newline at end of file
diff --git a/packaging/deb/xenial/debian/control b/packaging/deb/xenial/debian/control
deleted file mode 100644
index 22ed1774e..000000000
--- a/packaging/deb/xenial/debian/control
+++ /dev/null
@@ -1,14 +0,0 @@
-Source: honeycomb
-Section: misc
-Priority: optional
-Maintainer: fd.io/honeycomb <honeycomb-dev@lists.fd.io>
-Build-Depends: debhelper (>= 9), dh-systemd
-Standards-Version: 3.9.6
-Homepage: https://wiki.fd.io/view/Honeycomb
-Vcs-Browser: https://git.fd.io/cgit/honeycomb/tree/
-
-Package: honeycomb
-Architecture: all
-Depends: vpp, vpp-plugins, openjdk-8-jdk | openjdk-8-jre
-Suggests: vpp-nsh-plugin, vpp-ioam-plugin
-Description: Honeycomb agent for VPP
diff --git a/packaging/deb/xenial/debian/rules b/packaging/deb/xenial/debian/rules
deleted file mode 100755
index 048f5f738..000000000
--- a/packaging/deb/xenial/debian/rules
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/make -f
-# See debhelper(7) (uncomment to enable)
-# output every command that modifies files on the build system.
-#export DH_VERBOSE = 1
-
-# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
-DPKG_EXPORT_BUILDFLAGS = 1
-include /usr/share/dpkg/default.mk
-
-# see FEATURE AREAS in dpkg-buildflags(1)
-#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-
-# see ENVIRONMENT in dpkg-buildflags(1)
-# package maintainers to append CFLAGS
-#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
-# package maintainers to append LDFLAGS
-#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
-
-
-# main packaging script based on dh7 syntax
-%:
- dh $@ --with systemd
-
-# dh_make generated override targets
-# This is example for Cmake (See https://bugs.debian.org/641051 )
-#override_dh_auto_configure:
-# dh_auto_configure -- \
-# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)
-
-
-
-
diff --git a/packaging/deb/xenial/debuild.sh b/packaging/deb/xenial/debuild.sh
deleted file mode 100755
index 21e3b7a84..000000000
--- a/packaging/deb/xenial/debuild.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-set -xe
-DIR=$(dirname $0)
-DIR=$(readlink -f ${DIR})
-
-BUILD_FOLDER=$(${DIR}/../common/prepare.sh ${DIR} ${DIR}/../trusty/debian honeycomb.service /lib/systemd/system)
-cp -r ${DIR}/debian/* ${BUILD_FOLDER}/debian/
-${DIR}/../common/debuild.sh ${BUILD_FOLDER} \ No newline at end of file
diff --git a/packaging/deb/xenial/honeycomb.service b/packaging/deb/xenial/honeycomb.service
deleted file mode 100644
index 3b88ba425..000000000
--- a/packaging/deb/xenial/honeycomb.service
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=honeycomb agent for VPP
-
-[Service]
-Type=simple
-ExecStart=/bin/sh -ec "exec /opt/honeycomb/honeycomb"
-Restart=on-failure
-
-[Install]
-WantedBy=multi-user.target \ No newline at end of file
diff --git a/packaging/rpm/.gitignore b/packaging/rpm/.gitignore
deleted file mode 100644
index 2da6c3117..000000000
--- a/packaging/rpm/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-BUILD
-BUILDROOT
-RPMS
-SOURCES
-SPECS
-SRPMS
diff --git a/packaging/rpm/honeycomb.service b/packaging/rpm/honeycomb.service
deleted file mode 100644
index d8fe9cde4..000000000
--- a/packaging/rpm/honeycomb.service
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=fd.io Honeycomb
-Wants=vpp.service
-After=vpp.service
-
-[Service]
-ExecStart=/opt/honeycomb/honeycomb
-
-[Install]
-WantedBy=multi-user.target
diff --git a/packaging/rpm/honeycomb.spec b/packaging/rpm/honeycomb.spec
deleted file mode 100644
index e95b5455a..000000000
--- a/packaging/rpm/honeycomb.spec
+++ /dev/null
@@ -1,66 +0,0 @@
-# Honyecomb is a noarch package, so this isn't necessary. It's also very slow.
-%define __jar_repack 0
-%define _version %(./version)
-%define _release %(./release)
-
-Name: honeycomb
-Version: %{_version}
-# The Fedora/CentOS packaging guidelines *require* the use of a disttag. Honeycomb's
-# RPM build doesn't do anything Fedora/CentOS specific, so the disttag is
-# unnecessary and unused in our case, but both the docs and the pros (apevec)
-# agree that we should include it.
-# See: https://fedoraproject.org/wiki/Packaging:DistTag
-Release: %{_release}
-BuildArch: noarch
-Summary: fd.io Honeycomb
-Group: Applications/Communications
-License: Apache-1.0
-URL: http://www.fd.io
-Source0: vpp-integration-distribution-%{_version}-SNAPSHOT-hc.zip
-Source1: honeycomb.service
-Requires: vpp, vpp-plugins, java >= 1:1.8.0
-# Required for creating honeycomb group
-Requires(pre): shadow-utils
-# Required for configuring systemd
-BuildRequires: systemd
-
-%pre
-# Create `honeycomb` user/group
-# Short circuits if the user/group already exists
-# Home dir must be a valid path for various files to be created in it
-getent passwd honeycomb > /dev/null || useradd honeycomb -M -d $RPM_BUILD_ROOT/opt/%name
-getent group honeycomb > /dev/null || groupadd honeycomb
-getent group vpp > /dev/null && usermod -a -G vpp honeycomb
-
-%description
-fd.io Honeycomb
-
-%prep
-# Extract Source0 (Honeycomb archive)
-%autosetup -n vpp-integration-distribution-%{_version}-SNAPSHOT
-
-%install
-# Create directory in build root for Honeycomb
-mkdir -p $RPM_BUILD_ROOT/opt/%name
-# Copy Honeycomb from archive to its dir in build root
-cp -r ../vpp-integration-distribution-%{_version}-SNAPSHOT/* $RPM_BUILD_ROOT/opt/%name
-# Create directory in build root for systemd .service file
-mkdir -p $RPM_BUILD_ROOT/%{_unitdir}
-# Copy Honeycomb's systemd .service file to correct dir in build root
-echo "PWD:$PWD"
-cp ${RPM_BUILD_ROOT}/../../%{name}.service $RPM_BUILD_ROOT/%{_unitdir}/%name.service
-
-%postun
-# When the RPM is removed, the subdirs containing new files wouldn't normally
-# be deleted. Manually clean them up.
-# Warning: This does assume there's no data there that should be preserved
-if [ $1 -eq 0 ]; then
- rm -rf $RPM_BUILD_ROOT/opt/%name
-fi
-
-%files
-# Honeycomb will run as honeycomb:honeycomb, set as user:group for honeycomb dir, don't override mode
-%attr(-,honeycomb,honeycomb) /opt/%name
-# Configure systemd unitfile user/group/mode
-%attr(0644,root,root) %{_unitdir}/%name.service
-
diff --git a/packaging/rpm/release b/packaging/rpm/release
deleted file mode 100755
index c4bf723b5..000000000
--- a/packaging/rpm/release
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-echo $BUILD_NUMBER
diff --git a/packaging/rpm/rpmbuild.sh b/packaging/rpm/rpmbuild.sh
deleted file mode 100755
index 5e8ab6e7a..000000000
--- a/packaging/rpm/rpmbuild.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-set -xe
-DIR=$(dirname $0)
-DIR=$(readlink -f $DIR)
-ZIPDIR=${DIR}/../../vpp-integration/minimal-distribution/target/
-ZIPFILE=${ZIPDIR}/vpp-integration-distribution-1.16.12-SNAPSHOT-hc.zip
-mkdir -p ${DIR}/SOURCES/
-cp $ZIPFILE ${DIR}/SOURCES/
-cp ${DIR}/honeycomb.spec ${DIR}/SOURCES/
-cd ${DIR}
-rpmbuild -bb --define "_topdir ${DIR}" ${DIR}/honeycomb.spec
-cd -
-
diff --git a/packaging/rpm/version b/packaging/rpm/version
deleted file mode 100755
index d1194ffdb..000000000
--- a/packaging/rpm/version
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-echo 1.16.12
diff --git a/pom.xml b/pom.xml
index 50795b23b..715974a99 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,16 +37,8 @@
<modules>
<module>common</module>
<module>infra</module>
- <module>nsh</module>
- <module>vpp-common</module>
- <module>vpp-integration</module>
- <module>v3po</module>
- <module>lisp</module>
<module>samples</module>
<module>tools</module>
- <module>routing</module>
- <module>nat</module>
- <module>ioam</module>
<module>release-notes</module>
</modules>
</project>
diff --git a/release-notes/pom.xml b/release-notes/pom.xml
index 2f08472c9..d638255c0 100644
--- a/release-notes/pom.xml
+++ b/release-notes/pom.xml
@@ -79,14 +79,6 @@
<project-public-version>17.01</project-public-version>
<project-version-in-jira>10404</project-version-in-jira>
<project-branch>master</project-branch>
- <project-vpp-version>17.01</project-vpp-version>
- <!-- TODO set snapshot version to project-vpp-version after VPP is released-->
- <!--<project-vpp-snapshot-version>17.01</project-vpp-snapshot-version>-->
- <project-vpp-snapshot-version>17.01-SNAPSHOT</project-vpp-snapshot-version>
- <project-snat-version>1.0</project-snat-version>
- <!-- TODO set snapshot version to project-snat-version after VPP is released-->
- <!--<project-snat-snapshot-version>1.0</project-snat-snapshot-version>-->
- <project-snat-snapshot-version>1.0-SNAPSHOT</project-snat-snapshot-version>
<project-git-web>https://git.fd.io/cgit/honeycomb/tree</project-git-web>
</attributes>
</configuration>
diff --git a/release-notes/src/main/asciidoc/devel_guide/devel_guide.adoc b/release-notes/src/main/asciidoc/devel_guide/devel_guide.adoc
index 78664e655..031bee72e 100644
--- a/release-notes/src/main/asciidoc/devel_guide/devel_guide.adoc
+++ b/release-notes/src/main/asciidoc/devel_guide/devel_guide.adoc
@@ -5,9 +5,8 @@ Honeycomb plugin development guide.
=== Tutorials
* link:devel_plugin_overview.html[Honeycomb plugin overview]
* link:devel_plugin_tutorial.html[How to write Honeycomb plugins]
-* link:devel_plugin_vpp_tutorial.html[How to write Honeycomb plugins for VPP]
=== Samples
* {project-git-web}/samples?h={project-branch}[Interface managmenet sample from Honeycomb]
-** Generic(non-VPP) plugin with a custom distribution containing lots of useful information about Honeycomb and its plugins.
+** Generic(interface manager) plugin with a custom distribution containing lots of useful information about Honeycomb and its plugins.
diff --git a/release-notes/src/main/asciidoc/devel_guide/devel_plugin_vpp_tutorial.adoc b/release-notes/src/main/asciidoc/devel_guide/devel_plugin_vpp_tutorial.adoc
deleted file mode 100644
index ee148e5e5..000000000
--- a/release-notes/src/main/asciidoc/devel_guide/devel_plugin_vpp_tutorial.adoc
+++ /dev/null
@@ -1,617 +0,0 @@
-= Developing plugins for VPP
-
-link:release_notes.html[< Home]
-
-Honeycomb's primary use case is to provide an agent for VPP. This section provides a tutorial for how to develop a Honeycomb plugin that translates YANG modeled data into VPP binary API invocation.
-
-== Analyzing VPP's API
-For this tutorial, VPP's VXLAN management API. Honeycomb already contains VXLAN management translation code inside V3PO plugin. This will be a simplified version.
-
-Looking at VPP's API definition file, there are 3 calls related to VXLAN:
-
-vxlan_add_del_tunnel - Creates and Deletes VXLAN tunnel (Update not supported)
-vxlan_tunnel_dump - Reads all VXLAN tunnels
-These are the shared-memory, binary APIs of VPP that would be difficult to use from Java. But VPP contains a jvpp component, that's completely generated from VPP's API definition file and allows Java applications to manage VPP in plain Java using JNI in the background. Honeycomb provides a component that can be included in a distribution.
-
-== Updating sample-plugin to manage VPP
-
-This tutorial starts where the previous one left and will continue to modify the sample plugin in order to be able to manage VPP's VXLAN tunnels.
-
-=== Updating YANG models
-YANG models need to reflect the intent of managing VXLAN tunnels in VPP. As mentioned before, VPP exposes 2 calls to manage VXLAN tunnels. Each vxlan tunnel has a set of attributes, but for simplicity, only 2 of them will be exposed in YANG : source IP address and destination IP address. Rest of attributes will be set to default values in the code.
-
-So let's update the sample-plugin-params grouping to:
-
-[source,yang]
-----
-grouping sample-plugin-params {
- container vxlans {
- list vxlan-tunnel {
-
- key id;
- leaf id {
- type string;
- }
-
- leaf src {
- type inet:ip-address;
- }
- leaf dst {
- type inet:ip-address;
- }
- }
- }
-}
-----
-
-Since ietf-inet-types YANG model is used for the ip-address type, it needs to be imported (after the prefix statement):
-
-[source,yang]
-----
-import ietf-inet-types { prefix "inet"; }
-----
-
-NOTE: The reason this works is that there are some general YANG models such as ietf-inet-types added to *-api module in its pom.xml.
-
-Now rebuild the *-api module.
-
-=== JVpp dependency
-Another important thing that the plugin needs is dependency to VPP's JVpp (Java APIs). To do so, just update *-impl's pom.xml with:
-
-[source,xml,subs="+attributes"]
-----
-<!-- VPP's core Java APIs -->
-<dependency>
- <groupId>io.fd.vpp</groupId>
- <artifactId>jvpp-core</artifactId>
- <version>{project-vpp-snapshot-version}</version>
-</dependency>
-----
-
-Also add vpp-translate-utils dependency so that writing translation code is easier:
-
-[source,xml,subs="+attributes"]
-----
-<dependency>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-translate-utils</artifactId>
- <version>{project-version}</version>
-</dependency>
-----
-
-Do not rebuild yet, since the APIs for this plugin have changed and the compilation would fail. But make sure to update the project if using an IDE to pick up the Jvpp dependency.
-
-=== Updating the customizers
-
-First of all, remove CrudService interface and ElementCrudService class. Will not be needed now.
-
-==== Changes to ElementStateCustomizer
-
-Rename it to VxlanReadCustomzier. Update the code to:
-
-[source,java]
-----
-package io.fd.honeycomb.tutorial.read;
-
-import com.google.common.base.Preconditions;
-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.v3po.util.NamingContext;
-import io.fd.honeycomb.translate.v3po.util.TranslateUtils;
-import java.util.Collections;
-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.sample.plugin.rev160918.sample.plugin.params.VxlansBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.sample.plugin.params.vxlans.VxlanTunnel;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.sample.plugin.params.vxlans.VxlanTunnelBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.sample.plugin.params.vxlans.VxlanTunnelKey;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.openvpp.jvpp.VppBaseCallException;
-import org.openvpp.jvpp.core.dto.VxlanTunnelDetails;
-import org.openvpp.jvpp.core.dto.VxlanTunnelDetailsReplyDump;
-import org.openvpp.jvpp.core.dto.VxlanTunnelDump;
-import org.openvpp.jvpp.core.future.FutureJVppCore;
-
-/**
- * Reader for {@link VxlanTunnel} list node from our YANG model.
- */
-public final class VxlanReadCustomizer implements
- ListReaderCustomizer<VxlanTunnel, VxlanTunnelKey, VxlanTunnelBuilder> {
-
- // JVpp core. This is the Java API for VPP's core API.
- private final FutureJVppCore jVppCore;
- // Naming context for interfaces
- // Honeycomb provides a "context" storage for plugins. This storage is used for storing metadata required during
- // data translation (just like in this plugin). An example of such metadata would be interface identifier. In Honeycomb
- // we use string names for interfaces, however VPP uses only indices (that are created automatically).
- // This means that translation layer has to store the mapping between HC interface name <-> VPP' interface index.
- // And since vxlan tunnel is a type of interface in VPP, the same applies here
- //
- // Honeycomb provides a couple utilities on top of context storage such as NamingContext. It is just a map
- // backed by context storage that makes the lookup and storing easier.
- private final NamingContext vxlanNamingContext;
-
- public VxlanReadCustomizer(final FutureJVppCore jVppCore, final NamingContext vxlanNamingContext) {
- this.jVppCore = jVppCore;
- this.vxlanNamingContext = vxlanNamingContext;
- }
-
- /**
- * Provide a list of IDs for all VXLANs in VPP
- */
- @Nonnull
- @Override
- public List<VxlanTunnelKey> getAllIds(@Nonnull final InstanceIdentifier<VxlanTunnel> id,
- @Nonnull final ReadContext context)
- throws ReadFailedException {
- // Create Dump request
- final VxlanTunnelDump vxlanTunnelDump = new VxlanTunnelDump();
- // Set Dump request attributes
- // Set interface index to 0, so all interfaces are dumped and we can get the list of all IDs
- vxlanTunnelDump.swIfIndex = 0;
- final VxlanTunnelDetailsReplyDump reply;
- try {
- reply = TranslateUtils.getReplyForRead(jVppCore.vxlanTunnelDump(vxlanTunnelDump).toCompletableFuture(), id);
- } catch (VppBaseCallException e) {
- throw new ReadFailedException(id, e);
- }
-
- // Check for empty response (no vxlan tunnels to read)
- if (reply == null || reply.vxlanTunnelDetails == null) {
- return Collections.emptyList();
- }
-
- return reply.vxlanTunnelDetails.stream()
- // Need a name of an interface here. Use context to look it up from index
- // In case the naming context does not contain such mapping, it creates an artificial one
- .map(a -> new VxlanTunnelKey(vxlanNamingContext.getName(a.swIfIndex, context.getMappingContext())))
- .collect(Collectors.toList());
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder, @Nonnull final List<VxlanTunnel> readData) {
- // Just set the readValue into parent builder
- // The cast has to be performed here
- ((VxlansBuilder) builder).setVxlanTunnel(readData);
- }
-
- @Nonnull
- @Override
- public VxlanTunnelBuilder getBuilder(@Nonnull final InstanceIdentifier<VxlanTunnel> id) {
- // Setting key from id is not necessary, builder will take care of that
- return new VxlanTunnelBuilder();
- }
-
- /**
- * Read all the attributes of a single VXLAN tunnel
- */
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<VxlanTunnel> id,
- @Nonnull final VxlanTunnelBuilder builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- // The ID received here contains the name of a particular interface that should be read
- // It was either requested directly by HC users or is one of the IDs from getAllIds that could have been invoked
- // just before this method invocation
-
- // Create Dump request
- final VxlanTunnelDump vxlanTunnelDump = new VxlanTunnelDump();
- // Set Dump request attributes
- // Set the vxlan index from naming context
- // Naming context must contain the mapping because:
- // 1. The vxlan tunnel was created in VPP using HC + this plugin meaning we stored the mapping in write customizer
- // 2. The vxlan tunnel was already present in VPP, but HC reconciliation mechanism took care of that (as long as proper Initializer is provided by this plugin)
- final String vxlanName = id.firstKeyOf(VxlanTunnel.class).getId();
- vxlanTunnelDump.swIfIndex = vxlanNamingContext.getIndex(vxlanName, ctx.getMappingContext());
-
- final VxlanTunnelDetailsReplyDump reply;
- try {
- reply = TranslateUtils.getReplyForRead(jVppCore.vxlanTunnelDump(vxlanTunnelDump).toCompletableFuture(), id);
- } catch (VppBaseCallException e) {
- throw new ReadFailedException(id, e);
- }
-
- Preconditions.checkState(reply != null && reply.vxlanTunnelDetails != null);
- final VxlanTunnelDetails singleVxlanDetail = reply.vxlanTunnelDetails.stream().findFirst().get();
-
- // Now translate all attributes into provided builder
- final Boolean isIpv6 = TranslateUtils.byteToBoolean(singleVxlanDetail.isIpv6);
- builder.setSrc(TranslateUtils.arrayToIpAddress(isIpv6, singleVxlanDetail.srcAddress));
- builder.setDst(TranslateUtils.arrayToIpAddress(isIpv6, singleVxlanDetail.dstAddress));
- // There are additional attributes of a vxlan tunnel that wont be used here
- }
-}
-----
-
-The '"ReaderFactory also needs to be updated:
-
-[source,java]
-----
-package io.fd.honeycomb.tutorial.read;
-
-import com.google.inject.Inject;
-import io.fd.honeycomb.translate.impl.read.GenericListReader;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
-import io.fd.honeycomb.translate.v3po.util.NamingContext;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.SamplePluginState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.SamplePluginStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.sample.plugin.params.Vxlans;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.sample.plugin.params.VxlansBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.sample.plugin.params.vxlans.VxlanTunnel;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.openvpp.jvpp.core.future.FutureJVppCore;
-
-/**
- * Factory producing readers for sample-plugin plugin's data.
- */
-public final class ModuleStateReaderFactory implements ReaderFactory {
-
- public static final InstanceIdentifier<SamplePluginState> ROOT_STATE_CONTAINER_ID =
- InstanceIdentifier.create(SamplePluginState.class);
-
- /**
- * Injected vxlan naming context shared with writer, provided by this plugin
- */
- @Inject
- private NamingContext vxlanNamingContext;
- /**
- * Injected jvpp core APIs, provided by Honeycomb's infrastructure
- */
- @Inject
- private FutureJVppCore jvppCore;
-
- @Override
- public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
- // register reader that only delegate read's to its children
- registry.addStructuralReader(ROOT_STATE_CONTAINER_ID, SamplePluginStateBuilder.class);
- // register reader that only delegate read's to its children
- registry.addStructuralReader(ROOT_STATE_CONTAINER_ID.child(Vxlans.class), VxlansBuilder.class);
-
- // just adds reader to the structure
- // use addAfter/addBefore if you want to add specific order to readers on the same level of tree
- // use subtreeAdd if you want to handle multiple nodes in single customizer/subtreeAddAfter/subtreeAddBefore if you also want to add order
- // be aware that instance identifier passes to subtreeAdd/subtreeAddAfter/subtreeAddBefore should define subtree,
- // therefore it should be relative from handled node down - InstanceIdentifier.create(HandledNode), not parent.child(HandledNode.class)
- registry.add(new GenericListReader<>(
- // What part of subtree this reader handles is identified by an InstanceIdentifier
- ROOT_STATE_CONTAINER_ID.child(Vxlans.class).child(VxlanTunnel.class),
- // Customizer (the actual translation code to do the heavy lifting)
- new VxlanReadCustomizer(jvppCore, vxlanNamingContext)));
- }
-}
-----
-
-==== Changes to ElementCustomizer
-
-Rename to VxlanWriteCustomizer. Update the code to:
-
-[source,java]
-----
-package io.fd.honeycomb.tutorial.write;
-
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.v3po.util.NamingContext;
-import io.fd.honeycomb.translate.v3po.util.TranslateUtils;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.sample.plugin.params.vxlans.VxlanTunnel;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.sample.plugin.params.vxlans.VxlanTunnelKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.openvpp.jvpp.VppBaseCallException;
-import org.openvpp.jvpp.core.dto.VxlanAddDelTunnel;
-import org.openvpp.jvpp.core.dto.VxlanAddDelTunnelReply;
-import org.openvpp.jvpp.core.future.FutureJVppCore;
-
-/**
- * Writer for {@link VxlanTunnel} list node from our YANG model.
- */
-public final class VxlanWriteCustomizer implements ListWriterCustomizer<VxlanTunnel, VxlanTunnelKey> {
-
- /**
- * JVpp APIs
- */
- private final FutureJVppCore jvppCore;
- /**
- * Shared vxlan tunnel naming context
- */
- private final NamingContext vxlanTunnelNamingContext;
-
- public VxlanWriteCustomizer(final FutureJVppCore jvppCore, final NamingContext vxlanTunnelNamingContext) {
- this.jvppCore = jvppCore;
- this.vxlanTunnelNamingContext = vxlanTunnelNamingContext;
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<VxlanTunnel> id,
- @Nonnull final VxlanTunnel dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- // Create and set vxlan tunnel add request
- final VxlanAddDelTunnel vxlanAddDelTunnel = new VxlanAddDelTunnel();
- // 1 for add, 0 for delete
- vxlanAddDelTunnel.isAdd = 1;
- // dataAfter is the new vxlanTunnel configuration
- final boolean isIpv6 = dataAfter.getSrc().getIpv6Address() != null;
- vxlanAddDelTunnel.isIpv6 = TranslateUtils.booleanToByte(isIpv6);
- vxlanAddDelTunnel.srcAddress = TranslateUtils.ipAddressToArray(isIpv6, dataAfter.getSrc());
- vxlanAddDelTunnel.dstAddress = TranslateUtils.ipAddressToArray(isIpv6, dataAfter.getDst());
- // There are other input parameters that are not exposed by our YANG model, default values will be used
-
- try {
- final VxlanAddDelTunnelReply replyForWrite = TranslateUtils
- .getReplyForWrite(jvppCore.vxlanAddDelTunnel(vxlanAddDelTunnel).toCompletableFuture(), id);
-
- // VPP returns the index of new vxlan tunnel
- final int newVxlanTunnelIndex = replyForWrite.swIfIndex;
- // It's important to store it in context so that reader knows to which name a vxlan tunnel is mapped
- vxlanTunnelNamingContext.addName(newVxlanTunnelIndex, dataAfter.getId(), writeContext.getMappingContext());
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<VxlanTunnel> id,
- @Nonnull final VxlanTunnel dataBefore,
- @Nonnull final VxlanTunnel dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- // Not supported at VPP API level, throw exception
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter,
- new UnsupportedOperationException("Vxlan tunnel update is not supported by VPP"));
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<VxlanTunnel> id,
- @Nonnull final VxlanTunnel dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- // Create and set vxlan tunnel add request
- final VxlanAddDelTunnel vxlanAddDelTunnel = new VxlanAddDelTunnel();
- // 1 for add, 0 for delete
- vxlanAddDelTunnel.isAdd = 0;
- // Vxlan tunnel is identified by its attributes when deleting, not index, so set all attributes
- // dataBefore is the vxlan tunnel that's being deleted
- final boolean isIpv6 = dataBefore.getSrc().getIpv6Address() != null;
- vxlanAddDelTunnel.isIpv6 = TranslateUtils.booleanToByte(isIpv6);
- vxlanAddDelTunnel.srcAddress = TranslateUtils.ipAddressToArray(isIpv6, dataBefore.getSrc());
- vxlanAddDelTunnel.dstAddress = TranslateUtils.ipAddressToArray(isIpv6, dataBefore.getDst());
- // There are other input parameters that are not exposed by our YANG model, default values will be used
-
- try {
- final VxlanAddDelTunnelReply replyForWrite = TranslateUtils
- .getReplyForWrite(jvppCore.vxlanAddDelTunnel(vxlanAddDelTunnel).toCompletableFuture(), id);
- // It's important to remove the mapping from context
- vxlanTunnelNamingContext.removeName(dataBefore.getId(), writeContext.getMappingContext());
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
- }
-}
-----
-
-The '"WriterFactory also needs to be updated:
-
-[source,java]
-----
-package io.fd.honeycomb.tutorial.write;
-
-import com.google.inject.Inject;
-import io.fd.honeycomb.translate.impl.write.GenericWriter;
-import io.fd.honeycomb.translate.v3po.util.NamingContext;
-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.sample.plugin.rev160918.SamplePlugin;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.sample.plugin.params.Vxlans;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.sample.plugin.params.vxlans.VxlanTunnel;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.openvpp.jvpp.core.future.FutureJVppCore;
-
-/**
- * Factory producing writers for sample-plugin plugin's data.
- */
-public final class ModuleWriterFactory implements WriterFactory {
-
- private static final InstanceIdentifier<SamplePlugin> ROOT_CONTAINER_ID = InstanceIdentifier.create(SamplePlugin.class);
-
- /**
- * Injected vxlan naming context shared with writer, provided by this plugin
- */
- @Inject
- private NamingContext vxlanNamingContext;
- /**
- * Injected jvpp core APIs, provided by Honeycomb's infrastructure
- */
- @Inject
- private FutureJVppCore jvppCore;
-
- @Override
- public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
- // Unlike ReaderFactory, there's no need to add structural writers, just the writers that actually do something
-
- // register writer for vxlan tunnel
- registry.add(new GenericWriter<>(
- // What part of subtree this writer handles is identified by an InstanceIdentifier
- ROOT_CONTAINER_ID.child(Vxlans.class).child(VxlanTunnel.class),
- // Customizer (the actual translation code to do the heavy lifting)
- new VxlanWriteCustomizer(jvppCore, vxlanNamingContext)));
- }
-}
-----
-
-==== Changes to Module
-The module needs to be updated to:
-
-* Include new instance of naming context
-* Remove crud service
-
-and the code needs to look like:
-
-[source,java]
-----
-package io.fd.honeycomb.tutorial;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.multibindings.Multibinder;
-import io.fd.honeycomb.data.init.DataTreeInitializer;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.v3po.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import io.fd.honeycomb.tutorial.init.ConfigDataInitializer;
-import io.fd.honeycomb.tutorial.read.ModuleStateReaderFactory;
-import io.fd.honeycomb.tutorial.write.ModuleWriterFactory;
-import net.jmob.guice.conf.core.ConfigurationModule;
-
-/**
- * Module class instantiating sample-plugin plugin components.
- */
-public final class Module extends AbstractModule {
-
- @Override
- protected void configure() {
- // requests injection of properties
- install(ConfigurationModule.create());
- requestInjection(ModuleConfiguration.class);
-
- // bind naming context instance for reader and writer factories
- // the first parameter is artificial name prefix in cases a name needs to be reconstructed for a vxlan tunnel
- // that is present in VPP but not in Honeycomb (could be extracted into configuration)
- // the second parameter is just the naming context ID (could be extracted into configuration)
- binder().bind(NamingContext.class).toInstance(new NamingContext("vxlan-tunnel", "vxlan-tunnel-context"));
-
- // creates reader factory binding
- // can hold multiple binding for separate yang modules
- final Multibinder<ReaderFactory> readerFactoryBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class);
- readerFactoryBinder.addBinding().to(ModuleStateReaderFactory.class);
-
- // create writer factory binding
- // can hold multiple binding for separate yang modules
- final Multibinder<WriterFactory> writerFactoryBinder = Multibinder.newSetBinder(binder(), WriterFactory.class);
- writerFactoryBinder.addBinding().to(ModuleWriterFactory.class);
-
- // create initializer binding
- // can hold multiple binding for separate yang modules
- final Multibinder<DataTreeInitializer> initializerBinder =
- Multibinder.newSetBinder(binder(), DataTreeInitializer.class);
- initializerBinder.addBinding().to(ConfigDataInitializer.class);
-
- // Disable notification producer for now
-// Multibinder.newSetBinder(binder(), ManagedNotificationProducer.class).addBinding()
-// .to(SampleNotificationProducer.class);
- }
-}
-----
-*Now it's time to rebuild the plugin using mvn clean install to make the jars available for integrating them with vpp-integration distribution in next sections*
-
-== Integrating with vpp-integration distribution
-The vxlan tunnel management plugin can now be integrated with any honeycomb distribution. Honeycomb provides a vpp-integration distribution, where all VPP related plugins integrate to create a distribution with all available VPP related features.
-
-This distribution comes with honeycomb infrastructure + common components for VPP Honeycomb plugins (e.g. Java APIs for VPP).
-
-In order to add this new plugin into vpp-integration:
-
-* clone honeycomb codebase (since that's the home of vpp-integration distribution)
-* add a dependency for this sample plugin in vpp-integration distribution (honeycomb/vpp-integration/minimal-distribution/pom.xml):
-
-[source,xml,subs="+attributes"]
-----
-<dependency>
- <groupId>io.fd.honeycomb.tutorial</groupId>
- <artifactId>sample-plugin-impl</artifactId>
- <version>{project-version}</version>
-</dependency>
-----
-
-* modify Main of vpp-integration distribution to include sample-plugin (/home/mmarsale/Projects/honeycomb/vpp-integration/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/integration/distro/Main.java):
-[source,java]
-----
-package io.fd.honeycomb.vpp.integration.distro;
-
-import com.google.common.collect.Lists;
-import com.google.inject.Module;
-import io.fd.honeycomb.vpp.distro.VppCommonModule;
-import java.util.List;
-
-public class Main {
-
- public static void main(String[] args) {
- final List<Module> sampleModules = Lists.newArrayList(io.fd.honeycomb.infra.distro.Main.BASE_MODULES);
-
- // All the plugins should be listed here
- sampleModules.add(new VppCommonModule());
-// Comment out V3po and Lisp module for the time being, since V3po and sample-plugin are in conflict over vxlan tunnel management
-// a plugin implementing VPP's API that's not yet covered by V3po or LISP plugin would not have to do this
-// sampleModules.add(new V3poModule());
-// sampleModules.add(new LispModule());
- sampleModules.add(new io.fd.honeycomb.tutorial.Module());
-
- io.fd.honeycomb.infra.distro.Main.init(sampleModules);
- }
-}
-----
-
-Now just rebuild the honeycomb project.
-
-== Verifying distribution
-At this point, the vpp-integration distribution with sample-plugin can now be started. But first, make sure that a compatible version of VPP is installed and running. Next, start honeycomb with:
-
- sudo vpp-integration/minimal-distribution/target/vpp-integration-distribution-1.16.9-hc/vpp-integration-distribution-1.16.9/honeycomb
-
-=== Testing over RESTCONF
-Reading vxlans operational data (should return empty vxlans container at first):
-
- curl -u admin:admin http://localhost:8181/restconf/operational/sample-plugin:sample-plugin-state
-
-Adding a vxlan tunnel:
-
- curl -H 'Content-Type: application/json' -H 'Accept: application/json' -u admin:admin -X PUT -d '{"vxlans":{"vxlan-tunnel": [{"id":"vxlan-test-tunnel", "src":"10.0.0.1", "dst":"10.0.0.2"}]}}' http://localhost:8181/restconf/config/sample-plugin:sample-plugin/vxlans
-
-Reading vxlans config data (data that we posted to Honeycomb):
-
- curl -u admin:admin http://localhost:8181/restconf/config/sample-plugin:sample-plugin
-
-Reading vxlans operational data (data coming from VPP being transformed by ReaderCustomizer on the fly):
-
- curl -u admin:admin http://localhost:8181/restconf/operational/sample-plugin:sample-plugin-state
-
-Verifying vxlan tunnel existence in VPP:
-
- telnet 0 5002
- show interface
-
-should show:
-
-[source]
-----
-Name Idx State Counter Count
-local0 0 down
-vxlan_tunnel0 1 up
-----
-
-Deleting a vxlan tunnel:
-
- curl -u admin:admin -X DELETE http://localhost:8181/restconf/config/sample-plugin:sample-plugin/vxlans/vxlan-tunnel/vxlan-test-tunnel
-
-Disclaimer: The vxlan tunnel will be removed from Honeycomb, and delete command will be executed on VPP, but VPP will just disable that interface and keep it as some sort of placeholder for next vxlan tunnel (that's VPPs behavior, so a vxlan tunnel cant be really deleted). So that's why you would still see the tunnel in VPP's CLI after delete.
-
-==== Testing over NETCONF
-Netconf testing guide including Notifications, can be found in Honeycomb/Running_Honeycomb.
-
-NOTE: Netconf and Restconf are equivalent interfaces to Honeycomb, being capable of providing the same APIs. The only difference is with notifications. Only NETCONF is capable of emitting the notifications.
-
-== Full working sample
-
-Full working sample on github: https://github.com/marosmars/honeycomb-samples/tree/vpp-plugin
-
-[NOTE]
-====
-just a note on what further work for this plugin might contain:
-
-* unit tests
-* POSTMAN REST collection with sample requests
-* logging
-====
diff --git a/release-notes/src/main/asciidoc/install_guide/install_from_available_archives.adoc b/release-notes/src/main/asciidoc/install_guide/install_from_available_archives.adoc
deleted file mode 100644
index 5eeb4fee2..000000000
--- a/release-notes/src/main/asciidoc/install_guide/install_from_available_archives.adoc
+++ /dev/null
@@ -1,14 +0,0 @@
-= Installing from available archives
-
-link:release_notes.html[< Home]
-
-Honeycomb provides zip and tar.gz archives that can be downloaded and extracted to provide Honeycomb VPP distribution.
-
-== Downloading archives
-In https://nexus.fd.io/#nexus-search;quick~vpp-integration-distribution[Honeycomb's nexus] look for vpp-integration-distribution artifact with version {project-version} and download either zip or tar.gz. After Extracting the archive, a folder vpp-integration-distribution-<version> will be created.
-
-== Running extracted distribution[edit]
-In the new folder, locate honeycomb executable shell script and run it.
-
-Note: sudo privileges are necessary with default configuration.
-
diff --git a/release-notes/src/main/asciidoc/install_guide/install_from_available_binary_packages.adoc b/release-notes/src/main/asciidoc/install_guide/install_from_available_binary_packages.adoc
deleted file mode 100644
index c9e629427..000000000
--- a/release-notes/src/main/asciidoc/install_guide/install_from_available_binary_packages.adoc
+++ /dev/null
@@ -1,66 +0,0 @@
-= Installing from available binary packages
-
-link:release_notes.html[< Home]
-
-== Centos
-=== CentOS 7.2 - Honeycomb Release RPMs
-==== Add fd.io repo
-Create a file /etc/yum.repos.d/honeycomb-release.repo with contents:
-
- [honeycomb-release]
- name=honeycomb release branch latest merge
- baseurl=https://nexus.fd.io/content/repositories/fd.io.centos7/
- enabled=1
- gpgcheck=0
-
-==== Install honeycomb packages
-
- sudo yum install honeycomb
-
-== Ubuntu
-=== Ubuntu 14.04 - Honeycomb Release DEB
-
-[CAUTION]
-====
-Add openjdk-8 repository. 1404 does not provide openjdk-8 by default
-
- According to http://stackoverflow.com/questions/32942023/ubuntu-openjdk-8-unable-to-locate-package
-====
-
-Pick Ubuntu version:
-
- export UBUNTU="trusty"
-
-Then run:
-
- sudo rm /etc/apt/sources.list.d/99fd.io.list
- echo "deb [trusted=yes] https://nexus.fd.io/content/repositories/fd.io.ubuntu.$UBUNTU.main/ ./" | sudo tee -a /etc/apt/sources.list.d/99fd.io.list
- sudo apt-get update
- sudo apt-get install honeycomb
-
-[CAUTION]
-====
-Uninstall previously installed java 7
-
- look for packages e.g. openjdk-7-* and uninstall them
-====
-
-=== Ubuntu 16.04 - Honeycomb Release DEB
-
-Pick Ubuntu version:
-
- export UBUNTU="xenial"
-
-Then run:
-
- sudo rm /etc/apt/sources.list.d/99fd.io.list
- echo "deb [trusted=yes] https://nexus.fd.io/content/repositories/fd.io.ubuntu.$UBUNTU.main/ ./" | sudo tee -a /etc/apt/sources.list.d/99fd.io.list
- sudo apt-get update
- sudo apt-get install honeycomb
-
-== SNAPSHOT versions
-
-For SNAPSHOT versions, SNAPSHOT repositories have to be used.
-Each branch has its own repository at: https://nexus.fd.io/content/repositories/.
-In case SNAPSHOT versions needs to be used, update the URL pointing to the repository from previous steps
-according to the repository names listed at provided link. \ No newline at end of file
diff --git a/release-notes/src/main/asciidoc/install_guide/install_guide.adoc b/release-notes/src/main/asciidoc/install_guide/install_guide.adoc
deleted file mode 100644
index de2e02eda..000000000
--- a/release-notes/src/main/asciidoc/install_guide/install_guide.adoc
+++ /dev/null
@@ -1,23 +0,0 @@
-== Install guide
-
-Installing binaries:
-
-* link:install_from_available_binary_packages.html[Installing from available binary packages]
-* link:install_from_available_archives.html[Installing from available archives]
-
-=== Manual build
-
-* link:install_manual_build.html[Manual build]
-
-=== Distribution notes
-Honeycomb is packaged as a static set of jars, that are loaded by Honeycomb Main class, where pre-configured plugins are then started.
-
-=== Footprint
-
-Minimal footprint for Honeycomb infrastructure (without any plugins) at rest below 100Mb. For Honeycomb distribution with VPP related plugins, minimal footprint was observed below 150Mb.
-The footprint varies depending on:
-
-* VM load. Under heavier load, JVM tends to release some unused memory used during Honeycomb initialization.
-* Northbound interface configuration (4 interfaces started by default: Restconf HTTP, HTTPS, Netconf TCP, SSH). Minimal footprint can be achieved by using only a single interface.
-* JVM configuration. Even lower footprint numbers can be achieved by using aggressive JVM memory options: -client -Xms20m -Xmx32m -XX:MetaspaceSize=5m -XX:MaxMetaspaceSize=32m -XX:MaxMetaspaceExpansion=1m -Xss512k -XX:+UseSerialGC -Djava.compiler=NONE -Xverify:none -noverify
-* Amount of data stored by Honeycomb. \ No newline at end of file
diff --git a/release-notes/src/main/asciidoc/install_guide/install_manual_build.adoc b/release-notes/src/main/asciidoc/install_guide/install_manual_build.adoc
deleted file mode 100644
index 82ab84413..000000000
--- a/release-notes/src/main/asciidoc/install_guide/install_manual_build.adoc
+++ /dev/null
@@ -1,206 +0,0 @@
-= Manual build
-
-link:release_notes.html[< Home]
-
-== Prerequisites
-Building Honeycomb project requires:
-
-* Java 8
-* Maven (version 3.2.5 and above should be fine)
-* Properly set maven settings(displayed below) to access nexus.fd.io
-
-== Obtain the honeycomb source code
-TIP: Make sure you have https://wiki.fd.io/view/DEV/Setting_up_Gerrit[registered your ssh key with gerrit].
-
-[subs="+attributes"]
- git clone ssh://[username]@gerrit.fd.io:29418/honeycomb
- cd honeycomb
- git checkout {project-branch}
-
-== Building the code
-Make sure all the prerequisites are installed.
-
-NOTE: To make sure fresh Honeycomb build is compatible with VPP, building VPP is also required to make sure the same JVpp version is used preventing out-of-sync exceptions. In case only Honeycomb needs to be built, skip Building VPP section.
-
-=== Building VPP
-Clone VPP according to: https://gerrit.fd.io/r/#/admin/projects/vpp and checkout {project-branch} branch
-
-Dive into VPP's build-root folder:
-
- cd vpp/build-root/
-
-Build VPP:
-
- make distclean && ./bootstrap.sh && make V=0 PLATFORM=vpp TAG=vpp install-deb
-
-Install VPP:
-
- sudo dpkg -i *.deb
-
-Start VPP:
-
- sudo start vpp
-
-Install JVpp into local maven repository to make Honeycomb pick up the same JVpp version
-
-[subs="+attributes"]
- cd build-vpp-native/vpp-api/java/
- mvn install:install-file -Dfile=jvpp-registry-{project-vpp-version}.jar -DgroupId=io.fd.vpp -DartifactId=jvpp-registry -Dversion={project-vpp-snapshot-version} -Dpackaging=jar
- mvn install:install-file -Dfile=jvpp-core-{project-vpp-version}.jar -DgroupId=io.fd.vpp -DartifactId=jvpp-core -Dversion={project-vpp-snapshot-version}-Dpackaging=jar
- cd ../../plugins/snat-plugin/
- mvn install:install-file -Dfile=jvpp-snat-{project-snat-version}.jar -DgroupId=io.fd.vpp -DartifactId=jvpp-snat -Dversion={project-snat-snapshot-version} -Dpackaging=jar
-
-Now current Vpp is up and running and prepared for integration with HC.
-
-=== Building Honeycomb
-Now Honeycomb can be built and it will use latest JVpp produced during VPP build.
-
-==== Setup settings.xml
-Put the following in your ~/.m2/settings.xml:
-
-[source,xml]
-----
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=2 tabstop=2: -->
-<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
-
- <profiles>
- <profile>
- <id>fd.io-release</id>
- <repositories>
- <repository>
- <id>fd.io-mirror</id>
- <name>fd.io-mirror</name>
- <url>https://nexus.fd.io/content/groups/public/</url>
- <releases>
- <enabled>true</enabled>
- <updatePolicy>never</updatePolicy>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>fd.io-mirror</id>
- <name>fd.io-mirror</name>
- <url>https://nexus.fd.io/content/repositories/public/</url>
- <releases>
- <enabled>true</enabled>
- <updatePolicy>never</updatePolicy>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
- </profile>
-
- <profile>
- <id>fd.io-snapshots</id>
- <repositories>
- <repository>
- <id>fd.io-snapshot</id>
- <name>fd.io-snapshot</name>
- <url>https://nexus.fd.io/content/repositories/fd.io.snapshot/</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>fd.io-snapshot</id>
- <name>fd.io-snapshot</name>
- <url>https://nexus.fd.io/content/repositories/fd.io.snapshot/</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
- </profile>
- <profile>
- <id>opendaylight-snapshots</id>
- <repositories>
- <repository>
- <id>opendaylight-snapshot</id>
- <name>opendaylight-snapshot</name>
- <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>opendaylight-shapshot</id>
- <name>opendaylight-snapshot</name>
- <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
- </profile>
- </profiles>
-
- <activeProfiles>
- <activeProfile>fd.io-release</activeProfile>
- <activeProfile>fd.io-snapshots</activeProfile>
- <activeProfile>opendaylight-snapshots</activeProfile>
- </activeProfiles>
-</settings>
-----
-
-==== Building Honeycomb
-cd honeycomb/
-
- mvn clean install
-
-[NOTE]
-=====
-To perform quick build(no tests, no checks, no docs) run:
-
- mvn clean install -DskipTests -Dcheckstyle.skip -Dmaven.javadoc.skip=true -Djacoco.skip
-=====
-
-Now Honeycomb can be run with:
-
-[subs="+attributes"]
- sudo sh vpp-integration/minimal-distribution/target/vpp-integration-distribution-{project-version}-hc/vpp-integration-distribution-{project-version}/honeycomb
-
-=== Building packages
-After the code has been built, you can build an RPM or DEB package for honeycomb.
-
-==== RPM
-Export build number variable:
-
- export BUILD_NUMBER=33
-
-Run package building script from:
-
- packaging/rpm/rpmbuild.sh
-
-==== DEB
-Export build number variable:
-
- export BUILD_NUMBER=33
-
-Run package building script from:
-
- packaging/deb/debuild.sh \ No newline at end of file
diff --git a/release-notes/src/main/asciidoc/release_notes.adoc b/release-notes/src/main/asciidoc/release_notes.adoc
index 940c8e067..785ac4df9 100644
--- a/release-notes/src/main/asciidoc/release_notes.adoc
+++ b/release-notes/src/main/asciidoc/release_notes.adoc
@@ -1,6 +1,15 @@
= Honeycomb {project-version} Release notes
-Release notes for honeycomb {project-version}. Based on VPP {project-vpp-snapshot-version}
+Release notes for honeycomb {project-version}.
+
+Honeycomb is a generic NETCONF/RESTCONF management agent and provides a framework
+for building specialized agents.
+
+The biggest use case of honeycomb is VPP (fd.io's Vector packet processor).
+Honeycomb delivers a management agent to enable integration of VPP with e.g. SDN controllers such as Opendaylight.
+
+For VPP specific distribution of Honeycomb, refer to:
+!!!!! FIXME/TODO add link !!!!!!
== Release plan
https://wiki.fd.io/view/Honeycomb/Release_Plans/Release_Plan_{project-public-version}[Release plan]
@@ -9,13 +18,10 @@ https://wiki.fd.io/view/Honeycomb/Release_Plans/Release_Plan_{project-public-ver
Adding to the list of existing features: https://wiki.fd.io/view/Honeycomb/Releases/1609#Features[1609 feature list]:
=== New features
-* https://jira.fd.io/browse/HONEYCOMB-132[NAT management]
-* https://jira.fd.io/browse/HONEYCOMB-257[iOAM management]
=== Removed features
=== Modified features
-* ACL management improvements
* https://jira.fd.io/browse/HONEYCOMB-73[Initializers tie-in with readers]
** Instead of root level initializer, initialization can be split among multiple initializing readers
* https://jira.fd.io/browse/HONEYCOMB-270[Readers/ReadCustomizers able to influence presence of resulting data]
@@ -28,8 +34,6 @@ Adding to the list of existing features: https://wiki.fd.io/view/Honeycomb/Relea
* https://jira.fd.io/projects/HONEYCOMB/versions/{project-version-in-jira}[JIRA]
* https://jira.fd.io/jira/secure/ReleaseNote.jspa?projectId=10001&version={project-version-in-jira}[Release notes]
-include::install_guide/install_guide.adoc[]
-
include::user_guide/user_guide.adoc[]
include::devel_guide/devel_guide.adoc[] \ No newline at end of file
diff --git a/release-notes/src/main/asciidoc/user_guide/user_guide.adoc b/release-notes/src/main/asciidoc/user_guide/user_guide.adoc
index 0f72c8bc9..e1d7b3001 100644
--- a/release-notes/src/main/asciidoc/user_guide/user_guide.adoc
+++ b/release-notes/src/main/asciidoc/user_guide/user_guide.adoc
@@ -1,54 +1,6 @@
== User guide
-=== Running Honeycomb
-link:user_running_honeycomb.html[Running Honeycomb]
+Honeycomb provides a framework for building management agents, and as a standalone out of the box
+tool provides no value.
-=== Troubleshooting
-link:user_troubleshooting.html[Troubleshooting]
-
-=== Honeycomb and ODL
-link:user_honeycomb_and_ODL.html[Mounting Honeycomb in ODL]
-
-=== Configuration files
-Honeycomb's configuration files present within its distribution:
-
-* Honeycomb infra:
-** {project-git-web}/infra/minimal-distribution/src/main/resources/honeycomb-minimal-resources/config/honeycomb.json?h={project-branch}[Honeycomb base configuration]
-* Honeycomb vpp plugins commons:
-** {project-git-web}/vpp-common/vpp-common-integration/src/main/resources/honeycomb-minimal-resources/config/jvpp.json?h={project-branch}[VPP plugins common configuration]
-* V3PO plugin:
-** {project-git-web}/v3po/v3po2vpp/src/main/resources/honeycomb-minimal-resources/config/v3po.json?h={project-branch}[V3PO plugin for Honeycomb configuration]
-* LISP plugin
-** {project-git-web}/lisp/lisp2vpp/src/main/resources/honeycomb-minimal-resources/config/lisp.json?h={project-branch}[LISP plugin for Honeycomb configuration]
-* NSH plugin:
-** {project-git-web}/nsh/impl/src/main/resources/honeycomb-minimal-resources/config/vppnsh.json?h={project-branch}[NSH_SFC plugin for Honeycomb configuration]
-* iOAM plugin:
-** {project-git-web}/ioam/impl/src/main/resources/honeycomb-minimal-resources/config/vppioam.json?h={project-branch}[IOAM plugin for Honeycomb configuration]
-
-=== YANG models
-
-* V3PO plugin
-** {project-git-web}/v3po/api/src/main/yang?h={project-branch}[V3PO YANG models]
-* LISP plugin
-** {project-git-web}/lisp/api/src/main/yang?h={project-branch}[LISP YANG models]
-* NSH plugin
-** {project-git-web}/nsh/api/src/main/yang?h={project-branch}[NSH YANG models]
-* NAT plugin
-** {project-git-web}/nat/nat-api/src/main/yang?h={project-branch}[NAT YANG models]
-* iOAM plugin
-** {project-git-web}/ioam/api/src/main/yang?h={project-branch}[IOAM YANG models]
-* Context models
-** {project-git-web}/vpp-common/naming-context-api/src/main/yang?h={project-branch}[Context YANG models]
-
-=== POSTMAN collections
-
-* V3PO plugin
-** {project-git-web}/v3po/postman_rest_collection.json?h={project-branch}[V3PO postman collection]
-* LISP plugin
-** {project-git-web}/lisp/lisp_postman_rest_collection.json?h={project-branch}[LISP postman collection]
-* NSH plugin
-** {project-git-web}/nsh/nsh_postman_rest_collection.json?h={project-branch}[NSH postman collection]
-* NAT plugin
-** {project-git-web}/nat/postman_rest_collection.json?h={project-branch}[NAT postman collection]
-* iOAM plugin
-** {project-git-web}/ioam/ioam_trace_postman_collection.json?h={project-branch}[IOAM postman collection]
+Refer to devel guide for how to utilize Honeycomb. \ No newline at end of file
diff --git a/release-notes/src/main/asciidoc/user_guide/user_honeycomb_and_ODL.adoc b/release-notes/src/main/asciidoc/user_guide/user_honeycomb_and_ODL.adoc
deleted file mode 100644
index 23c7e521c..000000000
--- a/release-notes/src/main/asciidoc/user_guide/user_honeycomb_and_ODL.adoc
+++ /dev/null
@@ -1,76 +0,0 @@
-= Honeycomb and ODL
-
-link:release_notes.html[< Home]
-
-Honeycomb can be managed using ODL as any NETCONF-enabled device. Please follow https://wiki.opendaylight.org/view/OpenDaylight_Controller:Config:Examples:Netconf for detailed instructions how to mount and connect to a NETCONF device
-
-== Troubleshooting
-
-Issues with Honeycomb and ODL integration
-
-=== Unable to open SSH session due to invalid crypto configuration
-
-If ODL fails to open ssh session due to InvalidAlgorithmParameterException, e.g.:
-
-[srouce]
-====
-2016-09-13 13:52:34,852 | WARN | NioProcessor-3 | ClientSessionImpl | 180 -
-org.apache.sshd.core - 0.14.0 | Exception caught
-java.security.InvalidAlgorithmParameterException: Prime size must be multiple of 64,
-and can only range from 512 to 2048 (inclusive)
- at com.sun.crypto.provider.DHKeyPairGenerator.initialize(DHKeyPairGenerator.java:120)
- [sunjce_provider.jar:1.8.0_45]
- at java.security.KeyPairGenerator$Delegate.initialize(KeyPairGenerator.java:674)
- [:1.8.0_45-internal]
- at java.security.KeyPairGenerator.initialize(KeyPairGenerator.java:411)
- [:1.8.0_45-internal]
- at org.apache.sshd.common.kex.DH.getE(DH.java:65)[180:org.apache.sshd.core:0.14.0]
-
-...
-
-2016-09-13 13:52:34,852 | DEBUG | NioProcessor-3 | ClientSessionImpl | 180 -
-org.apache.sshd.core - 0.14.0 | Closing ClientSessionImpl[admin@/127.0.0.1:2835] immediately
-====
-
-It probably means BouncyCastle provider is not properly configured/loaded on the ODL side.
-
-There are 2 solutions to this problem:
-
-==== Solution 1, HC side, less secure:
-
-First solution is to not use BouncyCastle in Honeycomb. This limits its capabilities in terms of security (using just default Java stuff), but makes it compatible with Opendaylight:
-
-As a workaround start honeycomb with (must be placed into Honeycomb's startup script)
-
- -Dorg.apache.sshd.registerBouncyCastle=false
-
-As a result 1024 bit DH group will be used for SSH key exchange.
-
-==== Solution 2, ODL side, more secure
-Second solution is to locate mina sshd jar in ODL distribution's system folder. For Boron it is:
-
- system/org/apache/sshd/sshd-core/0.14.0/sshd-core-0.14.0.jar
-
-Open the jar (it's just a zip archive), locate META-INF/MANIFEST.MF file, open it and update the Import-Package section. Find this piece:
-
- org.bouncycast.openssl;version="[1.51,2)";resolution:=optional
-
-and replace it with:
-
- org.bouncycast.openssl;version="[1.51,2)"
-
-This needs to be done before ODL is started the first time or it needs to be started with "clean" parameter.
-
-=== Background
-This issue is caused by a couple of reasons:
-
-* ODL and HC both use mina-sshd 0.14 for SSH
-* mina-sshd relies partially on bouncy-castle as a security provider
-* mina-sshd only defines bouncy-castle dependencies as optional for OSGi environment (which is not correct since there are bugs in the mina-sshd where missing bouncy-castle is just not expected, causing various problems... but that's a different topic)
-* netconf features in ODL make sure to first load bouncy-castle bundles and only then mina-sshd (in addition, bouncy-castle provider is placed in karaf's lib/ext and marked to be a security provider in karaf's etc/custom.properties)
-* however, when loading netconf features as initial features, there seems to be some sort of race condition in karaf and mina is started without bouncy-castle available, making it work only partially
-* but so far so good, everything loads and mina should just use less secure provider from Java
-* however when an SSH connection is started from ODL to e.g. Honeycomb. Mina-sshd is picking key size that's only supported by bouncy-castle (not by plain JDK) during negotiation
-* this means that if remote supports such size, mina-sshd in ODL subsequently fails, since it finds out bouncy-castle is not present and Java is unable to handle it
-
-NOTE: If loading netconf post karaf startup manually, the issue does not appear \ No newline at end of file
diff --git a/release-notes/src/main/asciidoc/user_guide/user_running_honeycomb.adoc b/release-notes/src/main/asciidoc/user_guide/user_running_honeycomb.adoc
deleted file mode 100644
index 07b82a59f..000000000
--- a/release-notes/src/main/asciidoc/user_guide/user_running_honeycomb.adoc
+++ /dev/null
@@ -1,119 +0,0 @@
-= Running Honeycomb
-
-link:release_notes.html[< Home]
-
-== Starting Honeycomb agent
-The zipped vpp-integration distribution can be started by invoking:
-
-[subs="+attributes"]
- sudo ./vpp-integration-distribution-{project-version}/honeycomb
-
-This will start Honeycomb with all ODL dependencies and VPP translation code. It will automatically initialize vpp-jvpp to create interface between VPP and Honeycomb.
-
-If Honeycomb was installed from the RPM or DEB packages, it can be started by (make sure you start vpp first):
-
- sudo service vpp start
- sudo service honeycomb start
-
-The location of installed honeycomb is at /opt/honeycomb
-
-== Testing Honeycomb agent
-There are multiple ways of testing Honeycomb agent, depending on e.g. which northbound interface will be used
-
-=== Using NETCONF Northbound
-
-Netconf northbound can be easily tested manually using CLI SSH client. Initialize SSH connection by invoking:
-
- ssh admin@localhost -p 2831 -s netconf
-
-NOTE: Using default credentials admin/admin, default port 2831 and netconf SSH channel Note: "Are you sure you want to continue connecting (yes/no)?" Answer yes
-
-Next thing to do is to provide client hello message to initialize netconf session. Following content must be copy&pasted into SSH session + hit enter:
-
-[source,xml]
-----
-<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
- <capabilities>
- <capability>urn:ietf:params:netconf:base:1.0</capability>
- </capabilities>
-</hello>
-]]>]]>
-----
-
-This initializes netconf session silently. No response from Honeycomb will be provided
-
-Next step is to get all the configuration data from VPP using Honeycomb's netconf northbound interface. Following content must be copy&pasted into SSH session + hit enter:
-
-[source,xml]
-----
-<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
- <get-config>
- <source>
- <running/>
- </source>
- </get-config>
-</rpc>
-]]>]]>
-----
-
-Honeycomb will respond will all the data currently configured in Honeycomb + VPP
-
-Next step is to get all the operational data from VPP using Honeycomb's netconf northbound interface. Following content must be copy&pasted into SSH session + hit enter:
-
-[source,xml]
-----
-<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
- <get/>
-</rpc>
-]]>]]>
-----
-
-Honeycomb will respond will all operational data present in VPP.
-
-==== Listening for notifications
-
-Notifications over NETCONF are supported by Honeycomb. To test it out, open ssh NETCONF session and send hello message. Exactly as detailed above.
-
-Next thing to do is to activate honeycomb notification stream over NETCONF. So just send this rpc over ssh session:
-
-[source,xml]
-----
-<netconf:rpc netconf:message-id="101" xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
-<create-subscription xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
- <stream>honeycomb</stream>
-</create-subscription>
-</netconf:rpc>
-]]>]]>
-----
-
-From now on, all notifications from honeycomb will appear in the netconf session. To verify, VPP's interface state can be changed over CLI:
-
- telnet 0 5002
- set interface state local0 up
-
-A notification should appear in opened NETCONF session.
-
-=== Using RESTCONF northbound
-
-[TIP]
-====
-Testing over RESTCONF is easier, and common calls can be found in this postman collection:
-
-* {project-git-web}/v3po/postman_rest_collection.json?h={project-branch}[V3PO postman collection][Honeycomb V3PO POSTMAN collection]*
-
-Each request in the collection contains equivalent VPP command (over CLI or VAT, whichever works) in the description.
-====
-
-To use:
-
-* POSTMAN is a google chrome application
-* Clicking the collection link above is not CORRECT
-* Open POSTMAN and select Import https://www.dropbox.com/s/v2odj4gih5if99d/Screenshot%202016-05-19%2008.51.45.png?dl=0
-* Select import from link https://www.dropbox.com/s/s6wsqzf7h4yhesh/Screenshot%202016-05-19%2008.52.54.png?dl=0
-* Copy the link above into the dialogue https://www.dropbox.com/s/3qc3bbndhy6rr1g/Screenshot%202016-05-19%2008.53.30.png?dl=0
-* PROFIT! https://www.dropbox.com/s/lrdtua7zziqyqc3/Screenshot%202016-05-19%2008.53.51.png?dl=0
-
-NOTE: All POSTMAN collections are listed under User Guide.
-
-==== Listening for notifications
-Notifications over RESTCONF are not supported due to ODL's RESTCONF limitations. \ No newline at end of file
diff --git a/release-notes/src/main/asciidoc/user_guide/user_troubleshooting.adoc b/release-notes/src/main/asciidoc/user_guide/user_troubleshooting.adoc
deleted file mode 100644
index 42215f261..000000000
--- a/release-notes/src/main/asciidoc/user_guide/user_troubleshooting.adoc
+++ /dev/null
@@ -1,20 +0,0 @@
-= Troubleshooting
-
-link:release_notes.html[< Home]
-
-CAUTION: Trying to fix any Honeycomb issue should start with looking at honeycomb log file (default location: /var/log/honeycomb/)
-
-== Unable to open SSH session
-If following warning is shown when invoking ssh command: WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!. Just invoke (as suggested by the warning):
-
- ssh-keygen -f ...
-
-== Honeycomb fails to start properly
-First thing to do is to take a look at Honeycomb logs(default location: /var/log/honeycomb/).
-
-If following log message is present: VPP-ERROR: VPP api client connection failed java.io.IOException: Connection returned error -1. Make sure VPP is installed in the system and it's running.
-
-NOTE: If the VPP-ERROR also contains message stating vpp japi out of sync. It indicates incompatible versions of VPP and Honeycomb.
-
-== Honeycomb does not respond
-Check suggestions from previous item: Honeycomb fails to start properly \ No newline at end of file
diff --git a/routing/asciidoc/Readme.adoc b/routing/asciidoc/Readme.adoc
deleted file mode 100644
index 2add06ff4..000000000
--- a/routing/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= routing-aggregator
-
-Overview of routing-aggregator \ No newline at end of file
diff --git a/routing/pom.xml b/routing/pom.xml
deleted file mode 100644
index e947d457e..000000000
--- a/routing/pom.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>honeycomb-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../common/honeycomb-parent</relativePath>
- </parent>
-
- <groupId>io.fd.honeycomb.routing</groupId>
- <artifactId>routing-aggregator</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <name>${project.artifactId}</name>
- <packaging>pom</packaging>
- <modelVersion>4.0.0</modelVersion>
- <prerequisites>
- <maven>3.1.1</maven>
- </prerequisites>
- <description>Aggregator for Honeycomb Routing plugin</description>
-
- <modules>
- <module>routing-api</module>
- </modules>
-
- <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/routing/routing-api/asciidoc/Readme.adoc b/routing/routing-api/asciidoc/Readme.adoc
deleted file mode 100644
index af09b9fa7..000000000
--- a/routing/routing-api/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,8 +0,0 @@
-= routing-api
-
-Contains 4 models
-
-- *ietf-routing* - Common model for routing
-- *ietf-ipv4-unicast-routing* - Ipv4 address family specific routing
-- *ietf-ipv6-unicast-routing* - Ipv6 address family specific routing
-- *vpp-routing* - Vpp specific attributes necessary to map routes
diff --git a/routing/routing-api/pom.xml b/routing/routing-api/pom.xml
deleted file mode 100644
index 92c8824d7..000000000
--- a/routing/routing-api/pom.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>api-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../../common/api-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.routing</groupId>
- <artifactId>routing-api</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>mdsal-model-artifacts</artifactId>
- <version>0.8.2-Beryllium-SR2</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>iana-if-type-2014-05-08</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-yang-types-20130715</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-interfaces</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-inet-types-2013-07-15</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>yang-ext</artifactId>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.v3po</groupId>
- <artifactId>v3po-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/routing/routing-api/src/main/yang/ietf-ipv4-unicast-routing.yang b/routing/routing-api/src/main/yang/ietf-ipv4-unicast-routing.yang
deleted file mode 100644
index ed320fd2d..000000000
--- a/routing/routing-api/src/main/yang/ietf-ipv4-unicast-routing.yang
+++ /dev/null
@@ -1,421 +0,0 @@
-module ietf-ipv4-unicast-routing {
-
- namespace "urn:ietf:params:xml:ns:yang:ietf-ipv4-unicast-routing";
-
- prefix "v4ur";
-
- import ietf-routing {
- prefix "rt";
- }
-
- import ietf-inet-types {
- prefix "inet";
- }
-
- //TODO modification needed because of yangtools bug(unable to proceed augmentation in separate model of augmentation in this model)
- import vpp-routing {
- prefix vpp-r;
- }
-
- organization
- "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
-
- contact
- "WG Web: <http://tools.ietf.org/wg/netmod/>
- WG List: <mailto:netmod@ietf.org>
-
- WG Chair: Thomas Nadeau
- <mailto:tnadeau@lucidvision.com>
-
- WG Chair: Juergen Schoenwaelder
- <mailto:j.schoenwaelder@jacobs-university.de>
-
- Editor: Ladislav Lhotka
- <mailto:lhotka@nic.cz>";
-
- description
- "This YANG module augments the 'ietf-routing' module with basic
- configuration and operational state data for IPv4 unicast
- routing.
-
- Copyright (c) 2014 IETF Trust and the persons identified as
- authors of the code. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, is permitted pursuant to, and subject to
- the license terms contained in, the Simplified BSD License set
- forth in Section 4.c of the IETF Trust's Legal Provisions
- Relating to IETF Documents
- (http://trustee.ietf.org/license-info).
-
- This version of this YANG module is part of RFC XXXX; see the
- RFC itself for full legal notices.";
-
- revision 2014-05-24 {
- description
- "Initial revision.";
- reference
- "RFC XXXX: A YANG Data Model for Routing Management";
- }
-
- /* Identities */
-
- identity ipv4-unicast {
- base rt:ipv4;
- description
- "This identity represents the IPv4 unicast address family.";
- }
-
- /* Operational state data */
-
- augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route" {
- when "../../rt:address-family = 'v4ur:ipv4-unicast'" {
- description
- "This augment is valid only for IPv4 unicast.";
- }
- description
- "This leaf augments an IPv4 unicast route.";
- leaf destination-prefix {
- type inet:ipv4-prefix;
- description
- "IPv4 destination prefix.";
- }
- }
-
- augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route/"
- + "rt:next-hop-options/rt:simple-next-hop" {
- when "../../rt:address-family = 'v4ur:ipv4-unicast'" {
- description
- "This augment is valid only for IPv4 unicast.";
- }
- description
- "This leaf augments the 'simple-next-hop' case of IPv4 unicast
- routes.";
- leaf next-hop {
- type inet:ipv4-address;
- description
- "IPv4 address of the next-hop.";
- }
- }
-
- augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route/"
- + "rt:next-hop-options/rt:next-hop-list/rt:next-hop-list/"
- + "rt:next-hop" {
- when "../../../../rt:address-family = 'v4ur:ipv4-unicast'" {
- description
- "This augment is valid only for IPv4 unicast.";
- }
- if-feature rt:multipath-routes;
- description
- "This leaf augments the 'next-hop-list' case of IPv4 unicast
- routes.";
- leaf address {
- type inet:ipv4-address;
- description
- "IPv4 address of the next-hop.";
- }
- }
-
- //NODE Added same augmentation for operation state
- augment "/rt:routing-state/rt:routing-instance/rt:routing-protocols/rt:routing-protocol/rt:static-routes" {
- description
- "This augment defines the configuration of the 'static'
- pseudo-protocol with data specific to IPv4 unicast.";
- container ipv4 {
- description
- "Configuration of a 'static' pseudo-protocol instance
- consists of a list of routes.";
- list route {
- key "id";
- ordered-by "user";
- description
- "A user-ordered list of static routes.";
- leaf id {
- type uint32 {
- //WARNING - range changed from 1..max to be mappable on vpp table ids
- range "0..max";
- }
- description
- "Unique numeric identifier of the route.
-
- This value is unrelated to system-assigned 'id'
- parameters of routes in RIBs.";
- }
- leaf description {
- type string;
- description
- "Textual description of the route.";
- }
- leaf destination-prefix {
- type inet:ipv4-prefix;
- mandatory "true";
- description
- "IPv4 destination prefix.";
- }
- choice next-hop-options {
- mandatory "true";
- description
- "Options for expressing the next-hop in static routes.";
- case special-next-hop {
- uses rt:special-next-hop-grouping;
- }
- case simple-next-hop {
- leaf next-hop {
- type inet:ipv4-address;
- description
- "IPv4 address of the next-hop.";
- }
-
- //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
- leaf outgoing-interface {
- type leafref {
- path "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface/"
- + "rt:name";
- }
- description
- "Name of the outgoing interface.
-
- Only interfaces configured for the ancestor routing
- instance can be given.";
- }
- }
- case next-hop-list {
- if-feature rt:multipath-routes;
- container next-hop-list {
- description
- "Configuration of multiple next-hops.";
- list next-hop {
- key "id";
- description
- "An entry of a next-hop list.";
- leaf id {
- type uint32;
- description
- "Unique numeric identifier of the entry.
-
- This value is unrelated to system-assigned 'id'
- parameters of next-hops in RIBs.";
- }
- leaf address {
- type inet:ipv4-address;
- description
- "IPv4 address of the next-hop.";
- }
- //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
- leaf outgoing-interface {
- type leafref {
- path "/rt:routing/rt:routing-instance/rt:interfaces/"
- + "rt:interface/rt:name";
- }
- description
- "Name of the outgoing interface.
-
- Only interfaces configured for the ancestor
- routing instance can be given.";
- }
- uses rt:next-hop-classifiers {
- refine "priority" {
- default "primary";
- }
- refine "weight" {
- default "0";
- }
- }
- }
- }
- }
- }
-
- //TODO modification needed because of yangtools bug(unable to proceed augmentation in separate model of augmentation in this model)
- container vpp-ipv4-route-state{
- uses vpp-r:vpp-routing-state-attributes;
- }
- }
- }
- }
-
-
- /* Configuration data */
-
- augment "/rt:routing/rt:routing-instance/rt:routing-protocols/rt:routing-protocol/rt:static-routes" {
- description
- "This augment defines the configuration of the 'static'
- pseudo-protocol with data specific to IPv4 unicast.";
- container ipv4 {
- description
- "Configuration of a 'static' pseudo-protocol instance
- consists of a list of routes.";
- list route {
- key "id";
- ordered-by "user";
- description
- "A user-ordered list of static routes.";
- leaf id {
- type uint32 {
- //WARNING - range changed from 1..max to be mappable on vpp table ids
- range "0..max";
- }
- description
- "Unique numeric identifier of the route.
-
- This value is unrelated to system-assigned 'id'
- parameters of routes in RIBs.";
- }
- leaf description {
- type string;
- description
- "Textual description of the route.";
- }
- leaf destination-prefix {
- type inet:ipv4-prefix;
- mandatory "true";
- description
- "IPv4 destination prefix.";
- }
- choice next-hop-options {
- mandatory "true";
- description
- "Options for expressing the next-hop in static routes.";
- case special-next-hop {
- uses rt:special-next-hop-grouping;
- }
- case simple-next-hop {
- leaf next-hop {
- type inet:ipv4-address;
- description
- "IPv4 address of the next-hop.";
- }
-
- //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
- leaf outgoing-interface {
- type leafref {
- path "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface/"
- + "rt:name";
- }
- description
- "Name of the outgoing interface.
-
- Only interfaces configured for the ancestor routing
- instance can be given.";
- }
- }
- case next-hop-list {
- if-feature rt:multipath-routes;
- container next-hop-list {
- description
- "Configuration of multiple next-hops.";
- list next-hop {
- key "id";
- description
- "An entry of a next-hop list.";
- leaf id {
- type uint32;
- description
- "Unique numeric identifier of the entry.
-
- This value is unrelated to system-assigned 'id'
- parameters of next-hops in RIBs.";
- }
- leaf address {
- type inet:ipv4-address;
- description
- "IPv4 address of the next-hop.";
- }
- //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
- leaf outgoing-interface {
- type leafref {
- path "/rt:routing/rt:routing-instance/rt:interfaces/"
- + "rt:interface/rt:name";
- }
- description
- "Name of the outgoing interface.
-
- Only interfaces configured for the ancestor
- routing instance can be given.";
- }
- uses rt:next-hop-classifiers {
- refine "priority" {
- default "primary";
- }
- refine "weight" {
- default "0";
- }
- }
- }
- }
- }
- }
-
- //TODO modification needed because of yangtools bug(unable to proceed augmentation in separate model of augmentation in this model)
- container vpp-ipv4-route{
- uses vpp-r:vpp-routing-attributes;
- }
- }
- }
- }
-
- /* RPC methods */
-
- augment "/rt:active-route/rt:input/rt:destination-address" {
- when "rt:address-family='v4ur:ipv4-unicast'" {
- description
- "This augment is valid only for IPv4 unicast.";
- }
- description
- "This leaf augments the 'rt:destination-address' parameter of
- the 'rt:active-route' operation.";
- leaf address {
- type inet:ipv4-address;
- description
- "IPv4 destination address.";
- }
- }
-
- augment "/rt:active-route/rt:output/rt:route" {
- when "rt:address-family='v4ur:ipv4-unicast'" {
- description
- "This augment is valid only for IPv4 unicast.";
- }
- description
- "This leaf augments the reply to the 'rt:active-route'
- operation.";
- leaf destination-prefix {
- type inet:ipv4-prefix;
- description
- "IPv4 destination prefix.";
- }
- }
-
- augment "/rt:active-route/rt:output/rt:route/rt:next-hop-options/"
- + "rt:simple-next-hop" {
- when "rt:address-family='v4ur:ipv4-unicast'" {
- description
- "This augment is valid only for IPv4 unicast.";
- }
- description
- "This leaf augments the 'simple-next-hop' case in the reply to
- the 'rt:active-route' operation.";
- leaf next-hop {
- type inet:ipv4-address;
- description
- "IPv4 address of the next-hop.";
- }
- }
-
- augment "/rt:active-route/rt:output/rt:route/rt:next-hop-options/"
- + "rt:next-hop-list/rt:next-hop-list/rt:next-hop" {
- when "../../rt:address-family='v4ur:ipv4-unicast'" {
- description
- "This augment is valid only for IPv4 unicast.";
- }
- if-feature rt:multipath-routes;
- description
- "This leaf augments the 'next-hop-list' case in the reply to
- the 'rt:active-route' operation.";
- leaf address {
- type inet:ipv4-address;
- description
- "IPv4 address of the next-hop.";
- }
- }
-} \ No newline at end of file
diff --git a/routing/routing-api/src/main/yang/ietf-ipv6-unicast-routing.yang b/routing/routing-api/src/main/yang/ietf-ipv6-unicast-routing.yang
deleted file mode 100644
index 93de395d6..000000000
--- a/routing/routing-api/src/main/yang/ietf-ipv6-unicast-routing.yang
+++ /dev/null
@@ -1,822 +0,0 @@
-module ietf-ipv6-unicast-routing {
-
- namespace "urn:ietf:params:xml:ns:yang:ietf-ipv6-unicast-routing";
-
- prefix "v6ur";
-
- import ietf-routing {
- prefix "rt";
- }
-
- import ietf-inet-types {
- prefix "inet";
- }
-
- import ietf-interfaces {
- prefix "if";
- }
-
- import ietf-ip {
- prefix "ip";
- }
-
- //TODO modification needed because of yangtools bug(unable to proceed augmentation in separate model of augmentation in this model)
- import vpp-routing {
- prefix vpp-r;
- }
-
- organization
- "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
-
- contact
- "WG Web: <http://tools.ietf.org/wg/netmod/>
- WG List: <mailto:netmod@ietf.org>
-
- WG Chair: Thomas Nadeau
- <mailto:tnadeau@lucidvision.com>
-
- WG Chair: Juergen Schoenwaelder
- <mailto:j.schoenwaelder@jacobs-university.de>
-
- Editor: Ladislav Lhotka
- <mailto:lhotka@nic.cz>";
-
- description
- "This YANG module augments the 'ietf-routing' module with basic
- configuration and operational state data for IPv6 unicast
- routing.
-
- Copyright (c) 2014 IETF Trust and the persons identified as
- authors of the code. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, is permitted pursuant to, and subject to
- the license terms contained in, the Simplified BSD License set
- forth in Section 4.c of the IETF Trust's Legal Provisions
- Relating to IETF Documents
- (http://trustee.ietf.org/license-info).
-
- This version of this YANG module is part of RFC XXXX; see the
- RFC itself for full legal notices.";
-
- revision 2014-05-25 {
- description
- "Initial revision.";
- reference
- "RFC XXXX: A YANG Data Model for Routing Management";
- }
-
- /* Identities */
-
- identity ipv6-unicast {
- base rt:ipv6;
- description
- "This identity represents the IPv6 unicast address family.";
- }
-
- /* Operational state data */
-
- augment "/rt:routing-state/rt:routing-instance/rt:interfaces/"
- + "rt:interface" {
- description
- "IPv6-specific parameters of router interfaces.";
- container ipv6-router-advertisements {
- description
- "Parameters of IPv6 Router Advertisements.";
- leaf send-advertisements {
- type boolean;
- description
- "A flag indicating whether or not the router sends periodic
- Router Advertisements and responds to Router
- Solicitations.";
- }
- leaf max-rtr-adv-interval {
- type uint16 {
- range "4..1800";
- }
- units "seconds";
- description
- "The maximum time allowed between sending unsolicited
- multicast Router Advertisements from the interface.";
- }
- leaf min-rtr-adv-interval {
- type uint16 {
- range "3..1350";
- }
- units "seconds";
- description
- "The minimum time allowed between sending unsolicited
- multicast Router Advertisements from the interface.";
- }
- leaf managed-flag {
- type boolean;
- description
- "The value that is placed in the 'Managed address
- configuration' flag field in the Router Advertisement.";
- }
- leaf other-config-flag {
- type boolean;
- description
- "The value that is placed in the 'Other configuration' flag
- field in the Router Advertisement.";
- }
- leaf link-mtu {
- type uint32;
- description
- "The value that is placed in MTU options sent by the
- router. A value of zero indicates that no MTU options are
- sent.";
- }
- leaf reachable-time {
- type uint32 {
- range "0..3600000";
- }
- units "milliseconds";
- description
- "The value that is placed in the Reachable Time field in
- the Router Advertisement messages sent by the router. A
- value of zero means unspecified (by this router).";
- }
- leaf retrans-timer {
- type uint32;
- units "milliseconds";
- description
- "The value that is placed in the Retrans Timer field in the
- Router Advertisement messages sent by the router. A value
- of zero means unspecified (by this router).";
- }
- leaf cur-hop-limit {
- type uint8;
- description
- "The value that is placed in the Cur Hop Limit field in the
- Router Advertisement messages sent by the router. A value
- of zero means unspecified (by this router).";
- }
- leaf default-lifetime {
- type uint16 {
- range "0..9000";
- }
- units "seconds";
- description
- "The value that is placed in the Router Lifetime field of
- Router Advertisements sent from the interface, in seconds.
- A value of zero indicates that the router is not to be
- used as a default router.";
- }
- container prefix-list {
- description
- "A list of prefixes that are placed in Prefix Information
- options in Router Advertisement messages sent from the
- interface.
-
- By default, these are all prefixes that the router
- advertises via routing protocols as being on-link for the
- interface from which the advertisement is sent.";
- list prefix {
- key "prefix-spec";
- description
- "Advertised prefix entry and its parameters.";
- leaf prefix-spec {
- type inet:ipv6-prefix;
- description
- "IPv6 address prefix.";
- }
- leaf valid-lifetime {
- type uint32;
- units "seconds";
- description
- "The value that is placed in the Valid Lifetime in the
- Prefix Information option. The designated value of all
- 1's (0xffffffff) represents infinity.";
- }
- leaf on-link-flag {
- type boolean;
- description
- "The value that is placed in the on-link flag ('L-bit')
- field in the Prefix Information option.";
- }
- leaf preferred-lifetime {
- type uint32;
- units "seconds";
- description
- "The value that is placed in the Preferred Lifetime in
- the Prefix Information option, in seconds. The
- designated value of all 1's (0xffffffff) represents
- infinity.";
- }
- leaf autonomous-flag {
- type boolean;
- description
- "The value that is placed in the Autonomous Flag field
- in the Prefix Information option.";
- }
- }
- }
- }
- }
-
- augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route" {
- when "../../rt:address-family = 'v6ur:ipv6-unicast'" {
- description
- "This augment is valid only for IPv6 unicast.";
- }
- description
- "This leaf augments an IPv6 unicast route.";
- leaf destination-prefix {
- type inet:ipv6-prefix;
- description
- "IPv6 destination prefix.";
- }
- }
-
- augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route/"
- + "rt:next-hop-options/rt:simple-next-hop" {
- when "../../rt:address-family = 'v6ur:ipv6-unicast'" {
- description
- "This augment is valid only for IPv6 unicast.";
- }
- description
- "This leaf augments the 'simple-next-hop' case of IPv6 unicast
- routes.";
- leaf next-hop {
- type inet:ipv6-address;
- description
- "IPv6 address of the next-hop.";
- }
- }
-
- augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route/"
- + "rt:next-hop-options/rt:next-hop-list/rt:next-hop-list/"
- + "rt:next-hop" {
- when "../../../../rt:address-family = 'v6ur:ipv6-unicast'" {
- description
- "This augment is valid only for IPv6 unicast.";
- }
- if-feature rt:multipath-routes;
- description
- "This leaf augments the 'next-hop-list' case of IPv6 unicast
- routes.";
- leaf address {
- type inet:ipv6-address;
- description
- "IPv6 address of the next-hop.";
- }
- }
-
- /* Configuration data */
-
- augment
- "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface" {
- when "/if:interfaces/if:interface[if:name=current()/rt:name]/"
- + "ip:ipv6/ip:enabled='true'" {
- description
- "This augment is only valid for router interfaces with
- enabled IPv6.";
- }
- description
- "Configuration of IPv6-specific parameters of router
- interfaces.";
- container ipv6-router-advertisements {
- description
- "Configuration of IPv6 Router Advertisements.";
- leaf send-advertisements {
- type boolean;
- default "false";
- description
- "A flag indicating whether or not the router sends periodic
- Router Advertisements and responds to Router
- Solicitations.";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
- AdvSendAdvertisements.";
- }
- leaf max-rtr-adv-interval {
- type uint16 {
- range "4..1800";
- }
- units "seconds";
- default "600";
- description
- "The maximum time allowed between sending unsolicited
- multicast Router Advertisements from the interface.";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
- MaxRtrAdvInterval.";
- }
- leaf min-rtr-adv-interval {
- type uint16 {
- range "3..1350";
- }
- units "seconds";
- must ". <= 0.75 * ../max-rtr-adv-interval" {
- description
- "The value MUST NOT be greater than 75 % of
- 'max-rtr-adv-interval'.";
- }
- description
- "The minimum time allowed between sending unsolicited
- multicast Router Advertisements from the interface.
-
- The default value to be used operationally if this leaf is
- not configured is determined as follows:
-
- - if max-rtr-adv-interval >= 9 seconds, the default value
- is 0.33 * max-rtr-adv-interval;
-
- - otherwise it is 0.75 * max-rtr-adv-interval.";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
- MinRtrAdvInterval.";
- }
- leaf managed-flag {
- type boolean;
- default "false";
- description
- "The value to be placed in the 'Managed address
- configuration' flag field in the Router Advertisement.";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
- AdvManagedFlag.";
- }
- leaf other-config-flag {
- type boolean;
- default "false";
- description
- "The value to be placed in the 'Other configuration' flag
- field in the Router Advertisement.";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
- AdvOtherConfigFlag.";
- }
- leaf link-mtu {
- type uint32;
- default "0";
- description
- "The value to be placed in MTU options sent by the router.
- A value of zero indicates that no MTU options are sent.";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
- AdvLinkMTU.";
- }
- leaf reachable-time {
- type uint32 {
- range "0..3600000";
- }
- units "milliseconds";
- default "0";
- description
- "The value to be placed in the Reachable Time field in the
- Router Advertisement messages sent by the router. A value
- of zero means unspecified (by this router).";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
- AdvReachableTime.";
- }
- leaf retrans-timer {
- type uint32;
- units "milliseconds";
- default "0";
- description
- "The value to be placed in the Retrans Timer field in the
- Router Advertisement messages sent by the router. A value
- of zero means unspecified (by this router).";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
- AdvRetransTimer.";
- }
- leaf cur-hop-limit {
- type uint8;
- description
- "The value to be placed in the Cur Hop Limit field in the
- Router Advertisement messages sent by the router. A value
- of zero means unspecified (by this router).
-
- If this parameter is not configured, the device SHOULD use
- the value specified in IANA Assigned Numbers that was in
- effect at the time of implementation.";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
- AdvCurHopLimit.
-
- IANA: IP Parameters,
- http://www.iana.org/assignments/ip-parameters";
- }
- leaf default-lifetime {
- type uint16 {
- range "0..9000";
- }
- units "seconds";
- description
- "The value to be placed in the Router Lifetime field of
- Router Advertisements sent from the interface, in seconds.
- It MUST be either zero or between max-rtr-adv-interval and
- 9000 seconds. A value of zero indicates that the router is
- not to be used as a default router. These limits may be
- overridden by specific documents that describe how IPv6
- operates over different link layers.
-
- If this parameter is not configured, the device SHOULD use
- a value of 3 * max-rtr-adv-interval.";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
- AdvDefaultLifeTime.";
- }
- container prefix-list {
- description
- "Configuration of prefixes to be placed in Prefix
- Information options in Router Advertisement messages sent
- from the interface.
-
- Prefixes that are advertised by default but do not have
- their entries in the child 'prefix' list are advertised
- with the default values of all parameters.
-
- The link-local prefix SHOULD NOT be included in the list
- of advertised prefixes.";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
- AdvPrefixList.";
- list prefix {
- key "prefix-spec";
- description
- "Configuration of an advertised prefix entry.";
- leaf prefix-spec {
- type inet:ipv6-prefix;
- description
- "IPv6 address prefix.";
- }
- choice control-adv-prefixes {
- default "advertise";
- description
- "The prefix either may be explicitly removed from the
- set of advertised prefixes, or parameters with which
- it is advertised may be specified (default case).";
- leaf no-advertise {
- type empty;
- description
- "The prefix will not be advertised.
-
- This can be used for removing the prefix from the
- default set of advertised prefixes.";
- }
- case advertise {
- leaf valid-lifetime {
- type uint32;
- units "seconds";
- default "2592000";
- description
- "The value to be placed in the Valid Lifetime in
- the Prefix Information option. The designated
- value of all 1's (0xffffffff) represents
- infinity.";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6
- (IPv6) - AdvValidLifetime.";
- }
- leaf on-link-flag {
- type boolean;
- default "true";
- description
- "The value to be placed in the on-link flag
- ('L-bit') field in the Prefix Information
- option.";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6
- (IPv6) - AdvOnLinkFlag.";
- }
- leaf preferred-lifetime {
- type uint32;
- units "seconds";
- must ". <= ../valid-lifetime" {
- description
- "This value MUST NOT be greater than
- valid-lifetime.";
- }
- default "604800";
- description
- "The value to be placed in the Preferred Lifetime
- in the Prefix Information option. The designated
- value of all 1's (0xffffffff) represents
- infinity.";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6
- (IPv6) - AdvPreferredLifetime.";
- }
- leaf autonomous-flag {
- type boolean;
- default "true";
- description
- "The value to be placed in the Autonomous Flag
- field in the Prefix Information option.";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6
- (IPv6) - AdvAutonomousFlag.";
- }
- }
- }
- }
- }
- }
- }
-
- //NOTE - added same augmentation for operational state
-
- augment "/rt:routing-state/rt:routing-instance/rt:routing-protocols/rt:routing-protocol/rt:static-routes" {
- description
- "This augment defines the configuration of the 'static'
- pseudo-protocol with data specific to IPv6 unicast.";
- container ipv6 {
- description
- "Configuration of a 'static' pseudo-protocol instance
- consists of a list of routes.";
- list route {
- key "id";
- ordered-by "user";
- description
- "A user-ordered list of static routes.";
- leaf id {
- type uint32 {
- //WARNING - range changed from 1..max to be mappable on vpp table ids
- range "0..max";
- }
- description
- "Unique numeric identifier of the route.
-
- This value is unrelated to system-assigned 'id'
- parameters of routes in RIBs.";
- }
- leaf description {
- type string;
- description
- "Textual description of the route.";
- }
- leaf destination-prefix {
- type inet:ipv6-prefix;
- mandatory "true";
- description
- "IPv6 destination prefix.";
- }
- choice next-hop-options {
- mandatory "true";
- description
- "Options for expressing the next-hop in static routes.";
- case special-next-hop {
- //WARNING - changed, see ietf-routing.yang
- uses rt:special-next-hop-grouping;
- }
- case simple-next-hop {
- leaf next-hop {
- type inet:ipv6-address;
- description
- "IPv6 address of the next-hop.";
- }
- //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
- leaf outgoing-interface {
- type leafref {
- path "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface/"
- + "rt:name";
- }
- description
- "Name of the outgoing interface.
-
- Only interfaces configured for the ancestor routing
- instance can be given.";
- }
- }
- case next-hop-list {
- if-feature rt:multipath-routes;
- container next-hop-list {
- description
- "Configuration of multiple next-hops.";
- list next-hop {
- key "id";
- description
- "An entry of a next-hop list.";
- leaf id {
- type uint32;
- description
- "Unique numeric identifier of the entry.
-
- This value is unrelated to system-assigned 'id'
- parameters of next-hops in RIBs.";
- }
- leaf address {
- type inet:ipv6-address;
- description
- "IPv6 address of the next-hop.";
- }
- //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
- leaf outgoing-interface {
- type leafref {
- path "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface/"
- + "rt:name";
- }
- description
- "Name of the outgoing interface.
-
- Only interfaces configured for the ancestor
- routing instance can be given.";
- }
- uses rt:next-hop-classifiers {
- refine "priority" {
- default "primary";
- }
- refine "weight" {
- default "0";
- }
- }
- }
- }
- }
- }
-
- //TODO modification needed because of yangtools bug(unable to proceed augmentation in separate model of augmentation in this model)
- container vpp-ipv6-route-state{
- uses vpp-r:vpp-routing-state-attributes;
- }
- }
- }
- }
-
- augment "/rt:routing/rt:routing-instance/rt:routing-protocols/rt:routing-protocol/rt:static-routes" {
- description
- "This augment defines the configuration of the 'static'
- pseudo-protocol with data specific to IPv6 unicast.";
- container ipv6 {
- description
- "Configuration of a 'static' pseudo-protocol instance
- consists of a list of routes.";
- list route {
- key "id";
- ordered-by "user";
- description
- "A user-ordered list of static routes.";
- leaf id {
- type uint32 {
- //WARNING - range changed from 1..max to be mappable on vpp table ids
- range "0..max";
- }
- description
- "Unique numeric identifier of the route.
-
- This value is unrelated to system-assigned 'id'
- parameters of routes in RIBs.";
- }
- leaf description {
- type string;
- description
- "Textual description of the route.";
- }
- leaf destination-prefix {
- type inet:ipv6-prefix;
- mandatory "true";
- description
- "IPv6 destination prefix.";
- }
- choice next-hop-options {
- mandatory "true";
- description
- "Options for expressing the next-hop in static routes.";
- case special-next-hop {
- //WARNING - changed, see ietf-routing.yang
- uses rt:special-next-hop-grouping;
- }
- case simple-next-hop {
- leaf next-hop {
- type inet:ipv6-address;
- description
- "IPv6 address of the next-hop.";
- }
- //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
- leaf outgoing-interface {
- type leafref {
- path "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface/"
- + "rt:name";
- }
- description
- "Name of the outgoing interface.
-
- Only interfaces configured for the ancestor routing
- instance can be given.";
- }
- }
- case next-hop-list {
- if-feature rt:multipath-routes;
- container next-hop-list {
- description
- "Configuration of multiple next-hops.";
- list next-hop {
- key "id";
- description
- "An entry of a next-hop list.";
- leaf id {
- type uint32;
- description
- "Unique numeric identifier of the entry.
-
- This value is unrelated to system-assigned 'id'
- parameters of next-hops in RIBs.";
- }
- leaf address {
- type inet:ipv6-address;
- description
- "IPv6 address of the next-hop.";
- }
- //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
- leaf outgoing-interface {
- type leafref {
- path "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface/"
- + "rt:name";
- }
- description
- "Name of the outgoing interface.
-
- Only interfaces configured for the ancestor
- routing instance can be given.";
- }
- uses rt:next-hop-classifiers {
- refine "priority" {
- default "primary";
- }
- refine "weight" {
- default "0";
- }
- }
- }
- }
- }
- }
-
- //TODO modification needed because of yangtools bug(unable to proceed augmentation in separate model of augmentation in this model)
- container vpp-ipv6-route{
- uses vpp-r:vpp-routing-attributes;
- }
- }
- }
- }
-
- /* RPC methods */
-
- augment "/rt:active-route/rt:input/rt:destination-address" {
- when "rt:address-family='v6ur:ipv6-unicast'" {
- description
- "This augment is valid only for IPv6 unicast.";
- }
- description
- "This leaf augments the 'rt:destination-address' parameter of
- the 'rt:active-route' operation.";
- leaf address {
- type inet:ipv6-address;
- description
- "IPv6 destination address.";
- }
- }
-
- augment "/rt:active-route/rt:output/rt:route" {
- when "rt:address-family='v6ur:ipv6-unicast'" {
- description
- "This augment is valid only for IPv6 unicast.";
- }
- description
- "This leaf augments the reply to the 'rt:active-route'
- operation.";
- leaf destination-prefix {
- type inet:ipv6-prefix;
- description
- "IPv6 destination prefix.";
- }
- }
-
- augment "/rt:active-route/rt:output/rt:route/rt:next-hop-options/"
- + "rt:simple-next-hop" {
- when "rt:address-family='v6ur:ipv6-unicast'" {
- description
- "This augment is valid only for IPv6 unicast.";
- }
- description
- "This leaf augments the 'simple-next-hop' case in the reply to
- the 'rt:active-route' operation.";
- leaf next-hop {
- type inet:ipv6-address;
- description
- "IPv6 address of the next-hop.";
- }
- }
-
- augment "/rt:active-route/rt:output/rt:route/rt:next-hop-options/"
- + "rt:next-hop-list/rt:next-hop-list/rt:next-hop" {
- when "../../rt:address-family='v6ur:ipv6-unicast'" {
- description
- "This augment is valid only for IPv6 unicast.";
- }
- if-feature rt:multipath-routes;
- description
- "This leaf augments the 'next-hop-list' case in the reply to
- the 'rt:active-route' operation.";
- leaf address {
- type inet:ipv6-address;
- description
- "IPv6 address of the next-hop.";
- }
- }
-} \ No newline at end of file
diff --git a/routing/routing-api/src/main/yang/ietf-routing.yang b/routing/routing-api/src/main/yang/ietf-routing.yang
deleted file mode 100644
index 6902cd0bf..000000000
--- a/routing/routing-api/src/main/yang/ietf-routing.yang
+++ /dev/null
@@ -1,1030 +0,0 @@
-module ietf-routing{
-
- namespace "urn:ietf:params:xml:ns:yang:ietf-routing";
-
- prefix "rt";
-
- import ietf-yang-types {
- prefix "yang";
- }
-
- import ietf-interfaces {
- prefix "if";
- }
-
- organization
- "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
-
- contact
- "WG Web: <http://tools.ietf.org/wg/netmod/>
- WG List: <mailto:netmod@ietf.org>
-
- WG Chair: Thomas Nadeau
- <mailto:tnadeau@lucidvision.com>
-
- WG Chair: Juergen Schoenwaelder
- <mailto:j.schoenwaelder@jacobs-university.de>
-
- Editor: Ladislav Lhotka
- <mailto:lhotka@nic.cz>";
-
- description
- "This YANG module defines essential components for the management
- of a routing subsystem.
-
- Copyright (c) 2014 IETF Trust and the persons identified as
- authors of the code. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, is permitted pursuant to, and subject to
- the license terms contained in, the Simplified BSD License set
- forth in Section 4.c of the IETF Trust's Legal Provisions
- Relating to IETF Documents
- (http://trustee.ietf.org/license-info).
-
- This version of this YANG module is part of RFC XXXX; see the
- RFC itself for full legal notices.";
-
- revision 2014-05-24 {
- description
- "Initial revision.";
- reference
- "RFC XXXX: A YANG Data Model for Routing Management";
- }
-
- /* Features */
-
- feature multiple-ribs {
- description
- "This feature indicates that the device supports multiple RIBS
- per address family, and the framework for passing routes
- between RIBs.
-
- Devices that do not support this feature MUST provide exactly
- one system-controlled RIB per supported address family. These
- RIBs then appear as entries of the list
- /routing-state/ribs/rib.";
- }
-
- feature multipath-routes {
- description
- "This feature indicates that the device supports multipath
- routes that have a list of next-hops.";
- }
-
- /* Identities */
-
- identity address-family {
- description
- "Base identity from which identities describing address
- families are derived.";
- }
-
- identity ipv4 {
- base address-family;
- description
- "This identity represents IPv4 address family.";
- }
-
- identity ipv6 {
- base address-family;
- description
- "This identity represents IPv6 address family.";
- }
-
- identity routing-instance-type {
- description
- "Base identity from which identities describing routing
- instance types are derived.
-
- It is primarily intended for discriminating among different
- types of logical routers or router virtualization.";
- }
-
- identity standard-routing-instance {
- base routing-instance-type;
- description
- "This identity represents a default routing instance.";
- }
-
- identity routing-protocol {
- description
- "Base identity from which routing protocol identities are
- derived.";
- }
-
- identity direct {
- base routing-protocol;
- description
- "Routing pseudo-protocol which provides routes to directly
- connected networks.";
- }
-
- identity static {
- base routing-protocol;
- description
- "Static routing pseudo-protocol.";
- }
-
- identity route-filter {
- description
- "Base identity from which all route filters are derived.";
- }
-
- identity deny-all-route-filter {
- base route-filter;
- description
- "Route filter that blocks all routes.";
- }
-
- identity allow-all-route-filter {
- base route-filter;
- description
- "Route filter that permits all routes.";
- }
-
- /* Type Definitions */
-
- typedef routing-instance-ref {
- type leafref {
- path "/rt:routing/rt:routing-instance/rt:name";
- }
- description
- "This type is used for leafs that reference a routing instance
- configuration.";
- }
-
- typedef routing-instance-state-ref {
- type leafref {
- path "/rt:routing-state/rt:routing-instance/rt:name";
- }
- description
- "This type is used for leafs that reference state data of a
- routing instance.";
- }
-
- typedef rib-ref {
- type leafref {
- path "/rt:routing/rt:ribs/rt:rib/rt:name";
- }
- description
- "This type is used for leafs that reference a RIB
- configuration.";
- }
-
- typedef rib-state-ref {
- type leafref {
- path "/rt:routing-state/rt:ribs/rt:rib/rt:name";
- }
- description
- "This type is used for leafs that reference a RIB in state
- data.";
- }
-
- typedef route-filter-ref {
- type leafref {
- path "/rt:routing/rt:route-filters/rt:route-filter/rt:name";
- }
- description
- "This type is used for leafs that reference a route filter
- configuration.";
- }
-
- typedef route-filter-state-ref {
- type leafref {
- path "/rt:routing-state/rt:route-filters/rt:route-filter/"
- + "rt:name";
- }
- description
- "This type is used for leafs that reference a route filter in
- state data.";
- }
-
- /* Groupings */
-
- grouping address-family-grouping {
- description
- "This grouping provides a leaf identifying an address
- family.";
- leaf address-family {
- type identityref {
- base address-family;
- }
- mandatory "true";
- description
- "Address family.";
- }
- }
-
- grouping state-entry-id {
- description
- "This grouping defines a unique identifier for entries in
- several operational state lists.";
- leaf id {
- type uint64;
- description
- "Unique numerical identifier of a list entry in operational
- state. It may be used by protocols or tools that inspect
- and/or manipulate operational state data and prefer
- fixed-size integers as list entry handles.
-
- These identifiers are always ephemeral, i.e., they may
- change after a reboot.";
- }
- }
-
- grouping router-id {
- description
- "This grouping provides the definition of router ID.";
- leaf router-id {
- type yang:dotted-quad;
- description
- "Router ID - 32-bit number in the form of a dotted quad. Some
- protocols use this parameter for identifying a router to its
- neighbors.";
- }
- }
-
- grouping outgoing-interface {
- description
- "This grouping defines the outgoing interface for use in
- next-hops.";
- leaf outgoing-interface {
- type leafref {
- path "/rt:routing-state/rt:routing-instance/rt:interfaces/"
- + "rt:interface/rt:name";
- }
- description
- "Name of the outgoing interface.";
- }
- }
-
- // WARNING - renamed due to yang sources generation problem(having same name for grouping and it's leaf ends up in error against Java Language Specification)
- grouping special-next-hop-grouping {
- description
- "This grouping provides the leaf for specifying special
- next-hop options.";
- leaf special-next-hop {
- type enumeration {
- enum blackhole {
- description
- "Silently discard the packet.";
- }
- enum unreachable {
- description
- "Discard the packet and notify the sender with an error
- message indicating that the destination host is
- unreachable.";
- }
- enum prohibit {
- description
- "Discard the packet and notify the sender with an error
- message indicating that the communication is
- administratively prohibited.";
- }
- enum receive {
- description
- "The packet will be received by the local network
- device.";
- }
- }
- description
- "Special next-hop options.";
- }
- }
-
- grouping next-hop-classifiers {
- description
- "This grouping provides two next-hop classifiers.";
- leaf priority {
- type enumeration {
- enum primary {
- value "1";
- description
- "Primary next-hop.";
- }
- enum backup {
- value "2";
- description
- "Backup next-hop.";
- }
- }
- description
- "Simple priority for distinguishing between primary and
- backup next-hops.
-
- Backup next-hops are used if and only if no primary
- next-hops are reachable.";
- }
- leaf weight {
- type uint8;
- must ". = 0 or not(../../next-hop/weight = 0)" {
- error-message "Illegal combination of zero and non-zero "
- + "next-hop weights.";
- description
- "Next-hop weights must be either all zero (equal
- load-balancing) or all non-zero.";
- }
- description
- "This parameter specifies the weight of the next-hop for load
- balancing. The number specifies the relative fraction of the
- traffic that will use the corresponding next-hop.
-
- A value of 0 represents equal load-balancing.
-
- If both primary and backup next-hops are present, then the
- weights for each priority level are used separately.";
- }
- }
-
- grouping next-hop-content {
- description
- "Generic parameters of next-hops in routes.";
- choice next-hop-options {
- mandatory "true";
- description
- "Options for expressing the next-hop in routes.";
- case special-next-hop {
- uses special-next-hop-grouping;
- }
- case simple-next-hop {
- uses outgoing-interface;
- }
- case next-hop-list {
- if-feature multipath-routes;
- container next-hop-list {
- description
- "Container for multiple next-hops.";
- list next-hop {
- key "id";
- description
- "An entry of a next-hop list.";
- uses state-entry-id;
- uses outgoing-interface;
- uses next-hop-classifiers;
- }
- }
- }
- }
- }
-
- grouping route-metadata {
- description
- "Route metadata.";
- leaf source-protocol {
- type identityref {
- base routing-protocol;
- }
- mandatory "true";
- description
- "Type of the routing protocol from which the route
- originated.";
- }
- leaf last-updated {
- type yang:date-and-time;
- description
- "Time stamp of the last modification of the route. If the
- route was never modified, it is the time when the route was
- inserted into the RIB.";
- }
- }
-
- /* Operational state data */
-
- container routing-state {
- config "false";
- description
- "Operational state of the routing subsystem.";
- list routing-instance {
- key "name";
- unique "id";
- description
- "Each list entry is a container for operational state data of
- a routing instance.
-
- An implementation MAY create one or more system-controlled
- instances, other user-controlled instances MAY be created by
- configuration.";
- leaf name {
- type string;
- description
- "The name of the routing instance.
-
- For system-controlled instances the name is persistent,
- i.e., it SHOULD NOT change across reboots.";
- }
- uses state-entry-id {
- refine "id" {
- mandatory "true";
- }
- }
- leaf type {
- type identityref {
- base routing-instance-type;
- }
- description
- "The routing instance type, primarily intended for
- discriminating among different types of logical routers,
- route virtualization, master-slave arrangements etc.,
- while keeping all routing instances in the same flat
- list.";
- }
- uses router-id {
- description
- "Global router ID.
-
- An implementation may choose a value if none is
- configured.
-
- Routing protocols that use router ID MAY override this
- global parameter.";
- }
- container default-ribs {
- description
- "Default RIBs used by the routing instance.";
- list default-rib {
- key "address-family";
- description
- "Each list entry specifies the default RIB for one
- address family.
-
- The default RIB is operationally connected to all
- routing protocols for which a connected RIB has not been
- explicitly configured.
-
- The 'direct' pseudo-protocol is always connected to the
- default RIBs.";
- uses address-family-grouping;
- leaf rib-name {
- type rib-state-ref;
- mandatory "true";
- description
- "Name of an existing RIB to be used as the default RIB
- for the given routing instance and address family.";
- }
- }
- }
- container interfaces {
- description
- "Network layer interfaces belonging to the routing
- instance.";
- list interface {
- key "name";
- description
- "List of network layer interfaces assigned to the routing
- instance.";
- leaf name {
- type if:interface-state-ref;
- description
- "A reference to the name of a configured network layer
- interface.";
- }
- }
- }
- container routing-protocols {
- description
- "Container for the list of routing protocol instances.";
- list routing-protocol {
- key "name";
- description
- "Operational state of a routing protocol instance.
-
- An implementation MUST provide exactly one
- system-controlled instance of the type 'direct'. Other
- instances MAY be created by configuration.";
- leaf name {
- type string;
- description
- "The name of the routing protocol instance.
-
- For system-controlled instances this name is
- persistent, i.e., it SHOULD NOT change across
- reboots.";
- }
- leaf type {
- type identityref {
- base routing-protocol;
- }
- mandatory "true";
- description
- "Type of the routing protocol.";
- }
- container connected-ribs {
- description
- "Container for connected RIBs.";
- list connected-rib {
- key "rib-name";
- description
- "List of RIBs to which the routing protocol instance
- is connected (at most one RIB per address
- family).";
- leaf rib-name {
- type rib-state-ref;
- description
- "Name of an existing RIB.";
- }
- leaf import-filter {
- type route-filter-state-ref;
- description
- "Reference to a route filter that is used for
- filtering routes passed from this routing protocol
- instance to the RIB specified by the 'rib-name'
- sibling node.
-
- If this leaf is not present, the behavior is
- protocol-specific, but typically it means that all
- routes are accepted.";
- }
- leaf export-filter {
- type route-filter-state-ref;
- description
- "Reference to a route filter that is used for
- filtering routes passed from the RIB specified by
- the 'rib-name' sibling node to this routing
- protocol instance.
-
- If this leaf is not present, the behavior is
- protocol-specific - typically it means that all
- routes are accepted.
-
- The 'direct' and 'static' pseudo-protocols accept
- no routes from any RIB.";
- }
- }
- }
-
- //NOTE -added to allow operational state for static-routes
- container static-routes {
- when "../type='rt:static'" {
- description
- "This container is only valid for the 'static'
- routing protocol.";
- }
- description
- "Configuration of the 'static' pseudo-protocol.
-
- Address family specific modules augment this node with
- their lists of routes.";
- }
- }
- }
- }
- container ribs {
- description
- "Container for RIBs.";
- list rib {
- key "name";
- unique "id";
- description
- "Each entry represents a RIB identified by the 'name' key.
- All routes in a RIB MUST belong to the same address
- family.
-
- The server MUST provide a system-controlled default RIB
- for each address family, and MAY provide other
- system-controlled RIBs. Additional RIBs MAY be created in
- the configuration.";
- leaf name {
- type string;
- description
- "The name of the RIB.";
- }
- uses state-entry-id {
- refine "id" {
- mandatory "true";
- }
- }
- uses address-family-grouping;
- container routes {
- description
- "Current contents of the RIB.";
- list route {
- key "id";
- description
- "A RIB route entry. This data node MUST be augmented
- with information specific for routes of each address
- family.";
- uses state-entry-id;
- uses next-hop-content;
- uses route-metadata;
- }
- }
- container recipient-ribs {
- if-feature multiple-ribs;
- description
- "Container for recipient RIBs.";
- list recipient-rib {
- key "rib-name";
- description
- "List of RIBs that receive routes from this RIB.";
- leaf rib-name {
- type rib-state-ref;
- description
- "The name of the recipient RIB.";
- }
- leaf filter {
- type route-filter-state-ref;
- description
- "A route filter which is applied to the routes passed
- to the recipient RIB.";
- }
- }
- }
- }
- }
- container route-filters {
- description
- "Container for route filters.";
- list route-filter {
- key "name";
- description
- "Route filters are used for filtering and/or manipulating
- routes that are passed between a routing protocol and a
- RIB and vice versa, or between two RIBs.
-
- It is expected that other modules augment this list with
- contents specific for a particular route filter type.";
- leaf name {
- type string;
- description
- "The name of the route filter.";
- }
- leaf type {
- type identityref {
- base route-filter;
- }
- mandatory "true";
- description
- "Type of the route-filter - an identity derived from the
- 'route-filter' base identity.";
- }
- }
- }
- }
-
- /* Configuration Data */
-
- container routing {
- description
- "Configuration parameters for the routing subsystem.";
- list routing-instance {
- key "name";
- description
- "Configuration of a routing instance.";
- leaf name {
- type string;
- description
- "The name of the routing instance.
-
- For system-controlled entries, the value of this leaf must
- be the same as the name of the corresponding entry in
- state data.
-
- For user-controlled entries, an arbitrary name can be
- used.";
- }
- leaf type {
- type identityref {
- base routing-instance-type;
- }
- default "rt:standard-routing-instance";
- description
- "The type of the routing instance.";
- }
- leaf enabled {
- type boolean;
- default "true";
- description
- "Enable/disable the routing instance.
-
- If this parameter is false, the parent routing instance is
- disabled and does not appear in operational state data,
- despite any other configuration that might be present.";
- }
- uses router-id {
- description
- "Configuration of the global router ID.";
- }
- leaf description {
- type string;
- description
- "Textual description of the routing instance.";
- }
- container default-ribs {
- if-feature multiple-ribs;
- description
- "Configuration of the default RIBs used by the routing
- instance.
-
- The default RIB for an addressed family if by default
- connected to all routing protocol instances supporting
- that address family, and always receives direct routes.";
- list default-rib {
- must "address-family=/routing/ribs/rib[name=current()/"
- + "rib-name]/address-family" {
- error-message "Address family mismatch.";
- description
- "The entry's address family MUST match that of the
- referenced RIB.";
- }
- key "address-family";
- description
- "Each list entry configures the default RIB for one
- address family.";
- uses address-family-grouping;
- leaf rib-name {
- type string;
- mandatory "true";
- description
- "Name of an existing RIB to be used as the default RIB
- for the given routing instance and address family.";
- }
- }
- }
- container interfaces {
- description
- "Configuration of the routing instance's interfaces.";
- list interface {
- key "name";
- description
- "List of network layer interfaces assigned to the routing
- instance.";
- leaf name {
- type if:interface-ref;
- description
- "A reference to the name of a configured network layer
- interface.";
- }
- }
- }
- container routing-protocols {
- description
- "Configuration of routing protocol instances.";
- list routing-protocol {
- key "name";
- description
- "Each entry contains configuration of a routing protocol
- instance.";
- leaf name {
- type string;
- description
- "An arbitrary name of the routing protocol instance.";
- }
- leaf description {
- type string;
- description
- "Textual description of the routing protocol
- instance.";
- }
- leaf enabled {
- type boolean;
- default "true";
- description
- "Enable/disable the routing protocol instance.
-
- If this parameter is false, the parent routing
- protocol instance is disabled and does not appear in
- operational state data, despite any other
- configuration that might be present.";
- }
- leaf type {
- type identityref {
- base routing-protocol;
- }
- mandatory "true";
- description
- "Type of the routing protocol - an identity derived
- from the 'routing-protocol' base identity.";
- }
- container connected-ribs {
- description
- "Configuration of connected RIBs.";
- list connected-rib {
- must "not(/routing/ribs/rib[name=current()/"
- + "preceding-sibling::connected-rib/"
- + "rib-name and address-family=/routing/ribs/"
- + "rib[name=current()/rib-name]/address-family])" {
- error-message
- "Duplicate address family for connected RIBs.";
- description
- "For each address family, there MUST NOT be more
- than one connected RIB.";
- }
- key "rib-name";
- description
- "List of RIBs to which the routing protocol instance
- is connected (at most one RIB per address family).
-
- If no connected RIB is configured for an address
- family, the routing protocol is connected to the
- default RIB for that address family.";
- leaf rib-name {
- type rib-ref;
- must "../../../type != 'rt:direct' or "
- + "../../../../../default-ribs/ "
- + "default-rib/rib-name=." {
- error-message "The 'direct' protocol can be "
- + "connected only to a default RIB.";
- description
- "For the 'direct' pseudo-protocol, the connected
- RIB must always be a default RIB.";
- }
- description
- "Name of an existing RIB.";
- }
- leaf import-filter {
- type route-filter-ref;
- description
- "Configuration of import filter.";
- }
- leaf export-filter {
- type route-filter-ref;
- description
- "Configuration of export filter.";
- }
- }
- }
- container static-routes {
- when "../type='rt:static'" {
- description
- "This container is only valid for the 'static'
- routing protocol.";
- }
- description
- "Configuration of the 'static' pseudo-protocol.
-
- Address family specific modules augment this node with
- their lists of routes.";
- }
- }
- }
- }
- container ribs {
- description
- "Configured RIBs.";
- list rib {
- key "name";
- description
- "Each entry represents a configured RIB identified by the
- 'name' key.
-
- Entries having the same key as a system-controlled entry
- of the list /routing-state/ribs/rib are used for
- configuring parameters of that entry. Other entries define
- additional user-controlled RIBs.";
- leaf name {
- type string;
- description
- "The name of the RIB.
-
- For system-controlled entries, the value of this leaf
- must be the same as the name of the corresponding entry
- in state data.
-
- For user-controlled entries, an arbitrary name can be
- used.";
- }
- uses address-family-grouping;
- leaf description {
- type string;
- description
- "Textual description of the RIB.";
- }
- container recipient-ribs {
- if-feature multiple-ribs;
- description
- "Configuration of recipient RIBs.";
- list recipient-rib {
- must "rib-name != ../../name" {
- error-message
- "Source and recipient RIBs are identical.";
- description
- "A RIB MUST NOT appear among its recipient RIBs.";
- }
- must "/routing/ribs/rib[name=current()/rib-name]/"
- + "address-family=../../address-family" {
- error-message "Address family mismatch.";
- description
- "Address family of the recipient RIB MUST match that
- of the source RIB.";
- }
- key "rib-name";
- description
- "Each entry configures a recipient RIB.";
- leaf rib-name {
- type rib-ref;
- description
- "The name of the recipient RIB.";
- }
- leaf filter {
- type route-filter-ref;
- description
- "A route filter which is applied to the routes passed
- to the recipient RIB.";
- }
- }
- }
- }
- }
- container route-filters {
- description
- "Configuration of route filters.";
- list route-filter {
- key "name";
- description
- "Each entry configures a named route filter.";
- leaf name {
- type string;
- description
- "The name of the route filter.";
- }
- leaf description {
- type string;
- description
- "Textual description of the route filter.";
- }
- leaf type {
- type identityref {
- base route-filter;
- }
- mandatory "true";
- description
- "Type of the route filter..";
- }
- }
- }
- }
-
- /* RPC methods */
-
- rpc active-route {
- description
- "Return the active route that a routing-instance uses for
- sending packets to a destination address.";
- input {
- leaf routing-instance-name {
- type routing-instance-state-ref;
- mandatory "true";
- description
- "Name of the routing instance whose forwarding information
- base is being queried.
-
- If the routing instance with name equal to the value of
- this parameter doesn't exist, then this operation SHALL
- fail with error-tag 'data-missing' and error-app-tag
- 'routing-instance-not-found'.";
- }
- container destination-address {
- description
- "Network layer destination address.
-
- Address family specific modules MUST augment this
- container with a leaf named 'address'.";
- uses address-family-grouping;
- }
- }
- output {
- container route {
- description
- "The active route for the specified destination.
-
- If the routing instance has no active route for the
- destination address, no output is returned - the server
- SHALL send an <rpc-reply> containing a single element
- <ok>.
-
- Address family specific modules MUST augment this list
- with appropriate route contents.";
- uses address-family-grouping;
- uses next-hop-content;
- uses route-metadata;
- }
- }
- }
-
- rpc route-count {
- description
- "Return the current number of routes in a RIB.";
- input {
- leaf rib-name {
- type rib-state-ref;
- mandatory "true";
- description
- "Name of the RIB.
-
- If the RIB with name equal to the value of this parameter
- doesn't exist, then this operation SHALL fail with
- error-tag 'data-missing' and error-app-tag
- 'rib-not-found'.";
- }
- }
- output {
- leaf number-of-routes {
- type uint64;
- mandatory "true";
- description
- "Number of routes in the RIB.";
- }
- }
- }
-} \ No newline at end of file
diff --git a/routing/routing-api/src/main/yang/vpp-routing.yang b/routing/routing-api/src/main/yang/vpp-routing.yang
deleted file mode 100644
index 1979db9e1..000000000
--- a/routing/routing-api/src/main/yang/vpp-routing.yang
+++ /dev/null
@@ -1,59 +0,0 @@
-module vpp-routing{
-
- namespace "urn:ietf:params:xml:ns:yang:vpp-routing";
- prefix "vpp-routing";
- description "General extensions for routes to be able to use VPP route defining apis";
-
- revision 2016-10-18 {
- description "Initial revision.";
- }
-
- import yang-ext {
- prefix "ext";
- }
-
- import vpp-classifier {
- prefix "classifier";
- }
-
- typedef vni-reference{
- type uint32;
- description "Vrf index reference";
- }
-
- grouping vpp-routing-attributes{
- //vrf_id
- leaf primary-vrf{
- type vni-reference;
- mandatory true;
- description "Main vrf associated to route";
- }
-
- leaf auto-create-vrf{
- type boolean;
- default false;
- description "If referenced primary vrf not exists,create while creating route";
- }
-
- //lookup_in_vrf
- leaf secondary-vrf{
- type vni-reference;
- description "Optional secondary vrf used to lookup in";
- }
-
- leaf classify-table{
- // classify_table_index + is_classify flag
- type classifier:classify-table-ref;
- description "Optional reference to classify table";
- }
- }
-
- grouping vpp-routing-state-attributes{
- //vrf_id
- leaf primary-vrf{
- type vni-reference;
- mandatory true;
- description "Main vrf associated to route";
- }
- }
-} \ No newline at end of file
diff --git a/v3po/api/asciidoc/Readme.adoc b/v3po/api/asciidoc/Readme.adoc
deleted file mode 100644
index f9e63cf10..000000000
--- a/v3po/api/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= v3po-api
-
-Overview of v3po-api \ No newline at end of file
diff --git a/v3po/api/pom.xml b/v3po/api/pom.xml
deleted file mode 100644
index b625f79df..000000000
--- a/v3po/api/pom.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>api-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../../common/api-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.v3po</groupId>
- <artifactId>v3po-api</artifactId>
- <name>${project.artifactId}</name>
- <version>1.16.12-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>iana-if-type-2014-05-08</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-yang-types-20130715</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-interfaces</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-inet-types-2013-07-15</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>yang-ext</artifactId>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>naming-context-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/v3po/api/src/main/yang/dot1q-types.yang b/v3po/api/src/main/yang/dot1q-types.yang
deleted file mode 100644
index 594b9d6ce..000000000
--- a/v3po/api/src/main/yang/dot1q-types.yang
+++ /dev/null
@@ -1,237 +0,0 @@
-module dot1q-types {
- namespace "urn:ieee:params:xml:ns:yang:dot1q-types";
- prefix dot1q;
-
- organization
- "Cisco Systems, Inc.
- Customer Service
-
- Postal: 170 W Tasman Drive
- San Jose, CA 95134
-
- Tel: +1 1800 553-NETS
-
- E-mail: cs-yang@cisco.com";
-
- contact
- "Robert Wilton - rwilton@cisco.com";
-
- description
- "This module contains a collection of generally useful YANG types
- that are specific to 802.1Q VLANs that can be usefully shared
- between multiple models.
-
- Terms and Acronyms
-
- 802.1Q: IEEE 802.1Q VLANs
-
- VLAN (vlan): Virtual Local Area Network
- ";
-
- revision 2015-06-26 {
- description "Latest revision, changed namespace";
-
- reference "Intended to be standardized IEEE 802.1";
- }
-
- typedef PCP {
- type uint8 {
- range "0..7";
- }
- description
- "Priority Code Point. PCP is a 3-bit field that refers to the
- class of service applied to an 802.1Q VLAN tagged frame. The
- field specifies a priority value between 0 and 7, these values
- can be used by quality of service (QoS) to prioritize
- different classes of traffic.";
- reference "IEEE 802.1Q (2014)";
- }
-
- /*
- * Defines what it means to be an 802.1Q VLAN Id, where values 0
- * and 4095 are reserved.
- */
- typedef dot1q-vlan-id {
- type uint16 {
- range "1..4094";
- }
- description "An 802.1Q VLAN Identifier";
- reference "IEEE 802.1Q (2014)";
- }
-
- /*
- * Defines the supported IEEE 802.1Q types that can be used for
- * VLAN tag matching.
- */
- identity dot1q-tag-vlan-type {
- description "Base identity from which all 802.1Q VLAN tag types
- are derived from";
- }
-
- identity c-vlan {
- base dot1q-tag-vlan-type;
- description
- "An 802.1Q Customer-VLAN tag, normally using the 0x8100
- Ethertype";
- }
-
- identity s-vlan {
- base dot1q-tag-vlan-type;
- description
- "An 802.1Q Service-VLAN tag, using the 0x88a8 Ethertype
- originally introduced in 802.1ad, and incorporated into
- 802.1Q (2011)";
- }
-
- typedef dot1q-tag-type {
- type identityref {
- base "dot1q-tag-vlan-type";
- }
- description "Identifies a specific 802.1Q tag type";
- reference "IEEE 802.1Q (2014)";
- }
-
- /*
- * Defines the type used to represent ranges of VLAN Ids.
- *
- * Ideally we would model that as a list of VLAN Ids in YANG, but
- * the model is easier to use if this is just represented as a
- * string.
- *
- * This type is used to match an ordered list of VLAN Ids, or
- * contiguous ranges of VLAN Ids. Valid VLAN Ids must be in the
- * range 1 to 4094, and included in the list in non overlapping
- * ascending order.
- *
- * E.g. "1, 10-100, 50, 500-1000"
- */
- typedef dot1q-vlan-id-ranges {
- type string {
- pattern "([0-9]{1,4}(-[0-9]{1,4})?(,[0-9]{1,4}" +
- "(-[0-9]{1,4})?)*)";
- }
- description "A list of VLAN Ids, or non overlapping VLAN ranges,
- in ascending order, between 1 and 4094";
- }
-
- /*
- * A grouping which represents an 802.1Q VLAN tag, matching both
- * the tag Ethertype and a single VLAN Id. The PCP and DEI fields
- * in the 802.1Q tag are ignored for tag matching purposes.
- */
- grouping dot1q-tag {
- description "Grouping to allow configuration to identify a single
- 802.1Q VLAN tag";
- container dot1q-tag {
- description "Identifies an 802.1Q VLAN tag with an explicit
- tag-type and a single VLAN Id";
- leaf tag-type {
- type dot1q-tag-type;
- mandatory true;
- description "VLAN tag type";
- }
- leaf vlan-id {
- type dot1q-vlan-id;
- mandatory true;
- description "VLAN Id";
- }
- }
- }
-
- /*
- * A grouping which represents an 802.1Q VLAN tag, matching both
- * the tag Ethertype and a single VLAN Id or "any" to match on any
- * VLAN Id. The PCP and DEI fields in the 802.1Q tag are ignored
- * for tag matching purposes.
- */
- grouping dot1q-tag-or-any {
- description "Grouping to allow configuration to identify a single
- 802.1Q VLAN tag or the 'any' value to match any VLAN
- Id not matched by a more specific VLAN Id match";
- container dot1q-tag {
- description "Identifies an 802.1Q VLAN tag with an explicit
- tag-type and a single VLAN Id, or 'any' VLAN Id";
- leaf tag-type {
- type dot1q-tag-type;
- mandatory true;
- description "VLAN tag type";
- }
- leaf vlan-id {
- type union {
- type dot1q-vlan-id;
- type enumeration {
- enum "any" {
- value 4096;
- description
- "Matches 'any' VLAN tag in the range 1 to 4094 that
- is not matched by a more specific VLAN Id match";
- }
- }
- }
- mandatory true;
- description "VLAN Id or any";
- }
- }
- }
-
- /*
- * A grouping which represents an 802.1Q tag that matches a range
- * of VLAN Ids. The PCP and DEI fields in the 802.1Q tag are
- * ignored for tag matching purposes.
- */
- grouping dot1q-tag-ranges {
- description "Grouping to allow configuration to identify an
- 802.1Q VLAN tag that matches any VLAN Id within a
- set of non overlapping VLAN Id ranges";
- container dot1q-tag {
- description "Identifies an 802.1Q VLAN tag with an explicit
- tag-type and and a range of VLAN Ids";
- leaf tag-type {
- type dot1q-tag-type;
- mandatory true;
- description "VLAN tag type";
- }
- leaf vlan-ids {
- type dot1q-vlan-id-ranges;
- mandatory true;
- description "VLAN Ids";
- }
- }
- }
-
- /*
- * A grouping which represents an 802.1Q VLAN tag, matching both
- * the tag Ethertype and a single VLAN Id, ordered list of ranges,
- * or "any" to match on any VLAN Id. The PCP and DEI fields in the
- * 802.1Q tag are ignored for tag matching purposes.
- */
- grouping dot1q-tag-ranges-or-any {
- description "Grouping to allow configuration to identify an
- 802.1Q VLAN tag that matches any specific VLAN Id
- within a set of non overlapping VLAN Id ranges, or
- the 'any' value to match any VLAN Id";
- container dot1q-tag {
- description "Identifies an 802.1Q VLAN tag with an explicit
- tag-type, an ordered list of VLAN Id ranges, or
- 'any' VLAN Id";
- leaf tag-type {
- type dot1q-tag-type;
- mandatory true;
- description "VLAN tag type";
- }
- leaf vlan-id {
- type union {
- type dot1q-vlan-id-ranges;
- type enumeration {
- enum "any" {
- description "Matches 'any' VLAN tag in the range 1 to
- 4094";
- }
- }
- }
- mandatory true;
- description "VLAN Ids or any";
- }
- }
- }
-} \ No newline at end of file
diff --git a/v3po/api/src/main/yang/ietf-access-control-list.yang b/v3po/api/src/main/yang/ietf-access-control-list.yang
deleted file mode 100644
index 3083ee2a0..000000000
--- a/v3po/api/src/main/yang/ietf-access-control-list.yang
+++ /dev/null
@@ -1,208 +0,0 @@
-module ietf-access-control-list {
- yang-version 1.1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-access-control-list";
- prefix acl;
- import ietf-yang-types {
- prefix yang;
- }
- import ietf-packet-fields {
- prefix packet-fields;
- }
- organization "IETF NETMOD (NETCONF Data Modeling Language)
- Working Group";
- contact
- "WG Web: http://tools.ietf.org/wg/netmod/
- WG List: netmod@ietf.org
- WG Chair: Juergen Schoenwaelder
- j.schoenwaelder@jacobs-university.de
- WG Chair: Tom Nadeau
- tnadeau@lucidvision.com
- Editor: Dean Bogdanovic
- ivandean@gmail.com
- Editor: Kiran Agrahara Sreenivasa
- kkoushik@cisco.com
- Editor: Lisa Huang
- lyihuang16@gmail.com
- Editor: Dana Blair
- dblair@cisco.com";
- description
- "This YANG module defines a component that describing the
- configuration of Access Control Lists (ACLs).
- Copyright (c) 2015 IETF Trust and the persons identified as
- the document authors. All rights reserved.
- Redistribution and use in source and binary forms, with or
- without modification, is permitted pursuant to, and subject
- to the license terms contained in, the Simplified BSD
- License set forth in Section 4.c of the IETF Trust's Legal
- Provisions Relating to IETF Documents
- (http://trustee.ietf.org/license-info).
- This version of this YANG module is part of RFC XXXX; see
- the RFC itself for full legal notices.";
- revision 2016-07-08 {
- description
- "Base model for Network Access Control List (ACL).";
- reference
- "RFC XXXX: Network Access Control List (ACL)
- YANG Data Model";
- }
- identity acl-base {
- description
- "Base Access Control List type for all Access Control List type
- identifiers.";
- }
- identity ipv4-acl {
- base acl:acl-base;
- description
- "ACL that primarily matches on fields from the IPv4 header
- (e.g. IPv4 destination address) and layer 4 headers (e.g. TCP
- destination port). An acl of type ipv4-acl does not contain
- matches on fields in the ethernet header or the IPv6 header.";
- }
- identity ipv6-acl {
- base acl:acl-base;
- description
- "ACL that primarily matches on fields from the IPv6 header
- (e.g. IPv6 destination address) and layer 4 headers (e.g. TCP
- destination port). An acl of type ipv6-acl does not contain
- matches on fields in the ethernet header or the IPv4 header.";
- }
- identity eth-acl {
- base acl:acl-base;
- description
- "ACL that primarily matches on fields in the ethernet header,
- like 10/100/1000baseT or WiFi Access Control List. An acl of
- type eth-acl does not contain matches on fields in the IPv4
- header, IPv6 header or layer 4 headers.";
- }
- typedef acl-type {
- type identityref {
- base acl:acl-base;
- }
- description
- "This type is used to refer to an Access Control List
- (ACL) type";
- }
- typedef access-control-list-ref {
- type leafref {
- path "/access-lists/acl/acl-name";
- }
- description
- "This type is used by data models that need to reference an
- Access Control List";
- }
- container access-lists {
- description
- "This is a top level container for Access Control Lists.
- It can have one or more Access Control Lists.";
- list acl {
- key "acl-type acl-name";
- description
- "An Access Control List(ACL) is an ordered list of
- Access List Entries (ACE). Each Access Control Entry has a
- list of match criteria and a list of actions.
- Since there are several kinds of Access Control Lists
- implemented with different attributes for
- different vendors, this
- model accommodates customizing Access Control Lists for
- each kind and for each vendor.";
- leaf acl-name {
- type string;
- description
- "The name of access-list. A device MAY restrict the length
- and value of this name, possibly space and special
- characters are not allowed.";
- }
- leaf acl-type {
- type acl-type;
- description
- "Type of access control list. Indicates the primary intended
- type of match criteria (e.g. ethernet, IPv4, IPv6, mixed, etc)
- used in the list instance.";
- }
- container acl-oper-data {
- config false;
- description
- "Overall Access Control List operational data";
- }
- container access-list-entries {
- description
- "The access-list-entries container contains
- a list of access-list-entries(ACE).";
- list ace {
- key "rule-name";
- ordered-by user;
- description
- "List of access list entries(ACE)";
- leaf rule-name {
- type string;
- description
- "A unique name identifying this Access List
- Entry(ACE).";
- }
- container matches {
- description
- "Definitions for match criteria for this Access List
- Entry.";
- choice ace-type {
- description
- "Type of access list entry.";
- case ace-ip {
- description "IP Access List Entry.";
- choice ace-ip-version {
- description
- "IP version used in this Access List Entry.";
- case ace-ipv4 {
- uses packet-fields:acl-ipv4-header-fields;
- }
- case ace-ipv6 {
- uses packet-fields:acl-ipv6-header-fields;
- }
- }
- uses packet-fields:acl-ip-header-fields;
- }
- case ace-eth {
- description
- "Ethernet Access List entry.";
- uses packet-fields:acl-eth-header-fields;
- }
- }
- }
- container actions {
- description
- "Definitions of action criteria for this Access List
- Entry.";
- choice packet-handling {
- default "deny";
- description
- "Packet handling action.";
- case deny {
- leaf deny {
- type empty;
- description
- "Deny action.";
- }
- }
- case permit {
- leaf permit {
- type empty;
- description
- "Permit action.";
- }
- }
- }
- }
- container ace-oper-data {
- config false;
- description
- "Operational data for this Access List Entry.";
- leaf match-counter {
- type yang:counter64;
- description
- "Number of matches for this Access List Entry";
- }
- }
- }
- }
- }
- }
-}
diff --git a/v3po/api/src/main/yang/ietf-acl-context.yang b/v3po/api/src/main/yang/ietf-acl-context.yang
deleted file mode 100644
index 71bfb73e4..000000000
--- a/v3po/api/src/main/yang/ietf-acl-context.yang
+++ /dev/null
@@ -1,67 +0,0 @@
-module ietf-acl-context {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:vpp:acl:context";
- prefix "nc";
-
- description "Context for nat mapping";
-
- revision "2016-12-14" {
- description "Initial revision.";
- }
-
- import ietf-inet-types {
- prefix "inet";
- }
-
- import naming-context {
- prefix "nc";
- }
-
- import yang-ext {
- prefix "ext";
- }
-
- grouping mapping-entry-context-attributes {
- container acl-mapping-entry-context {
- list mapping-table {
- key "direction";
-
- leaf direction {
- type enumeration {
- enum "ingress";
- enum "egress";
- }
- }
-
- list mapping-entry {
- key "index";
-
- leaf index {
- type int32;
- description "interface id";
- }
-
- leaf ip4_table_id {
- type int32;
- description "ip4 table id";
- }
-
- leaf ip6_table_id {
- type int32;
- description "ip6 table id";
- }
-
- leaf l2_table_id {
- type int32;
- description "l2 table id";
- }
- }
- }
- }
- }
-
- augment /nc:contexts {
- ext:augment-identifier "acl-mapping-entry-ctx-augmentation";
- uses mapping-entry-context-attributes;
- }
-} \ No newline at end of file
diff --git a/v3po/api/src/main/yang/ietf-ip.yang b/v3po/api/src/main/yang/ietf-ip.yang
deleted file mode 100644
index f6c59edea..000000000
--- a/v3po/api/src/main/yang/ietf-ip.yang
+++ /dev/null
@@ -1,742 +0,0 @@
-module ietf-ip {
-
- yang-version 1;
-
- namespace
- "urn:ietf:params:xml:ns:yang:ietf-ip";
-
- prefix ip;
-
- import ietf-interfaces {
- prefix if;
- }
- import ietf-inet-types {
- prefix inet;
- }
- import ietf-yang-types {
- prefix yang;
- }
-
- organization
- "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
-
- contact
- "WG Web: <http://tools.ietf.org/wg/netmod/>
- WG List: <mailto:netmod@ietf.org>
-
- WG Chair: Thomas Nadeau
- <mailto:tnadeau@lucidvision.com>
-
- WG Chair: Juergen Schoenwaelder
- <mailto:j.schoenwaelder@jacobs-university.de>
-
- Editor: Martin Bjorklund
- <mailto:mbj@tail-f.com>";
-
- description
- "This module contains a collection of YANG definitions for
- configuring IP implementations.
-
- Copyright (c) 2014 IETF Trust and the persons identified as
- authors of the code. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, is permitted pursuant to, and subject
- to the license terms contained in, the Simplified BSD License
- set forth in Section 4.c of the IETF Trust's Legal Provisions
- Relating to IETF Documents
- (http://trustee.ietf.org/license-info).
-
- This version of this YANG module is part of RFC 7277; see
- the RFC itself for full legal notices.";
-
- revision "2014-06-16" {
- description "Initial revision.";
- reference
- "RFC 7277: A YANG Data Model for IP Management";
-
- }
-
-
- feature ipv4-non-contiguous-netmasks {
- description
- "Indicates support for configuring non-contiguous
- subnet masks.";
- }
-
- feature ipv6-privacy-autoconf {
- description
- "Indicates support for Privacy Extensions for Stateless Address
- Autoconfiguration in IPv6.";
- reference
- "RFC 4941: Privacy Extensions for Stateless Address
- Autoconfiguration in IPv6";
-
- }
-
- typedef ip-address-origin {
- type enumeration {
- enum "other" {
- value 0;
- description
- "None of the following.";
- }
- enum "static" {
- value 1;
- description
- "Indicates that the address has been statically
- configured - for example, using NETCONF or a Command Line
- Interface.";
- }
- enum "dhcp" {
- value 2;
- description
- "Indicates an address that has been assigned to this
- system by a DHCP server.";
- }
- enum "link-layer" {
- value 3;
- description
- "Indicates an address created by IPv6 stateless
- autoconfiguration that embeds a link-layer address in its
- interface identifier.";
- }
- enum "random" {
- value 4;
- description
- "Indicates an address chosen by the system at
-
- random, e.g., an IPv4 address within 169.254/16, an
- RFC 4941 temporary address, or an RFC 7217 semantically
- opaque address.";
- reference
- "RFC 4941: Privacy Extensions for Stateless Address
- Autoconfiguration in IPv6
- RFC 7217: A Method for Generating Semantically Opaque
- Interface Identifiers with IPv6 Stateless
- Address Autoconfiguration (SLAAC)";
-
- }
- }
- description
- "The origin of an address.";
- }
-
- typedef neighbor-origin {
- type enumeration {
- enum "other" {
- value 0;
- description
- "None of the following.";
- }
- enum "static" {
- value 1;
- description
- "Indicates that the mapping has been statically
- configured - for example, using NETCONF or a Command Line
- Interface.";
- }
- enum "dynamic" {
- value 2;
- description
- "Indicates that the mapping has been dynamically resolved
- using, e.g., IPv4 ARP or the IPv6 Neighbor Discovery
- protocol.";
- }
- }
- description
- "The origin of a neighbor entry.";
- }
-
- augment /if:interfaces/if:interface {
- description
- "Parameters for configuring IP on interfaces.
-
- If an interface is not capable of running IP, the server
- must not allow the client to configure these parameters.";
- container ipv4 {
- presence
- "Enables IPv4 unless the 'enabled' leaf
- (which defaults to 'true') is set to 'false'";
- description
- "Parameters for the IPv4 address family.";
- leaf enabled {
- type boolean;
- default 'true';
- description
- "Controls whether IPv4 is enabled or disabled on this
- interface. When IPv4 is enabled, this interface is
- connected to an IPv4 stack, and the interface can send
- and receive IPv4 packets.";
- }
-
- leaf forwarding {
- type boolean;
- default 'false';
- description
- "Controls IPv4 packet forwarding of datagrams received by,
- but not addressed to, this interface. IPv4 routers
- forward datagrams. IPv4 hosts do not (except those
- source-routed via the host).";
- }
-
- leaf mtu {
- type uint16 {
- range "68..max";
- }
- units "octets";
- description
- "The size, in octets, of the largest IPv4 packet that the
- interface will send and receive.
-
- The server may restrict the allowed values for this leaf,
- depending on the interface's type.
-
- If this leaf is not configured, the operationally used MTU
- depends on the interface's type.";
- reference
- "RFC 791: Internet Protocol";
-
- }
-
- list address {
- key "ip";
- description
- "The list of configured IPv4 addresses on the interface.";
- leaf ip {
- type inet:ipv4-address-no-zone;
- description
- "The IPv4 address on the interface.";
- }
-
- choice subnet {
- mandatory true;
- description
- "The subnet can be specified as a prefix-length, or,
- if the server supports non-contiguous netmasks, as
- a netmask.";
- leaf prefix-length {
- type uint8 {
- range "0..32";
- }
- description
- "The length of the subnet prefix.";
- }
- leaf netmask {
- if-feature ipv4-non-contiguous-netmasks;
- type yang:dotted-quad;
- description
- "The subnet specified as a netmask.";
- }
- } // choice subnet
- } // list address
-
- list neighbor {
- key "ip";
- description
- "A list of mappings from IPv4 addresses to
- link-layer addresses.
-
- Entries in this list are used as static entries in the
- ARP Cache.";
- reference
- "RFC 826: An Ethernet Address Resolution Protocol";
-
- leaf ip {
- type inet:ipv4-address-no-zone;
- description
- "The IPv4 address of the neighbor node.";
- }
-
- leaf link-layer-address {
- type yang:phys-address;
- mandatory true;
- description
- "The link-layer address of the neighbor node.";
- }
- } // list neighbor
- } // container ipv4
-
- container ipv6 {
- presence
- "Enables IPv6 unless the 'enabled' leaf
- (which defaults to 'true') is set to 'false'";
- description
- "Parameters for the IPv6 address family.";
- leaf enabled {
- type boolean;
- default 'true';
- description
- "Controls whether IPv6 is enabled or disabled on this
- interface. When IPv6 is enabled, this interface is
- connected to an IPv6 stack, and the interface can send
- and receive IPv6 packets.";
- }
-
- leaf forwarding {
- type boolean;
- default 'false';
- description
- "Controls IPv6 packet forwarding of datagrams received by,
- but not addressed to, this interface. IPv6 routers
- forward datagrams. IPv6 hosts do not (except those
- source-routed via the host).";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
- Section 6.2.1, IsRouter";
-
- }
-
- leaf mtu {
- type uint32 {
- range "1280..max";
- }
- units "octets";
- description
- "The size, in octets, of the largest IPv6 packet that the
- interface will send and receive.
-
- The server may restrict the allowed values for this leaf,
- depending on the interface's type.
-
- If this leaf is not configured, the operationally used MTU
- depends on the interface's type.";
- reference
- "RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
- Section 5";
-
- }
-
- list address {
- key "ip";
- description
- "The list of configured IPv6 addresses on the interface.";
- leaf ip {
- type inet:ipv6-address-no-zone;
- description
- "The IPv6 address on the interface.";
- }
-
- leaf prefix-length {
- type uint8 {
- range "0..128";
- }
- mandatory true;
- description
- "The length of the subnet prefix.";
- }
- } // list address
-
- list neighbor {
- key "ip";
- description
- "A list of mappings from IPv6 addresses to
- link-layer addresses.
-
- Entries in this list are used as static entries in the
- Neighbor Cache.";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)";
-
- leaf ip {
- type inet:ipv6-address-no-zone;
- description
- "The IPv6 address of the neighbor node.";
- }
-
- leaf link-layer-address {
- type yang:phys-address;
- mandatory true;
- description
- "The link-layer address of the neighbor node.";
- }
- } // list neighbor
-
- leaf dup-addr-detect-transmits {
- type uint32;
- default '1';
- description
- "The number of consecutive Neighbor Solicitation messages
- sent while performing Duplicate Address Detection on a
- tentative address. A value of zero indicates that
- Duplicate Address Detection is not performed on
- tentative addresses. A value of one indicates a single
- transmission with no follow-up retransmissions.";
- reference
- "RFC 4862: IPv6 Stateless Address Autoconfiguration";
-
- }
-
- container autoconf {
- description
- "Parameters to control the autoconfiguration of IPv6
- addresses, as described in RFC 4862.";
- reference
- "RFC 4862: IPv6 Stateless Address Autoconfiguration";
-
- leaf create-global-addresses {
- type boolean;
- default 'true';
- description
- "If enabled, the host creates global addresses as
- described in RFC 4862.";
- reference
- "RFC 4862: IPv6 Stateless Address Autoconfiguration
- Section 5.5";
-
- }
-
- leaf create-temporary-addresses {
- if-feature ipv6-privacy-autoconf;
- type boolean;
- default 'false';
- description
- "If enabled, the host creates temporary addresses as
- described in RFC 4941.";
- reference
- "RFC 4941: Privacy Extensions for Stateless Address
- Autoconfiguration in IPv6";
-
- }
-
- leaf temporary-valid-lifetime {
- if-feature ipv6-privacy-autoconf;
- type uint32;
- units "seconds";
- default '604800';
- description
- "The time period during which the temporary address
- is valid.";
- reference
- "RFC 4941: Privacy Extensions for Stateless Address
- Autoconfiguration in IPv6
- - TEMP_VALID_LIFETIME";
-
- }
-
- leaf temporary-preferred-lifetime {
- if-feature ipv6-privacy-autoconf;
- type uint32;
- units "seconds";
- default '86400';
- description
- "The time period during which the temporary address is
- preferred.";
- reference
- "RFC 4941: Privacy Extensions for Stateless Address
- Autoconfiguration in IPv6
- - TEMP_PREFERRED_LIFETIME";
-
- }
- } // container autoconf
- } // container ipv6
- }
-
- augment /if:interfaces-state/if:interface {
- description
- "Data nodes for the operational state of IP on interfaces.";
- container ipv4 {
- presence
- "Present if IPv4 is enabled on this interface";
- config false;
- description
- "Interface-specific parameters for the IPv4 address family.";
- leaf forwarding {
- type boolean;
- description
- "Indicates whether IPv4 packet forwarding is enabled or
- disabled on this interface.";
- }
-
- leaf mtu {
- type uint16 {
- range "68..max";
- }
- units "octets";
- description
- "The size, in octets, of the largest IPv4 packet that the
- interface will send and receive.";
- reference
- "RFC 791: Internet Protocol";
-
- }
-
- list address {
- key "ip";
- description
- "The list of IPv4 addresses on the interface.";
- leaf ip {
- type inet:ipv4-address-no-zone;
- description
- "The IPv4 address on the interface.";
- }
-
- choice subnet {
- description
- "The subnet can be specified as a prefix-length, or,
- if the server supports non-contiguous netmasks, as
- a netmask.";
- leaf prefix-length {
- type uint8 {
- range "0..32";
- }
- description
- "The length of the subnet prefix.";
- }
- leaf netmask {
- if-feature ipv4-non-contiguous-netmasks;
- type yang:dotted-quad;
- description
- "The subnet specified as a netmask.";
- }
- } // choice subnet
-
- leaf origin {
- type ip-address-origin;
- description
- "The origin of this address.";
- }
- } // list address
-
- list neighbor {
- key "ip";
- description
- "A list of mappings from IPv4 addresses to
- link-layer addresses.
-
- This list represents the ARP Cache.";
- reference
- "RFC 826: An Ethernet Address Resolution Protocol";
-
- leaf ip {
- type inet:ipv4-address-no-zone;
- description
- "The IPv4 address of the neighbor node.";
- }
-
- leaf link-layer-address {
- type yang:phys-address;
- description
- "The link-layer address of the neighbor node.";
- }
-
- leaf origin {
- type neighbor-origin;
- description
- "The origin of this neighbor entry.";
- }
- } // list neighbor
- } // container ipv4
-
- container ipv6 {
- presence
- "Present if IPv6 is enabled on this interface";
- config false;
- description
- "Parameters for the IPv6 address family.";
- leaf forwarding {
- type boolean;
- default 'false';
- description
- "Indicates whether IPv6 packet forwarding is enabled or
- disabled on this interface.";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
- Section 6.2.1, IsRouter";
-
- }
-
- leaf mtu {
- type uint32 {
- range "1280..max";
- }
- units "octets";
- description
- "The size, in octets, of the largest IPv6 packet that the
- interface will send and receive.";
- reference
- "RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
- Section 5";
-
- }
-
- list address {
- key "ip";
- description
- "The list of IPv6 addresses on the interface.";
- leaf ip {
- type inet:ipv6-address-no-zone;
- description
- "The IPv6 address on the interface.";
- }
-
- leaf prefix-length {
- type uint8 {
- range "0..128";
- }
- mandatory true;
- description
- "The length of the subnet prefix.";
- }
-
- leaf origin {
- type ip-address-origin;
- description
- "The origin of this address.";
- }
-
- leaf status {
- type enumeration {
- enum "preferred" {
- value 0;
- description
- "This is a valid address that can appear as the
- destination or source address of a packet.";
- }
- enum "deprecated" {
- value 1;
- description
- "This is a valid but deprecated address that should
- no longer be used as a source address in new
- communications, but packets addressed to such an
- address are processed as expected.";
- }
- enum "invalid" {
- value 2;
- description
- "This isn't a valid address, and it shouldn't appear
- as the destination or source address of a packet.";
- }
- enum "inaccessible" {
- value 3;
- description
- "The address is not accessible because the interface
- to which this address is assigned is not
- operational.";
- }
- enum "unknown" {
- value 4;
- description
- "The status cannot be determined for some reason.";
- }
- enum "tentative" {
- value 5;
- description
- "The uniqueness of the address on the link is being
- verified. Addresses in this state should not be
- used for general communication and should only be
- used to determine the uniqueness of the address.";
- }
- enum "duplicate" {
- value 6;
- description
- "The address has been determined to be non-unique on
- the link and so must not be used.";
- }
- enum "optimistic" {
- value 7;
- description
- "The address is available for use, subject to
- restrictions, while its uniqueness on a link is
- being verified.";
- }
- }
- description
- "The status of an address. Most of the states correspond
- to states from the IPv6 Stateless Address
- Autoconfiguration protocol.";
- reference
- "RFC 4293: Management Information Base for the
- Internet Protocol (IP)
- - IpAddressStatusTC
- RFC 4862: IPv6 Stateless Address Autoconfiguration";
-
- }
- } // list address
-
- list neighbor {
- key "ip";
- description
- "A list of mappings from IPv6 addresses to
- link-layer addresses.
-
- This list represents the Neighbor Cache.";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)";
-
- leaf ip {
- type inet:ipv6-address-no-zone;
- description
- "The IPv6 address of the neighbor node.";
- }
-
- leaf link-layer-address {
- type yang:phys-address;
- description
- "The link-layer address of the neighbor node.";
- }
-
- leaf origin {
- type neighbor-origin;
- description
- "The origin of this neighbor entry.";
- }
-
- leaf is-router {
- type empty;
- description
- "Indicates that the neighbor node acts as a router.";
- }
-
- leaf state {
- type enumeration {
- enum "incomplete" {
- value 0;
- description
- "Address resolution is in progress, and the link-layer
- address of the neighbor has not yet been
- determined.";
- }
- enum "reachable" {
- value 1;
- description
- "Roughly speaking, the neighbor is known to have been
- reachable recently (within tens of seconds ago).";
- }
- enum "stale" {
- value 2;
- description
- "The neighbor is no longer known to be reachable, but
- until traffic is sent to the neighbor no attempt
- should be made to verify its reachability.";
- }
- enum "delay" {
- value 3;
- description
- "The neighbor is no longer known to be reachable, and
- traffic has recently been sent to the neighbor.
- Rather than probe the neighbor immediately, however,
- delay sending probes for a short while in order to
- give upper-layer protocols a chance to provide
- reachability confirmation.";
- }
- enum "probe" {
- value 4;
- description
- "The neighbor is no longer known to be reachable, and
- unicast Neighbor Solicitation probes are being sent
- to verify reachability.";
- }
- }
- description
- "The Neighbor Unreachability Detection state of this
- entry.";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
- Section 7.3.2";
-
- }
- } // list neighbor
- } // container ipv6
- }
-} // module ietf-ip
diff --git a/v3po/api/src/main/yang/ietf-packet-fields.yang b/v3po/api/src/main/yang/ietf-packet-fields.yang
deleted file mode 100644
index 0b1ce5cdd..000000000
--- a/v3po/api/src/main/yang/ietf-packet-fields.yang
+++ /dev/null
@@ -1,180 +0,0 @@
-module ietf-packet-fields {
- yang-version 1.1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-packet-fields";
- prefix packet-fields;
- import ietf-inet-types {
- prefix inet;
- }
- import ietf-yang-types {
- prefix yang;
- }
- organization "IETF NETMOD (NETCONF Data Modeling Language) Working
- Group";
- contact
- "WG Web: http://tools.ietf.org/wg/netmod/
- WG List: netmod@ietf.org
- WG Chair: Juergen Schoenwaelder
- j.schoenwaelder@jacobs-university.de
- WG Chair: Tom Nadeau
- tnadeau@lucidvision.com
- Editor: Dean Bogdanovic
- deanb@juniper.net
- Editor: Kiran Agrahara Sreenivasa
- kkoushik@cisco.com
- Editor: Lisa Huang
- lyihuang16@gmail.com
- Editor: Dana Blair
- dblair@cisco.com";
- description
- "This YANG module defines groupings that are used by
- ietf-access-control-list YANG module. Their usage is not
- limited to ietf-access-control-list and can be
- used anywhere as applicable.
- Copyright (c) 2015 IETF Trust and the persons identified as
- the document authors. All rights reserved.
- Redistribution and use in source and binary forms, with or
- without modification, is permitted pursuant to, and subject
- to the license terms contained in, the Simplified BSD
- License set forth in Section 4.c of the IETF Trust's Legal
- Provisions Relating to IETF Documents
- (http://trustee.ietf.org/license-info).
- This version of this YANG module is part of RFC XXXX; see
- the RFC itself for full legal notices.";
- revision 2016-07-08 {
- description
- "Initial version of packet fields used by
- ietf-access-control-list";
- reference
- "RFC XXXX: Network Access Control List (ACL)
- YANG Data Model";
- }
- grouping acl-transport-header-fields {
- description
- "Transport header fields";
- container source-port-range {
- presence "Enables setting source port range";
- description
- "Inclusive range representing source ports to be used.
- When only lower-port is present, it represents a single port.";
- leaf lower-port {
- type inet:port-number;
- mandatory true;
- description
- "Lower boundary for port.";
- }
- leaf upper-port {
- type inet:port-number;
- must ". >= ../lower-port" {
- error-message
- "The upper-port must be greater than or equal to lower-port";
- }
- description
- "Upper boundary for port . If existing, the upper port
- must be greater or equal to lower-port.";
- }
- }
- container destination-port-range {
- presence "Enables setting destination port range";
- description
- "Inclusive range representing destination ports to be used. When
- only lower-port is present, it represents a single port.";
- leaf lower-port {
- type inet:port-number;
- mandatory true;
- description
- "Lower boundary for port.";
- }
- leaf upper-port {
- type inet:port-number;
- must ". >= ../lower-port" {
- error-message
- "The upper-port must be greater than or equal to lower-port";
- }
-
- description
- "Upper boundary for port. If existing, the upper port must
- be greater or equal to lower-port";
- }
- }
- }
- grouping acl-ip-header-fields {
- description
- "IP header fields common to ipv4 and ipv6";
- leaf dscp {
- type inet:dscp;
- description
- "Value of dscp.";
- }
- leaf protocol {
- type uint8;
- description
- "Internet Protocol number.";
- }
- uses acl-transport-header-fields;
- }
- grouping acl-ipv4-header-fields {
- description
- "Fields in IPv4 header.";
- leaf destination-ipv4-network {
- type inet:ipv4-prefix;
- description
- "Destination IPv4 address prefix.";
- }
- leaf source-ipv4-network {
- type inet:ipv4-prefix;
- description
- "Source IPv4 address prefix.";
- }
- }
- grouping acl-ipv6-header-fields {
- description
- "Fields in IPv6 header";
- leaf destination-ipv6-network {
- type inet:ipv6-prefix;
- description
- "Destination IPv6 address prefix.";
- }
- leaf source-ipv6-network {
- type inet:ipv6-prefix;
- description
- "Source IPv6 address prefix.";
- }
- leaf flow-label {
- type inet:ipv6-flow-label;
- description
- "IPv6 Flow label.";
- }
- reference
- "RFC 4291: IP Version 6 Addressing Architecture
- RFC 4007: IPv6 Scoped Address Architecture
- RFC 5952: A Recommendation for IPv6 Address Text Representation";
- }
- grouping acl-eth-header-fields {
- description
- "Fields in Ethernet header.";
- leaf destination-mac-address {
- type yang:mac-address;
- description
- "Destination IEEE 802 MAC address.";
- }
- leaf destination-mac-address-mask {
- type yang:mac-address;
- description
- "Destination IEEE 802 MAC address mask.";
- }
- leaf source-mac-address {
- type yang:mac-address;
- description
- "Source IEEE 802 MAC address.";
- }
- leaf source-mac-address-mask {
- type yang:mac-address;
- description
- "Source IEEE 802 MAC address mask.";
- }
- reference
- "IEEE 802: IEEE Standard for Local and Metropolitan Area
- Networks: Overview and Architecture.";
- }
-
-} \ No newline at end of file
diff --git a/v3po/api/src/main/yang/pbb-types.yang b/v3po/api/src/main/yang/pbb-types.yang
deleted file mode 100644
index 8c3aad41a..000000000
--- a/v3po/api/src/main/yang/pbb-types.yang
+++ /dev/null
@@ -1,81 +0,0 @@
-module pbb-types {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:pbb-types";
- prefix "pbb-types";
-
- description "Common types used for defining Pbb based subinterfaces";
-
- revision "2016-12-14" {
- description
- "Initial revision.";
- }
-
- import ietf-yang-types {
- prefix yang;
- }
-
- import ietf-interfaces {
- prefix if;
- }
-
- import yang-ext {
- prefix "ext";
- }
-
- typedef operation {
- type enumeration {
- // NOTE - Does not specify disabled enum value(0), because its used internally to delete/disable rewrite
- enum "push-2" {
- value 2;
- }
-
- enum "pop-2" {
- value 4;
- description "Encapsulate/Decapsulate pbb packet according to incoming/outcoming direction";
- }
- enum "translate-2-1" {
- value 7;
- }
- }
- }
-
- grouping pbb-rewrite-attributes {
- description "Provider Backbone Bridge attributes";
-
- leaf destination-address {
- type yang:mac-address;
- description "backbone destination address";
- }
-
- leaf source-address {
- type yang:mac-address;
- description "backbone source address";
- }
-
- leaf outer-tag {
- type uint16;
- }
-
- leaf b-vlan-tag-vlan-id {
- type uint16 {
- //12 bit range
- range "1..4095";
- }
- description "backbone vlan id";
- }
-
- leaf i-tag-isid {
- type uint32 {
- //24 bit range
- range "1..16777215";
- }
- description "identifier of the backbone service instance ";
- }
-
- leaf interface-operation {
- type operation;
- default pop-2;
- description "Define operation that will pbb interface perform while processing packets";
- }
- }
-}
diff --git a/v3po/api/src/main/yang/v3po-context.yang b/v3po/api/src/main/yang/v3po-context.yang
deleted file mode 100644
index ae35be5dd..000000000
--- a/v3po/api/src/main/yang/v3po-context.yang
+++ /dev/null
@@ -1,29 +0,0 @@
-module v3po-context {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:v3po:context";
- prefix "v3po-ctx";
-
- revision "2016-09-09" {
- description
- "Initial revision of v3po specific context";
- }
-
- container disabled-interfaces {
- config false;
- // context data
-
- description "Index list of disabled interfaces. VPP does not always delete an interface after deletion. It just
- disables it and keeps it there. Honeycomb can hide such interfaces from operational data, and this
- is the place to heep track of which interfaces were deleted, but are expected to show up in VPP";
-
- list disabled-interface-index {
-
- key "index";
-
- leaf index {
- type int32;
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/v3po/api/src/main/yang/v3po.yang b/v3po/api/src/main/yang/v3po.yang
deleted file mode 100644
index 18b68620e..000000000
--- a/v3po/api/src/main/yang/v3po.yang
+++ /dev/null
@@ -1,716 +0,0 @@
-module v3po {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:v3po";
- prefix "v3po";
-
- revision "2016-12-14" {
- description
- "This revision adds the following new features:
- - ingress/egress ACLs support
- - moved ACL definitions to vpp-acl module
- - updated l2 container constraint (permit IP address on BVI interface)
- - added PID of vpp process to vpp-state
- - added support for Loopback interfaces";
- }
-
- revision "2015-01-05" {
- description "Initial revision of v3po model";
- }
-
- import iana-if-type {
- prefix "ianaift";
- }
- import ietf-interfaces {
- prefix "if";
- }
- import ietf-yang-types {
- prefix "yang";
- }
- import ietf-inet-types {
- prefix "inet";
- }
- import ietf-ip {
- prefix "ip";
- }
- import yang-ext {
- prefix "ext";
- }
- import vpp-acl {
- prefix "vpp-acl";
- }
-
- typedef bridge-domain-ref {
- type leafref {
- path "/vpp/bridge-domains/bridge-domain/name";
- }
- description
- "This type is used by to reference a bridge domain table";
- }
-
- typedef bridged-virtual-interface-ref {
- type leafref {
- path "/if:interfaces/if:interface/l2/bridged-virtual-interface";
- }
- description
- "This type is used by to reference a bridged virtual interface";
- }
-
- identity vxlan-tunnel {
- base if:interface-type;
- }
-
- identity gre-tunnel {
- base if:interface-type;
- }
-
- identity vhost-user {
- base if:interface-type;
- }
-
- identity tap {
- base if:interface-type;
- }
-
- identity loopback {
- base if:interface-type;
- }
-
- identity l2-fib-action {
- description "Base identity for l2-fib actions";
- }
-
- identity l2-fib-forward {
- base l2-fib-action;
- description
- "Forwards packet with configured mac address";
- }
-
- identity l2-fib-filter {
- base l2-fib-action;
- description
- "Drops packet with configured mac address";
- }
-
- typedef l2-fib-action {
- type identityref {
- base "l2-fib-action";
- }
- description "Identifies a specific L2 FIB action";
- }
-
- typedef vxlan-vni {
- // FIXME: should be in a vxlan-specific model
- description "VNI used in a VXLAN tunnel";
- type uint32 {
- range "0..16777215";
- }
- }
-
- typedef vhost-user-role {
- type enumeration {
- enum "server";
- enum "client";
- }
- }
-
- identity vxlan-gpe-tunnel {
- base if:interface-type;
- }
-
- typedef vxlan-gpe-vni {
- description "VNI used in a VXLAN-GPE tunnel";
- type uint32 {
- range "0..16777215";
- }
- }
-
- typedef vxlan-gpe-next-protocol {
- type enumeration {
- enum "ipv4" {
- value 1;
- }
- enum "ipv6" {
- value 2;
- }
- enum "ethernet" {
- value 3;
- }
- enum "nsh" {
- value 4;
- }
- }
- }
-
- grouping bridge-domain-attributes {
- leaf flood {
- type boolean;
- default true;
- description
- "Enable/disable L2 flooding.";
- }
- leaf forward {
- type boolean;
- default true;
- description
- "Enable/disable L2 forwarding.";
- }
- leaf learn {
- type boolean;
- default true;
- description
- "Enable/disable L2 learning.";
- }
- leaf unknown-unicast-flood {
- type boolean;
- default true;
- }
- leaf arp-termination {
- type boolean;
- default false;
- }
-
- container arp-termination-table {
- when "../v3po:arp-termination = 'true'";
-
- // TODO(HONEYCOMB-133): add support for read (after VPP-230 is done)
- list arp-termination-table-entry {
- key "ip-address phys-address";
- leaf ip-address {
- // FIXME: change to ip-address-no-zone after https://bugs.opendaylight.org/show_bug.cgi?id=6413 is resolved
- type inet:ip-address;
- }
- leaf phys-address {
- type yang:phys-address;
- }
- }
- }
- }
-
- // TODO express constraints for L2 FIB entries in YANG if possible
- grouping l2-fib-attributes {
- container l2-fib-table {
- list l2-fib-entry {
- key "phys-address";
-
- leaf phys-address {
- type yang:phys-address;
- }
-
- leaf outgoing-interface {
- type string;
- // mandatory true;
- // mandatory for forward action
- // FIXME VPP's CLI does not require to set iface id for filter action
- // VPP's binary api in constrast to CLI does some checks on the iface id value,
- // so currently it has to be set for all actions
- description
- "One of interfaces assigned to the FIB table's bridge-domain.";
- }
- leaf static-config {
- type boolean;
- default false;
- description
- "Static entries cannot be overridden by mac learning.";
- }
- leaf action {
- type l2-fib-action;
- mandatory true;
- description
- "L2 FIB action. For filter action, entry must be configured as static.";
- }
- leaf bridged-virtual-interface {
- when "../action = 'forward'";
- type boolean;
- config false; // FIXME setting bvi is currently not supported by VPP's binary api
- }
- }
- }
- }
-
- grouping tap-interface-base-attributes {
- leaf tap-name {
- type string{
- pattern "[a-zA-Z0-9\-;.+@$#^&*!_()=\[\]]*";
- }
- }
- }
-
- grouping tap-interface-config-attributes {
- leaf mac {
- type yang:phys-address;
- mandatory false;
- description "Mac address to be set for the tap interface. Random will be used if not configured";
- }
-
- leaf device-instance {
- type uint32;
- mandatory false;
- description "Custom device instance. Autogenerated will be used if not configured";
- }
- }
-
- grouping loopback-interface-base-attributes {
- leaf mac {
- type yang:phys-address;
- mandatory false;
- description "Mac address of the loopback interface";
- }
- }
-
- grouping ethernet-base-attributes {
- leaf mtu {
- type uint16 {
- range "64..9216";
- }
- units "octets";
- default 9216;
- description
- "The size, in octets, of the largest packet that the
- hardware interface will send and receive.";
- }
- }
-
- grouping ethernet-state-attributes {
- leaf manufacturer-description {
- type string;
- config false;
- }
- leaf duplex {
- type enumeration {
- enum "half";
- enum "full";
- }
- config false;
- }
- }
-
- grouping vhost-user-interface-base-attributes {
- leaf socket {
- type string {
- length 1..255;
- }
- }
- leaf role {
- type vhost-user-role;
- default "server";
- }
- description "vhost-user settings";
- }
-
- grouping vhost-user-interface-state-attributes {
- leaf features {
- type uint64;
- config false;
- }
- leaf virtio-net-hdr-size {
- type uint32;
- config false;
- }
- leaf num-memory-regions {
- type uint32;
- config false;
- }
- leaf connect-error {
- type string;
- config false;
- }
- }
-
- grouping vxlan-base-attributes {
- // FIXME: this should be in an vxlan-specific extension
- leaf src {
- /*mandatory true;*/
- type inet:ip-address;
- }
- leaf dst {
- /*mandatory true;*/
- type inet:ip-address;
- }
- leaf vni {
- /*mandatory true;*/
- type vxlan-vni;
- }
- leaf encap-vrf-id {
- type uint32;
- }
- }
-
- grouping gre-base-attributes {
- leaf src {
- /*mandatory true;*/
- type inet:ip-address;
- }
- leaf dst {
- /*mandatory true;*/
- type inet:ip-address;
- }
- leaf outer-fib-id {
- type uint32;
- }
- }
-
- grouping vxlan-gpe-base-attributes {
- leaf local {
- /*mandatory true;*/
- type inet:ip-address;
- }
- leaf remote {
- /*mandatory true;*/
- type inet:ip-address;
- }
- leaf vni {
- /*mandatory true;*/
- type vxlan-gpe-vni;
- }
- leaf next-protocol {
- type vxlan-gpe-next-protocol;
- }
- leaf encap-vrf-id {
- type uint32;
- }
- leaf decap-vrf-id {
- type uint32;
- }
- }
-
- grouping l2-base-attributes {
- description
- "Parameters for configuring Layer2 features on interfaces.";
-
- choice interconnection {
- case xconnect-based {
- leaf xconnect-outgoing-interface {
- /* Don't allow selection of this interface */
- must "../../if:name != current()";
- type if:interface-ref; // todo use interface-state-ref for operational data?
- description
- "L2 xconnect mode";
- }
- }
- case bridge-based {
- leaf bridge-domain {
- type bridge-domain-ref;
- mandatory true;
- description
- "Interfaces in a bridge-domain forward packets to other
- interfaces in the same bridge-domain based on
- destination mac address.";
- }
- leaf split-horizon-group {
- when "../bridge-domain";
- type uint8 {
- range "0..255";
- }
- default 0; //no split horizon group
- description
- "Interface's split-horizon group. Interfaces in the same
- bridge-domain and split-horizon group can not forward
- packets between each other. ";
- }
- leaf bridged-virtual-interface {
- when "../bridge-domain";
- type boolean;
- default false;
- description
- "Interface forward packets in the bridge-domain
- associated with the BVI.";
- }
- }
- }
- }
-
- grouping proxy-arp-attributes {
- description
- "Parameters for configuring Proxy ARP on interfaces.";
-
- leaf vrf-id {
- type uint32;
- default 0;
- }
- leaf low-addr {
- type inet:ipv4-address;
- }
- leaf high-addr {
- type inet:ipv4-address;
- }
- }
-
- augment /if:interfaces/if:interface {
- ext:augment-identifier "vpp-interface-augmentation";
-
- // FIXME using ietf-interfaces model for vpp interfaces makes it hard to implement because:
- // 1. The link between interface type and this augmentation is unclear
- // 2. Only this augmentation with combination of ifc type is trigger to do something for vpp, what if user only configures base interface stuff ? + We need to get leaves defined by ietf-interfaces when we are processing this augment
- // 3. The ietf-interfaces model does not define groupings which makes types reuse difficult
-
- container tap {
- when "../if:type = 'v3po:tap'";
- uses tap-interface-base-attributes;
- uses tap-interface-config-attributes;
- }
-
- container loopback {
- presence "Presence of this container indicates loopback nature of the interface";
- when "../if:type = 'v3po:loopback'";
- uses loopback-interface-base-attributes;
- }
-
- container ethernet {
- when "../if:type = 'ianaift:ethernetCsmacd'";
- uses ethernet-base-attributes;
- }
-
- container routing {
- // TODO (HONEYCOMB-127): add routing info for oper
- leaf ipv4-vrf-id {
- type uint32;
- }
- leaf ipv6-vrf-id {
- type uint32;
- }
- description
- "Defines VRF tables used for ipv4 and ipv6 traffic";
- }
-
- container vhost-user {
- when "../if:type = 'v3po:vhost-user'";
- uses vhost-user-interface-base-attributes;
- }
-
- container vxlan {
- when "../if:type = 'v3po:vxlan-tunnel'";
- uses vxlan-base-attributes;
- }
-
- container gre {
- when "../if:type = 'v3po:gre-tunnel'";
- uses gre-base-attributes;
- }
-
- container l2 {
- must "bridged-virtual-interface = 'true' or " +
- "(not (../if:ipv4[if:enabled = 'true']/if:address/if:ip) and " +
- "not (../if:ipv6[if:enabled = 'true']/if:address/if:ip))";
-
- uses l2-base-attributes;
- }
-
- container vxlan-gpe {
- when "../if:type = 'v3po:vxlan-gpe-tunnel'";
-
- uses vxlan-gpe-base-attributes;
- }
-
- container proxy-arp {
- uses proxy-arp-attributes;
- }
-
- container acl {
- container ingress {
- uses vpp-acl:acl-base-attributes;
- }
- container egress {
- uses vpp-acl:acl-base-attributes;
- }
- }
-
- container ietf-acl {
- container ingress {
- uses vpp-acl:ietf-acl-base-attributes;
- }
- container egress {
- uses vpp-acl:ietf-acl-base-attributes;
- }
- }
- }
-
- container vpp {
- description
- "VPP config data";
-
- container bridge-domains {
- list bridge-domain {
- key "name";
-
- leaf name {
- type string;
- }
-
- uses bridge-domain-attributes;
- uses l2-fib-attributes;
-
- description
- "bridge-domain configuration";
- }
- }
- }
-
- augment /if:interfaces-state/if:interface {
- ext:augment-identifier "vpp-interface-state-augmentation";
-
- leaf description {
- type string;
- }
-
- container tap {
- when "../if:type = 'v3po:tap'";
- uses tap-interface-base-attributes;
- }
-
- container ethernet {
- when "../if:type = 'ianaift:ethernetCsmacd'";
- uses ethernet-base-attributes;
- uses ethernet-state-attributes;
- }
-
- container vhost-user {
- when "../if:type = 'v3po:vhost-user'";
- uses vhost-user-interface-base-attributes;
- uses vhost-user-interface-state-attributes;
- }
-
- container vxlan {
- when "../if:type = 'v3po:vxlan-tunnel'";
- uses vxlan-base-attributes;
- }
- container vxlan-gpe {
- when "../if:type = 'v3po:vxlan-gpe-tunnel'";
-
- uses vxlan-gpe-base-attributes;
- }
-
- container gre {
- when "../if:type = 'gre-tunnel'";
- uses gre-base-attributes;
- }
-
- container l2 {
- must "bridged-virtual-interface = 'true' or " +
- "(not (../if:ipv4[if:enabled = 'true']/if:address/if:ip) and " +
- "not (../if:ipv6[if:enabled = 'true']/if:address/if:ip))";
-
- uses l2-base-attributes;
- }
-
- container proxy-arp {
- uses proxy-arp-attributes;
- }
-
- container acl {
- container ingress {
- uses vpp-acl:acl-base-attributes;
- }
- container egress {
- uses vpp-acl:acl-base-attributes;
- }
- }
-
- container ietf-acl {
- container ingress {
- uses vpp-acl:ietf-acl-base-attributes;
- }
- container egress {
- uses vpp-acl:ietf-acl-base-attributes;
- }
- }
- }
-
- augment /if:interfaces-state/if:interface/if:statistics {
- ext:augment-identifier "vpp-interface-statistics-augmentation";
- leaf in-errors-no-buf {
- type yang:counter64;
- }
- leaf in-errors-miss {
- type yang:counter64;
- }
- leaf out-discards-fifo-full {
- type yang:counter64;
- }
- }
-
- container vpp-state {
- config false;
-
- description
- "VPP operational data";
-
- container bridge-domains {
- // FIXME: Should this live in bridge-domain.yang in a modular fashion ?
- list bridge-domain {
-
- key "name";
- leaf name {
- type string;
- }
-
- uses bridge-domain-attributes;
- uses l2-fib-attributes;
-
- description
- "bridge-domain operational data";
- }
- }
-
- container version {
- leaf name {
- type string;
- }
- leaf build-directory {
- type string;
- }
- leaf build-date {
- type string;
- }
- leaf branch {
- type string;
- }
- leaf pid {
- type uint32;
- description
- "PID of the vpp process";
- }
- description
- "vlib version info";
- }
- }
-
- // VPP Notifications
-
- typedef interface-status {
- type enumeration {
- enum up {
- value 1;
- }
- enum down {
- value 0;
- }
- }
- }
-
- typedef interface-name-or-index {
- type union {
- type string;
- type uint32;
- }
- }
-
- notification interface-state-change {
- leaf name {
- type interface-name-or-index;
- }
-
- leaf admin-status {
- type interface-status;
- }
-
- leaf oper-status {
- type interface-status;
- }
- }
-
- notification interface-deleted {
- leaf name {
- type interface-name-or-index;
- }
- }
-}
diff --git a/v3po/api/src/main/yang/vpp-acl.yang b/v3po/api/src/main/yang/vpp-acl.yang
deleted file mode 100644
index f0c93f45e..000000000
--- a/v3po/api/src/main/yang/vpp-acl.yang
+++ /dev/null
@@ -1,160 +0,0 @@
-module vpp-acl {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:vpp:acl";
- prefix "vpp-acl";
-
- revision "2016-12-14" {
- description
- "Initial revision of vpp-acl model.";
- }
-
- import ietf-access-control-list {
- prefix "acl";
- }
-
- import vpp-classifier {
- prefix "vpp-classifier";
- }
-
- import yang-ext {
- prefix "ext";
- }
-
- import ietf-packet-fields {
- prefix packet-fields;
- }
-
- identity mixed-acl {
- base acl:acl-base;
- description
- "ACL that can match on any of L2/L3/L4 fields.";
- }
-
- typedef interface-mode {
- type enumeration {
- enum "l2";
- enum "l3";
- }
- }
-
- grouping acl-base-attributes {
- description
- "Defines references to classify tables.
- At least one table reference should be specified.";
- container l2-acl {
- leaf classify-table {
- type vpp-classifier:classify-table-ref;
- description
- "An L2 ACL table";
- }
- }
- container ip4-acl {
- leaf classify-table {
- type vpp-classifier:classify-table-ref;
- description
- "An IPv4 ACL table";
- }
- }
- container ip6-acl {
- leaf classify-table {
- type vpp-classifier:classify-table-ref;
- description
- "An IPv6 ACL table";
- }
- }
- }
-
- grouping ietf-acl-base-attributes {
- description
- "Provides limited support for ietf-acl model.";
-
- container access-lists {
- description
- "Defines references to ietf-acl lists.
- ACLs are translated into classify tables and sessions when assigned to interface.
-
- In case of L2 interfaces, acls are translated into a chain of classify tables and assigned as L2 table.
- In case of L3 interfaces, acls are translated into ip4 and ip6 chains (eth only rules go to both chains,
- rest - depending on ip-version).
- User ordering is preserved in both cases.
-
- Assignment update/delete removes all created tables and sessions and repeats process described above.
- Update/delete of ACL lists referenced here is not permitted (assignment needs to be removed first).
-
- Read is supported only for acls that were created and assigned by Honeycomb agent
- (corresponding metadata is present).
-
- Extensions:
- - mixing ACEs of different type in one list is permited
- - mixing L2/L3/L4 rules in one ACE is permited
-
- Limitations (due to vpp limitations):
- - egress rules are currently ignored (HONEYCOMB-234)
- - L4 rules support is limited (every <src,dst> port pair from provided ranges is translated to single classify
- session; which can very slow or even crash vpp if ranges are big, see HONEYCOMB-260)
- - ace-ip-version needs to be provided for all aces (consequence of posibility to mix ACEs of different types,
- and vpp classfier api limitation: common header fields for IP4/IP6 have different offsets)
- - L2 rules on L3 interfaces are applied only to IP traffic (vpp classfier limitation)
- - vlan tags are supported only for sub-interfaces defined as exact-match";
-
- list acl {
- key "type name";
- ordered-by user;
-
- leaf type {
- type acl:acl-type;
- }
-
- leaf name {
- type acl:access-control-list-ref;
- }
- }
-
- leaf default-action {
- type enumeration {
- enum "deny";
- enum "permit";
- }
- default "deny";
- description
- "Default action applied to packet that does not match any of rules defined in assigned ACLs.
- It is translated to single classify table and applied at the end of assigned chains.";
- }
-
- leaf mode {
- type interface-mode;
- default l3;
- description
- "The way ACLs are translated depends on the interface mode.
- In case of L2 interfaces (bridge/interconnection)
- classify tables are assigned as l2_table using input_acl_set_interface (ether type matching is automatically
- added in case of L3 rules).
- In case of L3 interfaces, classify tables are assigned as ip4/ip6 tables.
-
- It is the user responsibility to choose mode that matches target interface.
- ";
- }
- }
- }
-
- augment /acl:access-lists/acl:acl/acl:access-list-entries/acl:ace/acl:matches/acl:ace-type {
- ext:augment-identifier "vpp-acl-type-augmentation";
- case ace-ip-and-eth {
- description
- "Access List entry that can define both ip and eth rules.";
- choice ace-ip-version {
- description
- "IP version used in this Access List Entry.";
- mandatory true;
- case ace-ipv4 {
- uses packet-fields:acl-ipv4-header-fields;
- }
- case ace-ipv6 {
- uses packet-fields:acl-ipv6-header-fields;
- }
- }
- uses packet-fields:acl-ip-header-fields;
- uses packet-fields:acl-eth-header-fields;
- }
- }
-} \ No newline at end of file
diff --git a/v3po/api/src/main/yang/vpp-classifier-context.yang b/v3po/api/src/main/yang/vpp-classifier-context.yang
deleted file mode 100644
index 01eae862d..000000000
--- a/v3po/api/src/main/yang/vpp-classifier-context.yang
+++ /dev/null
@@ -1,68 +0,0 @@
-module vpp-classifier-context {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:vpp:classifier";
- prefix "vpp-classifier-context";
-
- description
- "This module contains vpp classfier metadata definition";
-
- revision "2016-09-09" {
- description
- "Initial revision.";
- }
-
- container vpp-classifier-context {
-
- config "false";
-
- description
- "Classify tables and sessions contain relative node indexes. Management agent like Honeycomb,
- needs to use node names instead (indexes might change after vpp restart).
- VPP does not provide relative index to node name conversion (https://jira.fd.io/browse/VPP-219),
- also finding base node that is needed to perform the conversion
- is not allways possible (https://jira.fd.io/browse/VPP-220).
-
- Therefore Honeycomb needs to provide relative node to index mapping.
- ";
-
- list classify-table-context {
- key "name";
- unique "index";
-
- leaf name {
- type string;
- description
- "Name of the classify table.";
- }
-
- leaf index {
- type int32;
- description
- "Classify table index used by VPP.";
- }
-
- leaf classifier-node-name {
- type string;
- description
- "Name of VPP node the table is defined for.";
- }
-
- list node-context {
- key "name";
- unique "index";
-
- leaf name {
- type string;
- description
- "Name of vpp node (neighbour of classifier-node-name)";
- }
-
- leaf index {
- type int32;
- description
- "Inted of the vpp node relative to classifier-node-name";
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/v3po/api/src/main/yang/vpp-classifier.yang b/v3po/api/src/main/yang/vpp-classifier.yang
deleted file mode 100644
index ea2788289..000000000
--- a/v3po/api/src/main/yang/vpp-classifier.yang
+++ /dev/null
@@ -1,215 +0,0 @@
-module vpp-classifier {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:vpp:classifier";
- prefix "vpp-classifier";
-
- revision "2016-12-14" {
- description
- "This revision adds the following new features:
- - updates order of union types for opaque-index";
- }
-
- revision "2015-06-03" {
- description
- "Initial revision of model for VPP packet classifier.
- The model can be used ony to implement ACLs.
- Other classify table usages are not supported yet,
- see https://jira.fd.io/browse/VPP-203 for details.";
- reference
- "https://wiki.fd.io/view/VPP/Introduction_To_N-tuple_Classifiers";
- }
-
- import ietf-yang-types {
- prefix "yang";
- }
-
- typedef classify-table-ref {
- type leafref {
- path "/vpp-classifier:vpp-classifier/classify-table/name";
- }
- description
- "This type is used by data models that need to reference
- configured classify tables.";
- }
-
- typedef packet-handling-action {
- type enumeration {
- enum "deny" {
- // by VPP convention, first neighbour node (at index 0) is a drop node
- value 0;
- }
- enum "permit" {
- value -1; // indicates that the next node not set
- }
- }
- }
-
- typedef vpp-node-name {
- type string;
- }
-
- typedef vpp-node {
- type union {
- type packet-handling-action;
- type vpp-node-name;
- }
- description
- "Defines VPP node reference using packet handling action or relative node name
- (if definition in terms of packet handling action is not possible).";
- }
-
- typedef opaque-index {
- type union {
- type uint32;
- type vpp-node;
- }
- description
- "Defines opaque-index type - metadata that can be attached to session-hit packets.
- Vpp nodes can't be referenced by index, because node indexes might change after vpp restart.";
- }
-
- grouping classify-session-attributes {
- description
- "Defines classify session attributes that are mapped to classify_add_del_session
- and classify_session_details messages parameters.";
-
- leaf hit_next {
- type vpp-node;
- mandatory true;
- description
- "Vpp node to which packet will be send when it produces a match.";
- }
- leaf opaque_index {
- type opaque-index;
- }
- leaf advance {
- type int32;
- default 0;
- description
- "Nodes like ip4/6-classify use the parameter to \"consume\" networking layer.
- Example: tunnel decapsulation.";
- }
- }
-
- grouping classify-table-base-attributes {
- description
- "Defines classify table attributes that are mapped to classify_add_del_table message parameters.";
-
- leaf classifier-node {
- type vpp-node-name;
- description
- "Name of VPP node the table is defined for.";
- }
- leaf nbuckets {
- mandatory true;
- type uint32;
- description
- "Used by classifier hashing algorithm. It is not possible to resize the bucket array,
- therefore suggested value is approximate number of expected entries.";
- }
- leaf skip_n_vectors {
- type uint32;
- default 0;
- description
- "Number of 16 byte vectors to be skipped before applying mask.";
- }
- leaf next_table {
- type classify-table-ref;
- description
- "Reference to the next classify table. Required when multiple table chaining is used.";
- }
- leaf miss_next {
- mandatory true;
- type vpp-node;
- description
- "Vpp node to which packet will be send when it falis to produce a match";
- }
- leaf mask {
- type yang:hex-string;
- mandatory true;
- description
- "Defines match mask (multiple of 16 bytes)";
- }
-
- list classify-session {
- key "match";
-
- leaf match {
- type yang:hex-string;
- description
- "Defines actual value to be matched that is
- a byte vector, which length is multiple of 16 bytes";
-
- must "string-length(match) = string-length(../../mask)" {
- error-message
- "Match length is not equal to classify table mask length.";
- description
- "Match length must be equal to classify table mask length.";
- }
- }
-
- uses classify-session-attributes;
- }
- }
-
- grouping classify-table-config-attributes {
- description
- "Defines classify table config only attributes (present in classify_add_del_table message
- but not in classify_table_info_reply).";
-
- // FIXME move to classify-table-base-attributes
- // after https://jira.fd.io/browse/VPP-208 is fixed
- leaf memory_size {
- type uint32;
- mandatory true;
- description
- "Memory size for classify table and its entries.";
- }
- }
-
- grouping classify-table-operational-attributes {
- description
- "Defines classify table operational attributes (present in classify_table_info_reply message
- but not in classify_add_del_table).";
-
- leaf active_sessions {
- type uint32;
- config false;
- description
- "Number of sessions defined for the classify table.";
- }
- }
-
- container vpp-classifier {
- list classify-table {
- key "name";
-
- leaf name {
- type string;
- description
- "Hides classify table identifier managed by vpp.";
- }
-
- uses classify-table-base-attributes;
- uses classify-table-config-attributes;
- }
- }
-
- container vpp-classifier-state {
- config false;
-
- list classify-table {
- key "name";
-
- leaf name {
- type string;
- description
- "Hides classify table identifier managed by vpp.";
- }
-
- uses classify-table-base-attributes;
- uses classify-table-operational-attributes;
- }
- }
-
-}
diff --git a/v3po/api/src/main/yang/vpp-pbb.yang b/v3po/api/src/main/yang/vpp-pbb.yang
deleted file mode 100644
index d3ca160ce..000000000
--- a/v3po/api/src/main/yang/vpp-pbb.yang
+++ /dev/null
@@ -1,32 +0,0 @@
-module vpp-pbb {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:vpp-pbb";
- prefix "vpp-pbb";
-
- revision "2016-12-14" {
- description "Initial revision of pbb model";
- }
-
- import pbb-types {
- prefix "pbb-types";
- }
-
- import yang-ext {
- prefix "ext";
- }
-
- augment /if:interfaces/if:interface {
- ext:augment-identifier "pbb-rewrite-interface-augmentation";
- container pbb-rewrite{
- uses pbb-types:pbb-rewrite-attributes;
- }
- }
-
- augment /if:interfaces-state/if:interface {
- ext:augment-identifier "pbb-rewrite-state-interface-augmentation";
- container pbb-rewrite-state{
- uses pbb-types:pbb-rewrite-attributes;
- config false;
- }
- }
-} \ No newline at end of file
diff --git a/v3po/api/src/main/yang/vpp-vlan.yang b/v3po/api/src/main/yang/vpp-vlan.yang
deleted file mode 100644
index cd3d320ee..000000000
--- a/v3po/api/src/main/yang/vpp-vlan.yang
+++ /dev/null
@@ -1,443 +0,0 @@
-module vpp-vlan {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:vpp:vlan";
- prefix "vpp-vlan";
-
- revision "2016-12-14" {
- description
- "This revision adds the following new features:
- - ingress/egress ACLs support";
- }
-
- revision "2015-05-27" {
- description
- "Initial revision of vlan model for VPP.
- Reuses some concepts from draft-wilton-netmod-intf-vlan-yang-02 model.";
- }
-
- import ietf-interfaces {
- prefix "if";
- }
- import ietf-inet-types {
- prefix inet;
- }
- import ietf-yang-types {
- prefix "yang";
- }
- import yang-ext {
- prefix "ext";
- }
- import dot1q-types {
- prefix dot1q;
- }
- import v3po {
- prefix v3po;
- }
- import vpp-acl {
- prefix vpp-acl;
- }
-
- typedef sub-interface-status {
- type enumeration {
- enum "up";
- enum "down";
- }
- }
-
- // todo add 802dot1ad support to dot1q-types.yang
- /*
- * Defines the supported IEEE 802.1Q types that can be used for
- * VLAN tag matching.
- */
- identity vlan-type {
- description "Base identity from which all VLAN types
- are derived from";
- }
-
- identity 802dot1q {
- base vlan-type;
- description
- "An 802.1Q VLAN type";
- }
-
- identity 802dot1ad {
- base vlan-type;
- description
- "An 802.1ad VLAN type";
- }
-
- typedef vlan-type {
- type identityref {
- base "vlan-type";
- }
- description "Identifies a specific VLAN type";
- }
-
- grouping match-attributes {
- choice match-type {
- mandatory true;
- description "Provides a choice of how the frames may be matched";
-
- case default {
- description "Default match";
- leaf default {
- type empty;
- description
- "Default match. Matches all traffic not matched to any
- other peer sub-interface by a more specific
- encapsulation.";
- } // leaf default
- } // case default
-
- case untagged {
- description "Match untagged Ethernet frames only";
- leaf untagged {
- type empty;
- description
- "Untagged match. Matches all untagged traffic.";
- } // leaf untagged
- } // case untagged
-
- case vlan-tagged {
- container vlan-tagged {
- description "Matches VLAN tagged frames. Vlan tags need to be specified to use this match type";
-
- leaf match-exact-tags {
- type boolean;
- default true;
- description
- "If set, indicates that all 802.1Q VLAN tags in the
- Ethernet frame header must be explicitly matched, i.e.
- the EtherType following the matched tags must not be a
- 802.1Q tag EtherType. If unset then extra 802.1Q VLAN
- tags are allowed.";
- }
- } // container vlan-tagged
- } // case vlan-tagged
- }
- }
-
- // TODO VPP does not allow to change subinterface nor delete it (except for tag-rewrite operation)
- grouping sub-interface-base-attributes {
- leaf vlan-type {
- type vlan-type;
- default 802dot1q;
- }
-
- container tags {
- list tag {
- key "index";
- max-elements 2;
-
- description "The VLAN tags to use by locally sourced traffic";
-
- leaf index {
- type uint8 {
- range "0..1";
- }
-
- /*
- * Only allow a push of an inner tag if an outer tag is also
- * being pushed.
- */
- must "index != 0 or
- count(../../push-tags[index = 0]/index) > 0" {
- error-message "An inner tag can only be pushed if an outer
- tag is also specified";
- description "Only allow a push of an inner tag if an outer
- tag is also being pushed";
- }
- description "The index into the tag stack";
- }
-
- uses dot1q:dot1q-tag-or-any;
-
- }
- }
-
- container match {
- description
- "The match used to classify frames to this interface";
- uses match-attributes;
- }
-
- container l2 {
- uses v3po:l2-base-attributes;
- container rewrite {
- uses tag-rewrite;
- }
- }
-
- container acl {
- container ingress {
- uses vpp-acl:acl-base-attributes;
- }
- container egress {
- uses vpp-acl:acl-base-attributes;
- }
- }
-
- container ietf-acl {
- container ingress {
- uses vpp-acl:ietf-acl-base-attributes;
- }
- container egress {
- uses vpp-acl:ietf-acl-base-attributes;
- }
- }
- }
-
- grouping sub-interface-config-attributes {
- leaf enabled {
- type boolean;
- default "false";
- description
- "Contains the configured, desired state of the sub-interface.
- To enable sub-interface, the super inerface needs to be enabled";
- }
- }
-
- grouping sub-interface-operational-attributes {
- leaf admin-status {
- type sub-interface-status;
- mandatory true;
- }
- leaf oper-status {
- type sub-interface-status;
- mandatory true;
- }
- leaf if-index {
- type int32 {
- range "1..2147483647";
- }
- mandatory true;
- }
- leaf phys-address {
- type yang:phys-address;
- description
- "The sub-interface's Media Access Control (MAC) address.";
- }
- leaf speed {
- type yang:gauge64;
- units "bits/second";
- }
- }
-
- /*
- * Only symetrical rewrite is supported
- */
- grouping tag-rewrite {
- description "Flexible rewrite";
-
- leaf vlan-type { // todo rename to push_dot1q, mandatory(?) with default true
- type vlan-type;
- default 802dot1q;
- }
-
- leaf pop-tags {
- type uint8 {
- range 1..2;
- }
- description "The number of tags to pop (or translate if used in
- conjunction with push-tags)";
- }
-
- list push-tags {
- key "index";
- max-elements 2;
- description "The number of tags to push (or translate if used
- in conjunction with pop-tags)";
- /*
- * Server should order by increasing index.
- */
- leaf index {
- type uint8 {
- range 0..1;
- }
-
- /*
- * Only allow a push of an inner tag if an outer tag is also
- * being pushed.
- */
- must "index != 0 or
- count(../../push-tags[index = 0]/index) > 0" {
- error-message "An inner tag can only be pushed if an outer
- tag is also specified";
- description "Only allow a push of an inner tag if an outer
- tag is also being pushed";
- }
- }
-
- uses dot1q:dot1q-tag;
- }
- }
-
- grouping sub-interface-ip4-attributes {
- container ipv4 {
- // TODO: add currently unsupported:
- // enabled, forwarding, mtu, address/origin(config false), neighbor/origin(config false)
-
- // TODO: reuse groupings once ietf-ip provides them
-
- description
- "Parameters for the IPv4 address family (based on ietf-ip rev. 2014-06-16)";
-
- list address {
- key "ip";
- description
- "The list of configured IPv4 addresses on the interface.";
- leaf ip {
- type inet:ipv4-address-no-zone;
- description
- "The IPv4 address on the interface.";
- }
-
- choice subnet {
- mandatory true;
- description
- "The subnet can be specified as a prefix-length, or,
- if the server supports non-contiguous netmasks, as
- a netmask.";
- leaf prefix-length {
- type uint8 {
- range "0..32";
- }
- description
- "The length of the subnet prefix.";
- }
- leaf netmask {
- type yang:dotted-quad;
- description
- "The subnet specified as a netmask (contiguous)";
- }
- } // choice subnet
- } // list address
-
- list neighbor {
- key "ip";
- description
- "A list of mappings from IPv4 addresses to
- link-layer addresses.
-
- Entries in this list are used as static entries in the
- ARP Cache.";
- reference
- "RFC 826: An Ethernet Address Resolution Protocol";
-
- leaf ip {
- type inet:ipv4-address-no-zone;
- description
- "The IPv4 address of the neighbor node.";
- }
-
- leaf link-layer-address {
- type yang:phys-address;
- mandatory true;
- description
- "The link-layer address of the neighbor node.";
- }
- } // list neighbor
- }
- }
-
- grouping sub-interface-ip6-attributes {
- container ipv6 {
- // TODO: add currently unsupported:
- // enabled, forwarding, mtu, neighbor, dup-addr-detect-transmits, autoconf,
- // address(config false): origin, status
- // neighbor(config false): origin, is-router, state
-
- // TODO: reuse groupings once ietf-ip provides them
-
- description
- "Parameters for the IPv6 address family (based on ietf-ip rev. 2014-06-16)";
-
- list address {
- key "ip";
- description
- "The list of configured IPv6 addresses on the interface.";
- leaf ip {
- type inet:ipv6-address-no-zone;
- description
- "The IPv6 address on the interface.";
- }
-
- leaf prefix-length {
- type uint8 {
- range "0..128";
- }
- mandatory true;
- description
- "The length of the subnet prefix.";
- }
- } // list address
-
- list neighbor {
- key "ip";
- description
- "A list of mappings from IPv6 addresses to
- link-layer addresses.
-
- Entries in this list are used as static entries in the
- Neighbor Cache.";
- reference
- "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)";
-
- leaf ip {
- type inet:ipv6-address-no-zone;
- description
- "The IPv6 address of the neighbor node.";
- }
-
- leaf link-layer-address {
- type yang:phys-address;
- mandatory true;
- description
- "The link-layer address of the neighbor node.";
- }
- } // list neighbor
- }
- }
-
- augment /if:interfaces/if:interface {
- ext:augment-identifier "subinterface-augmentation";
-
- container sub-interfaces {
- description "L2 vlan subinterfaces";
-
-
- list sub-interface {
- key "identifier";
- leaf identifier {
- type uint32;
- }
-
- uses sub-interface-base-attributes;
- uses sub-interface-config-attributes;
- uses sub-interface-ip4-attributes;
- uses sub-interface-ip6-attributes;
- }
- }
- }
-
- augment /if:interfaces-state/if:interface {
- ext:augment-identifier "subinterface-state-augmentation";
-
- container sub-interfaces {
- description "L2 vlan subinterfaces";
-
- list sub-interface {
- key "identifier";
- leaf identifier {
- type uint32;
- }
-
- uses sub-interface-base-attributes;
- uses sub-interface-operational-attributes;
- uses sub-interface-ip4-attributes;
- uses sub-interface-ip6-attributes;
- }
- }
- }
-
-}
diff --git a/v3po/asciidoc/Readme.adoc b/v3po/asciidoc/Readme.adoc
deleted file mode 100644
index 96d1d5a9b..000000000
--- a/v3po/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,7 +0,0 @@
-= V3po
-
-This is a Honeycomb plugin providing mapping code between HC and VPP core APIs.
-
-== Usage
-
-Refer to postman_rest_collection.json for sample requests. All capabilities of V3po are demo-ed there \ No newline at end of file
diff --git a/v3po/pom.xml b/v3po/pom.xml
deleted file mode 100644
index 83df160ad..000000000
--- a/v3po/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>honeycomb-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../common/honeycomb-parent</relativePath>
- </parent>
-
- <groupId>io.fd.honeycomb.v3po</groupId>
- <artifactId>v3po-aggregator</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <name>${project.artifactId}</name>
- <packaging>pom</packaging>
- <modelVersion>4.0.0</modelVersion>
- <description>Aggregator for Honeycomb V3PO(VPP core APIs) plugin</description>
-
- <modules>
- <module>api</module>
- <module>v3po2vpp</module>
- </modules>
- <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/v3po/postman_rest_collection.json b/v3po/postman_rest_collection.json
deleted file mode 100644
index 79c7d41b4..000000000
--- a/v3po/postman_rest_collection.json
+++ /dev/null
@@ -1,2065 +0,0 @@
-{
- "id": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "name": "Honeycomb V3PO RESTCONF calls",
- "description": "Common mgmt operations on VPP core using Honeycomb REST interface",
- "order": [
- "9362a506-1e6f-38eb-b7a9-e1bec3fc2177",
- "11ae838d-68f0-8755-6b8b-16466512a1bf",
- "8f5860a3-ac28-811b-3830-52df067c1a60",
- "4166392e-d64c-34b9-1117-cbd36974fa7e",
- "7b592c36-12a3-2867-ed71-80ec74695dec",
- "4a8f8191-91ce-d65c-58c9-206204603a3e",
- "2a3a5de9-ed06-6468-2c11-ddbdc4ec1224"
- ],
- "folders": [
- {
- "id": "d47d6b3b-4c3f-7671-5bba-447d6c59ea3b",
- "name": "ACL",
- "description": "",
- "order": [
- "e59e4c3d-e2d9-7124-3d94-6fe77b88e8ec",
- "e332c510-7523-f788-3670-dc801b10d391",
- "9b3cbedf-15b4-fee0-6424-b32bc4781ca3",
- "ed295c83-ac16-df21-9ac5-7176369736d9",
- "2d25db9f-6c65-5fe0-1602-5484c058bd1b",
- "e1bd94dd-ed59-9a39-9997-916c4f9a207e",
- "c4923db5-50eb-0106-10fc-3f1361593d2a",
- "24ac98f0-1556-e623-ec87-1c2d7f4f089c",
- "2796296f-2c09-7c3e-4cd9-9a366c1cb61c",
- "5b0d301e-c2d1-5179-41eb-d1fb07cc93f0",
- "aa1f621e-4ae7-f266-e85f-ec3797c3552a",
- "a78cecbf-1b20-3051-af3e-213c947c94ac"
- ],
- "owner": "45557",
- "collectionId": "e9ba4e80-fb4d-1eae-07e7-97b323164130"
- },
- {
- "id": "f59ae95c-b691-1283-8b2b-539a00da0178",
- "name": "Loopback",
- "description": "",
- "order": [
- "3090675a-fb54-3cc8-71d7-0675b7b79eb8",
- "9306bff2-f310-986e-44cf-7845ba82b980"
- ],
- "owner": "45557",
- "collectionId": "e9ba4e80-fb4d-1eae-07e7-97b323164130"
- },
- {
- "id": "e742a44e-2e82-fe0c-d7c1-2f6b6bc1f0e9",
- "name": "Bridge Domain management",
- "description": "",
- "order": [
- "4d59da85-1853-8854-6eb6-36d13821cc14",
- "63fa7145-b1df-0d48-f38b-27c11cb3a5f6",
- "ca295d02-4940-e584-e446-64a79ce733f9",
- "a68945f7-ee2d-e352-1bb9-1511757c21b2",
- "b31e6fc8-2cf3-92e3-3ac9-e9d244b6eb16",
- "38df5f70-c849-dd0d-401b-e1fcd5df539e",
- "5eabbac5-77fc-a886-7070-ba7dfb735301",
- "44df5e99-524f-ae01-0d60-54257fd16ad5",
- "ce66b067-e7de-224b-6e46-41a4a4e2305c",
- "c6272b59-2200-d334-0abc-6e13deb0dedd",
- "1bd21e57-376e-a8e4-14b2-97598824abbb",
- "a47fb37c-a45d-078c-9842-396b80195aaf",
- "9ed8e7a8-8f38-a68c-bdb0-58f0743a55a0"
- ],
- "owner": "45557",
- "collectionId": "e9ba4e80-fb4d-1eae-07e7-97b323164130"
- },
- {
- "id": "f5bf94b3-feb4-1db7-6caa-f52d37b8977e",
- "name": "Context",
- "description": "",
- "order": [
- "3e8c8e6b-234c-0910-de47-302adb6bc19e",
- "32ef9c3f-94e5-6c15-fbc5-0816806d8f25",
- "ad06e7aa-527e-7b8d-fff1-d000de301eca"
- ],
- "owner": "45557"
- },
- {
- "id": "2e489b42-8432-15f1-f4bc-859c34a3c570",
- "name": "GRE-TUNNEL",
- "description": "",
- "order": [
- "ac8d2039-0036-4764-1437-7e08f4a52527",
- "f42817ab-a13f-b9ec-50aa-ed037c6b03be"
- ],
- "owner": "45557"
- },
- {
- "id": "83c684bd-069d-f6b1-faea-7a37444d9ff9",
- "name": "PBB",
- "description": "",
- "order": [
- "4fd61184-7a23-f84a-6734-b2c96d10c908",
- "d9d05fb3-c16f-12ba-7ed3-52f2c8bfe55b",
- "c7950d6b-6817-36f2-570c-602e77863df6",
- "2fac9933-a6fb-cf6a-fb42-878b77412519"
- ],
- "owner": "45557"
- },
- {
- "id": "c05d7211-11b0-5688-2079-afa51196045c",
- "name": "IETF ACL",
- "description": "Provides example requests for ietf-access-control-list management",
- "order": [
- "ea9e0f3b-ede6-2104-892b-bb8fd72e3d5d",
- "fe6a8289-d2dc-e671-2490-5546d223f47f",
- "5e93fbca-86d0-12a5-45fd-45d7dfa3bd40",
- "5140ac58-342a-1576-8b0e-99eb8b3b1fb2",
- "9f58c827-d698-fc60-ec49-c2ccbca97c35",
- "93b5345a-434f-9459-26c2-dc2cad9176e0",
- "4d3d06fe-8a64-d0e4-400a-79c4fbd6db73",
- "33280f11-2d61-09d3-f726-9907ef00dc19",
- "60d4ab79-dea1-de5a-63eb-6e26d3d1481b",
- "d668c31c-b904-cd65-124c-dd2a89149b70",
- "13b938a5-7a53-513f-44b9-33d869b8cb53",
- "bca26b70-fe05-a1b4-f93a-1f683341d492",
- "4442a2fd-497d-ee8d-22cd-43b72c358f67",
- "161987f9-8912-f724-2f2d-d7548b12e8f9"
- ],
- "owner": "45557",
- "collectionId": "e9ba4e80-fb4d-1eae-07e7-97b323164130"
- },
- {
- "id": "0ef5f1df-d43a-17fe-b006-249f83c88552",
- "name": "IP",
- "description": "",
- "order": [
- "01b66809-89cd-6f73-013b-010ae25eddee",
- "054c34a2-75b2-fc67-e1a2-5fb285de6daa",
- "02ac3ff2-3ae2-d5c0-60d6-9ad533427ee7",
- "ca164bb4-73ab-a692-e74b-b7c526b2a1b6",
- "ba60c6cb-bb5f-2d45-66c1-a4382d348b9b",
- "ae996349-eec7-2ac4-9fde-1ec9fc63cd3f",
- "65e4713c-3977-7b96-9b46-198a9fe3a592",
- "4afe77aa-43c0-29ba-c910-4cbbea95ee07",
- "3357ff20-66dd-9f5a-7b70-dfe57c6e2e57",
- "67e79c2e-77b7-8000-de1f-10f2136cd718"
- ],
- "owner": "45557"
- },
- {
- "id": "42603a84-8d76-77de-197f-19387eb13c97",
- "name": "Proxy Arp",
- "description": "",
- "order": [
- "4546a02f-733b-4b69-54e9-5943293b3f95",
- "10f9a053-4e29-7f2c-312c-9b6b796856e9"
- ],
- "owner": "45557"
- },
- {
- "id": "ebed4cf3-96db-7ea3-1216-a0802c8f47d3",
- "name": "TAP",
- "description": "",
- "order": [
- "5f4e6007-2144-0555-7567-f093b64acec9",
- "24fdd76e-e90b-d552-c0d1-87a745a5ac6f",
- "fc8daee5-81f4-ef32-9d05-a2a5a24b3d8e",
- "0353bf57-b9af-c037-93da-d4ae05b55eeb"
- ],
- "owner": "45557"
- },
- {
- "id": "015dc7da-a47b-fcdf-3dee-2760fb5de9fd",
- "name": "VHOST",
- "description": "",
- "order": [
- "7704eaea-3eb6-2a08-04f0-07c124c3a9ca",
- "218a3ee0-7ef3-adf1-088c-62a1a3e3c2a7",
- "6cc318f9-94ec-b0c0-a3f9-69b085613f59"
- ],
- "owner": "45557"
- },
- {
- "id": "1ea15402-cdce-9573-f746-fc9256e18e53",
- "name": "VLAN",
- "description": "",
- "order": [
- "62f0370e-cdbb-c29d-3ea4-6ad08d4ceb08",
- "10ffdfa8-97bf-9d9f-e057-d18bd22291ea",
- "d265bf51-6e6d-7087-5b55-b6afde56c325",
- "f71aac57-d1b8-0ece-7e2c-47b94ee0ffe0",
- "3e4f9840-88db-c795-3244-6421da9ca4b3",
- "e3dab7db-c96e-1462-ff59-2c69471fa5f3",
- "4d7faf60-953a-b796-887d-b1c0a46d3904",
- "488acc8a-0816-d280-8c9d-bc1326edea9b"
- ],
- "owner": "45557",
- "collectionId": "e9ba4e80-fb4d-1eae-07e7-97b323164130"
- },
- {
- "id": "ded16b18-1c4c-e349-6190-7a5e30813494",
- "name": "VXLAN-GPE-TUNNEL",
- "description": "",
- "order": [
- "10de9ebb-db91-b664-adfa-e4b347c2ce79",
- "3ec74eb9-1f3b-ac73-094b-a374377a4b3e"
- ],
- "owner": "45557"
- },
- {
- "id": "f15540bc-415f-0ce0-4c25-5a5406d11242",
- "name": "VXLAN-TUNNEL",
- "description": "",
- "order": [
- "4d9995b2-2698-7aaa-9c63-3db639f682fe",
- "3d8b0d2e-80ad-33ad-d8aa-53f237006750"
- ],
- "owner": "45557"
- }
- ],
- "timestamp": 1460119141419,
- "owner": "45557",
- "public": false,
- "published": false,
- "requests": [
- {
- "id": "3090675a-fb54-3cc8-71d7-0675b7b79eb8",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/loop1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1478080135790,
- "name": "Add loopback ifc - cfg ",
- "description": "create loop interface",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"loop1\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:loopback\",\r\n \"loopback\" :{\r\n \"mac\" : \"00:ff:ff:ff:ff:ff\"\r\n }\r\n }\r\n ]\r\n \r\n}"
- },
- {
- "id": "9306bff2-f310-986e-44cf-7845ba82b980",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/loop1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1478085084456,
- "name": "Delete loopback ifc - cfg ",
- "description": "delete loop interface intfc loop1",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": ""
- },
- {
- "id": "4fd61184-7a23-f84a-6734-b2c96d10c908",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1475833537946,
- "name": "Enable local0 + configure Pbb",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "83c684bd-069d-f6b1-faea-7a37444d9ff9",
- "rawModeData": "{\r\n \"interface\": [\r\n {\r\n \"name\": \"local0\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"pbb-rewrite\":{\r\n \t\"destination-address\":\"aa:aa:aa:aa:aa:aa\",\r\n \t\"source-address\":\"bb:bb:bb:bb:bb:bb\",\r\n \t\"b-vlan-tag-vlan-id\":\"26\",\r\n \t\"i-tag-isid\":\"27\",\r\n \t\"interface-operation\":\"pop-2\"\r\n }\r\n }\r\n ]\r\n}"
- },
- {
- "id": "c7950d6b-6817-36f2-570c-602e77863df6",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1475835569895,
- "name": "Get ppb rewrite",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "83c684bd-069d-f6b1-faea-7a37444d9ff9",
- "rawModeData": "{\r\n \"interface\": [\r\n {\r\n \"name\": \"local0\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"pbb-rewrite\":{\r\n \t\"destination-address\":\"aa:aa:aa:aa:aa:aa\",\r\n \t\"source-address\":\"bb:bb:bb:bb:bb:bb\",\r\n \t\"b-vlan-tag-vlan-id\":\"26\",\r\n \t\"i-tag-isid\":\"27\",\r\n \t\"interface-operation\":\"translate-2-1\"\r\n }\r\n }\r\n ]\r\n}"
- },
- {
- "id": "d9d05fb3-c16f-12ba-7ed3-52f2c8bfe55b",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/pbb-rewrite",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1475833755406,
- "name": "Update ppb rewrite",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "83c684bd-069d-f6b1-faea-7a37444d9ff9",
- "rawModeData": "{\r\n \"pbb-rewrite\":{\r\n \t\"destination-address\":\"aa:aa:aa:aa:aa:aa\",\r\n \t\"source-address\":\"bb:bb:bb:bb:bb:bb\",\r\n \t\"b-vlan-tag-vlan-id\":\"26\",\r\n \t\"i-tag-isid\":\"27\",\r\n \t\"interface-operation\":\"translate-2-1\"\r\n }\r\n}"
- },
- {
- "id": "2fac9933-a6fb-cf6a-fb42-878b77412519",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1475833694739,
- "name": "Disable ppb rewrite",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "83c684bd-069d-f6b1-faea-7a37444d9ff9",
- "rawModeData": ""
- },
-
-
- {
- "id": "01b66809-89cd-6f73-013b-010ae25eddee",
- "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F8%2F0/ipv4/neighbor/172.16.0.2",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1466498440466,
- "name": "Ip Neighbour Get",
- "description": "This call returns data stored in honeycomb,to verify actual data stored by vpp, call vppctl show ip fib|arp",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\n \n \"interface\":{\n \"name\":\"GigabitEthernet0/8/0\",\n \"type\": \"iana-if-type:ethernetCsmacd\",\n \"enabled\":\"true\",\n \"ipv4\":{\n \"neighbor\":{\n \"ip\":\"172.16.0.2\",\n \"link-layer-address\":\"00:01:11:00:02:02\"\n }\n }\n }\n}\n",
- "folder": "0ef5f1df-d43a-17fe-b006-249f83c88552"
- },
- {
- "id": "02ac3ff2-3ae2-d5c0-60d6-9ad533427ee7",
- "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F8%2F0/ipv4/neighbor/172.16.0.2",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1466498502212,
- "name": "Ip Neighbour Delete",
- "description": "Verify this call by invoking vppctl show ip fib|arp",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\n \"neighbor\":{\n \"ip\":\"172.16.0.2\",\n \"link-layer-address\":\"00:01:11:00:02:02\"\n }\n}\n",
- "folder": "0ef5f1df-d43a-17fe-b006-249f83c88552"
- },
- {
- "id": "0353bf57-b9af-c037-93da-d4ae05b55eeb",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/tapp2",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1462796994090,
- "name": "Delete complex tap ifc - cfg",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "",
- "folder": "ebed4cf3-96db-7ea3-1216-a0802c8f47d3"
- },
- {
- "id": "054c34a2-75b2-fc67-e1a2-5fb285de6daa",
- "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F8%2F0/ipv4/neighbor/172.16.0.2",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1466498409820,
- "name": "Ip Neighbour Add",
- "description": "This call doesnt have respective dump call,because of performance issues(dump for this can contain millions of entries). Data inserted throught this call can be verified by calling vppctl show ip fib|arp",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\n \n \"neighbor\":{\n \"ip\":\"172.16.0.2\",\n \"link-layer-address\":\"00:01:11:00:02:02\"\n }\n \n}\n",
- "folder": "0ef5f1df-d43a-17fe-b006-249f83c88552"
- },
- {
- "id": "10de9ebb-db91-b664-adfa-e4b347c2ce79",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/vxlanGpeTun3",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1464768006369,
- "name": "Add vxlan-gpe - cfg",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"vxlanGpeTun3\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:vxlan-gpe-tunnel\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"routing\" : {\r\n \"ipv4-vrf-id\" : \"0\"\r\n },\r\n \"vxlan-gpe\" : {\r\n \"local\" : \"192.168.50.76\",\r\n \"remote\" : \"192.168.50.71\",\r\n \"vni\" : \"9\",\r\n \"next-protocol\" : \"ethernet\",\r\n \"encap-vrf-id\" : \"0\",\r\n \"decap-vrf-id\" : \"0\"\r\n }\r\n }\r\n ]\r\n \r\n}",
- "folder": "ded16b18-1c4c-e349-6190-7a5e30813494"
- },
- {
- "id": "10f9a053-4e29-7f2c-312c-9b6b796856e9",
- "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
- "url": "http://admin:admin@127.0.0.1:8183/restconf/config/ietf-interfaces:interfaces/interface/TenGigabitEthernet7%2F0%2F0/v3po:proxy-arp ",
- "pathVariables": {},
- "preRequestScript": null,
- "method": "DELETE",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "data": [],
- "dataMode": "raw",
- "name": "Delete proxy arp on interface",
- "description": "",
- "descriptionFormat": "html",
- "time": 1469545483066,
- "version": 2,
- "responses": [],
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "folder": "42603a84-8d76-77de-197f-19387eb13c97",
- "rawModeData": ""
- },
- {
- "id": "10ffdfa8-97bf-9d9f-e057-d18bd22291ea",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1464804325716,
- "name": "Enable GigabitEthernet0/9/0 interface - cfg",
- "description": "Enables GigabitEthernet0/9/0 interface. Equivalent vppctl command:\n\nvppctl set in state GigabitEthernet0/9/0 up\n\nNeeded to enable sub interface.\n\nTo verify invoke:\n\nvppctl show int",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "1ea15402-cdce-9573-f746-fc9256e18e53",
- "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"GigabitEthernet0/9/0\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"v3po:ethernet\": {\r\n \"mtu\": 9216\r\n },\r\n \"enabled\": true,\r\n \"vpp-vlan:sub-interfaces\": {\r\n \"sub-interface\": [\r\n {\r\n \"identifier\": 1,\r\n \"vlan-type\": \"802dot1q\",\r\n \"tags\": {\r\n \"tag\": [\r\n {\r\n \"index\": 1,\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:c-vlan\",\r\n \"vlan-id\": \"any\"\r\n }\r\n },\r\n {\r\n \"index\": 0,\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:s-vlan\",\r\n \"vlan-id\": \"100\"\r\n }\r\n }\r\n ]\r\n },\r\n \"match\": {\r\n \"vlan-tagged\": {\r\n \"match-exact-tags\": true\r\n }\r\n },\r\n \"enabled\": false\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}"
- },
- {
- "id": "11ae838d-68f0-8755-6b8b-16466512a1bf",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/ietf-interfaces:interfaces-state/",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1460539972177,
- "name": "List ifcs - oper",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "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": "1bd21e57-376e-a8e4-14b2-97598824abbb",
- "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/v3po:l2",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1465984375972,
- "name": "Remove local0 from bridge domain",
- "description": "Removes l2 interconnection of bridge-based type from local0 interface.\nCorresponds to the following VAT command:\n\nvat# sw_interface_set_l2_bridge sw_if_index 0 bd_id 1 disable\n\nVerification in VAT:\n\nvat# bridge_domain_dump",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "",
- "folder": "e742a44e-2e82-fe0c-d7c1-2f6b6bc1f0e9"
- },
- {
- "id": "218a3ee0-7ef3-adf1-088c-62a1a3e3c2a7",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/vhost1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1462891483790,
- "name": "Modify vhost user ifc - cfg",
- "description": "Modifies vhost-user interface socket.\nTo verify invoke:\n\nvppctl show vhost-user",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"vhost1\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:vhost-user\",\r\n \"enabled\": \"true\",\r\n \"vhost-user\" : {\r\n \"socket\": \"/tmp/soc2\",\r\n \"role\": \"server\"\r\n }\r\n }\r\n ]\r\n \r\n}",
- "folder": "015dc7da-a47b-fcdf-3dee-2760fb5de9fd"
- },
- {
- "id": "24ac98f0-1556-e623-ec87-1c2d7f4f089c",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/acl/ingress",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1468495690154,
- "name": "Enable L2 and Ipv4 ACL on local0 interface",
- "description": "Enables L2 and Ipv4 ACL on local0. Corresponding vpp cli commands:\n\nset int input acl intfc local0 l2-table 0\n\nset int input acl intfc local0 ip4-table 0\n\nTo verify invoke:\n\nvppctl show inacl type l2\n\nthen:\n\nvppctl show inacl type ip4",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "d47d6b3b-4c3f-7671-5bba-447d6c59ea3b",
- "rawModeData": "{\n \"ingress\": {\n \"l2-acl\": {\n \"classify-table\": \"table0\"\n },\n \"ip4-acl\": {\n \"classify-table\": \"table0\"\n }\n }\n}"
- },
- {
- "id": "24fdd76e-e90b-d552-c0d1-87a745a5ac6f",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/tapp2",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1462796722186,
- "name": "Add complex tap ifc - cfg",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"tapp2\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:tap\",\r\n \"tap\" :{\r\n \"tap-name\" : \"tapp2\",\r\n \"mac\" : \"00:ff:ff:ff:ff:ff\",\r\n \"device-instance\" : 55\r\n }\r\n }\r\n ]\r\n \r\n}",
- "folder": "ebed4cf3-96db-7ea3-1216-a0802c8f47d3"
- },
- {
- "id": "2796296f-2c09-7c3e-4cd9-9a366c1cb61c",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/v3po:acl/",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1467380189765,
- "name": "Disable ACL on local0 interface",
- "description": "Disables ACL on local0. To verify invoke:\n\nvppctl show inacl type l2\n\nand:\n\nvppctl show inacl type ip4",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "d47d6b3b-4c3f-7671-5bba-447d6c59ea3b",
- "rawModeData": ""
- },
- {
- "id": "2a3a5de9-ed06-6468-2c11-ddbdc4ec1224",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1460640004531,
- "name": "Set vrf id for local0 - cfg",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"local0\",\r\n \"description\": \"for testing purposes only\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"routing\" : {\r\n \"ipv4-vrf-id\" : \"7\"\r\n },\r\n \"v3po:ethernet\": {\r\n \"mtu\": 64\r\n }\r\n }\r\n ]\r\n \r\n}"
- },
- {
- "id": "2d25db9f-6c65-5fe0-1602-5484c058bd1b",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/vpp-classifier:vpp-classifier/classify-table/table1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1468493298160,
- "name": "Add classify table1",
- "description": "Adds classify table1 chained to classify table0.\n\nCorresponding vpp cli command:\n\nvppctl classify table mask l2 dst next-table 0\n\nTo verify invoke:\n\nvppctl sh class table verbose\n\nor:\n\nvat# classify_table_info table_id 1",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "d47d6b3b-4c3f-7671-5bba-447d6c59ea3b",
- "rawModeData": "{\n \"classify-table\": [\n {\n \"name\": \"table1\",\n \"next_table\": \"table0\",\n \"nbuckets\": \"2\",\n \"memory_size\": \"1048576\",\n \"miss_next\": \"permit\",\n \"mask\": \"ff:ff:ff:ff:ff:ff:00:00:00:00:00:00:00:00:00:00\"\n }\n ]\n}"
- },
- {
- "id": "32ef9c3f-94e5-6c15-fbc5-0816806d8f25",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/v3po-context:disabled-interfaces",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1473415606355,
- "name": "List disabled interfaces - context",
- "description": "List disabled interfaces (e.g. deleted vxlan tunnels)",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "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}",
- "folder": "f5bf94b3-feb4-1db7-6caa-f52d37b8977e"
- },
- {
- "id": "3357ff20-66dd-9f5a-7b70-dfe57c6e2e57",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/ipv4",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1466497212835,
- "name": "Read local0/ipv4 - cfg",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "0ef5f1df-d43a-17fe-b006-249f83c88552",
- "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": "38df5f70-c849-dd0d-401b-e1fcd5df539e",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/ietf-interfaces:interfaces-state/interface/local0/",
- "pathVariables": {},
- "preRequestScript": null,
- "method": "GET",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "data": null,
- "dataMode": "params",
- "name": "Show local0 - oper",
- "description": "Shows local0 interface operational state",
- "descriptionFormat": "html",
- "time": 1465805719840,
- "version": 2,
- "responses": [],
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "folder": "e742a44e-2e82-fe0c-d7c1-2f6b6bc1f0e9"
- },
- {
- "id": "3d8b0d2e-80ad-33ad-d8aa-53f237006750",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/vxlanTun1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": "{}",
- "time": 1462892071867,
- "name": "Delete virtual ifc - cfg",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "f15540bc-415f-0ce0-4c25-5a5406d11242",
- "timestamp": null,
- "rawModeData": ""
- },
- {
- "id": "3e4f9840-88db-c795-3244-6421da9ca4b3",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1/l2/rewrite",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": "{}",
- "time": 1464803940412,
- "name": "Enable tag-rewrite push - cfg",
- "description": "Enables tag-rewrite push operation for GigabitEthernet0/9/0.1 sub-interface. Corresponsing vpp cli command:\n\nvppctl set interface l2 tag-rewrite GigabitEthernet0/9/0.1 push dot1q 123 456\n\nTo verify run:\n./build-root/install-vpp-native/vpp-api-test/bin/vpp_api_test json\nand invoke:\n\n#vat sw_interface_dump\n\nor if sub-interface was added to bridge domain:\n\nvppctl show bridge-domain [bd_id] detail",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "1ea15402-cdce-9573-f746-fc9256e18e53",
- "timestamp": null,
- "rawModeData": "{\r\n \"rewrite\": {\r\n \"vlan-type\": \"vpp-vlan:802dot1q\",\r\n \"push-tags\": [\r\n {\r\n \"index\": 0,\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:s-vlan\",\r\n \"vlan-id\": 123\r\n }\r\n },\r\n {\r\n \"index\": 1,\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:c-vlan\",\r\n \"vlan-id\": 456\r\n }\r\n }\r\n ]\r\n }\r\n}"
- },
- {
- "id": "3e8c8e6b-234c-0910-de47-302adb6bc19e",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/naming-context:contexts",
- "pathVariables": {},
- "preRequestScript": "",
- "method": "GET",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "data": [],
- "dataMode": "raw",
- "name": "List naming contexts - context",
- "description": "List mapping context stored in context datastore",
- "descriptionFormat": "html",
- "time": 1463556756647,
- "version": 2,
- "responses": [],
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": "{}",
- "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}",
- "folder": "f5bf94b3-feb4-1db7-6caa-f52d37b8977e"
- },
- {
- "id": "3ec74eb9-1f3b-ac73-094b-a374377a4b3e",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/vxlanGpeTun3",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1464764638498,
- "name": "Delete vxlan-gpe - cfg",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "",
- "folder": "ded16b18-1c4c-e349-6190-7a5e30813494"
- },
- {
- "id": "4166392e-d64c-34b9-1117-cbd36974fa7e",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/v3po:vpp",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1460540006597,
- "name": "Read vpp - cfg",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "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": "44df5e99-524f-ae01-0d60-54257fd16ad5",
- "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
- "url": "http://localhost:8183/restconf/config/v3po:vpp/bridge-domains/bridge-domain/testBD/l2-fib-table/l2-fib-entry/aa:bb:cc:dd:ee:ff",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1465806577485,
- "name": "Delete L2 FIB entry",
- "description": "Removes L2 FIB entry. Corresponds to invoking:\n\nvppctl l2fib del aa:bb:cc:dd:ee:ff [bd_id]\n\nTo verify run:\n\nvppctl show l2fib verbose",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "",
- "folder": "e742a44e-2e82-fe0c-d7c1-2f6b6bc1f0e9"
- },
- {
- "id": "4546a02f-733b-4b69-54e9-5943293b3f95",
- "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
- "url": "http://admin:admin@127.0.0.1:8183/restconf/config/ietf-interfaces:interfaces/interface/TenGigabitEthernet7%2F0%2F0",
- "pathVariables": {},
- "preRequestScript": null,
- "method": "PUT",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "data": [],
- "dataMode": "raw",
- "name": "Add proxy arp on interface",
- "description": "Add proxy arp on interface",
- "descriptionFormat": "html",
- "time": 1469545402144,
- "version": 2,
- "responses": [],
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "folder": "42603a84-8d76-77de-197f-19387eb13c97",
- "rawModeData": "{\n \n \"ietf-interfaces:interface\": [\n {\n \"name\": \"TenGigabitEthernet7/0/0\",\n \"description\": \"for testing purposes\",\n \"type\": \"iana-if-type:ethernetCsmacd\",\n \"v3po:proxy-arp\" :{\n \"vrf-id\" : 0,\n \"low-addr\" : \"111.1.1.1\",\n\t\t \"high-addr\" : \"111.1.1.255\"\n }\n }\n ]\n \n}"
- },
- {
- "id": "488acc8a-0816-d280-8c9d-bc1326edea9b",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1/l2/rewrite",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1464804511683,
- "name": "Disable tag-rewrite - cfg",
- "description": "Disables tag-rewrite operation for GigabitEthernet0/9/0.1 sub-interface. Corresponsing vpp cli command:\n\nvppctl set interface l2 tag-rewrite GigabitEthernet0/9/0.1 disable\n\nTo verify run:\n./build-root/install-vpp-native/vpp-api-test/bin/vpp_api_test json\nand invoke:\n\n#vat sw_interface_dump\n\nor if sub-interface was added to bridge domain:\n\nvppctl show bridge-domain [bd_id] detail",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "1ea15402-cdce-9573-f746-fc9256e18e53",
- "rawModeData": ""
- },
- {
- "id": "4a8f8191-91ce-d65c-58c9-206204603a3e",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1460636113690,
- "name": "Set interfaces bulk edit - cfg",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\n \"interfaces\": {\n \"interface\": [\n {\n \"name\": \"pg/stream-2\",\n \"enabled\": true,\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n {\n \"name\": \"pg/stream-3\",\n \"enabled\": true,\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n {\n \"name\": \"pg/stream-0\",\n \"enabled\": true,\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n {\n \"name\": \"local0\",\n \"description\": \"for testing purposes\",\n \"type\": \"iana-if-type:ethernetCsmacd\",\n \"enabled\": true\n },\n {\n \"name\": \"pg/stream-1\",\n \"enabled\": true,\n \"type\": \"iana-if-type:ethernetCsmacd\"\n }\n ]\n }\n}"
- },
- {
- "id": "4afe77aa-43c0-29ba-c910-4cbbea95ee07",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/ietf-interfaces:interfaces-state/interface/local0/ipv4",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1465473594194,
- "name": "Read local0/ipv4 - oper",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "0ef5f1df-d43a-17fe-b006-249f83c88552",
- "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": "4d59da85-1853-8854-6eb6-36d13821cc14",
- "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
- "url": "http://localhost:8183/restconf/config/v3po:vpp/bridge-domains/bridge-domain/testBD",
- "pathVariables": {},
- "preRequestScript": "",
- "method": "PUT",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "data": [],
- "dataMode": "raw",
- "name": "Create bridge domain - cfg",
- "description": "Creates bridgfe domain. Corresponds to invoking:\n\nvat# bridge_domain_add_del bd_id [bd_id] learn 0 forward 0 uu-flood 0 flood 1 arp-term 0\n\nTo verify run:\n\nvppctl show bridge-domain [bd_id] detail",
- "descriptionFormat": "html",
- "time": 1465805138795,
- "version": 2,
- "responses": [],
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "folder": "e742a44e-2e82-fe0c-d7c1-2f6b6bc1f0e9",
- "rawModeData": "{\r\n \"bridge-domain\": [\r\n {\r\n \"name\": \"testBD\",\r\n \"flood\": \"true\",\r\n \"forward\": \"false\",\r\n \"learn\": \"false\",\r\n \"unknown-unicast-flood\": \"false\",\r\n \"arp-termination\": \"false\"\r\n }\r\n ]\r\n}"
- },
- {
- "id": "4d7faf60-953a-b796-887d-b1c0a46d3904",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1/l2/rewrite",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1464805188780,
- "name": "Enable tag-rewrite translate 1-2 - cfg",
- "description": "Enables tag-rewrite translate 1-2 operation for GigabitEthernet0/9/0.1 sub-interface. Corresponsing vpp cli command:\n\nvppctl set interface l2 tag-rewrite GigabitEthernet0/9/0.1 translate 1-2 dot1q 111 222\n\nTo verify run:\n./build-root/install-vpp-native/vpp-api-test/bin/vpp_api_test json\nand invoke:\n\n#vat sw_interface_dump\n\nor if sub-interface was added to bridge domain:\n\nvppctl show bridge-domain [bd_id] detail",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "1ea15402-cdce-9573-f746-fc9256e18e53",
- "rawModeData": "{\r\n \"rewrite\": {\r\n \"vlan-type\": \"vpp-vlan:802dot1q\",\r\n \"pop-tags\": \"1\",\r\n \"push-tags\": [\r\n {\r\n \"index\": 0,\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:s-vlan\",\r\n \"vlan-id\": 111\r\n }\r\n },\r\n {\r\n \"index\": 1,\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:c-vlan\",\r\n \"vlan-id\": 222\r\n }\r\n }\r\n ]\r\n }\r\n}"
- },
- {
- "id": "4d9995b2-2698-7aaa-9c63-3db639f682fe",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/vxlanTun1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1464767860505,
- "name": "Add virtual ifc - cfg",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"vxlanTun1\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:vxlan-tunnel\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"routing\" : {\r\n \"ipv4-vrf-id\" : \"0\"\r\n },\r\n \"vxlan\" : {\r\n \"src\" : \"192.168.1.6\",\r\n \"dst\" : \"192.168.1.9\",\r\n \"vni\" : \"88\",\r\n \"encap-vrf-id\" : \"0\"\r\n }\r\n }\r\n ]\r\n \r\n}",
- "folder": "f15540bc-415f-0ce0-4c25-5a5406d11242"
- },
- {
- "id": "5b0d301e-c2d1-5179-41eb-d1fb07cc93f0",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/vpp-classifier:vpp-classifier/classify-table/table0/classify-session/00:00:00:00:00:00:01:02:03:04:05:06:00:00:00:00",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1468493934488,
- "name": "Remove classify session",
- "description": "Removes classify session. To verify invoke:\n\nvppctl sh class table verbose",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "d47d6b3b-4c3f-7671-5bba-447d6c59ea3b",
- "rawModeData": ""
- },
- {
- "id": "5eabbac5-77fc-a886-7070-ba7dfb735301",
- "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
- "url": "http://localhost:8183/restconf/config/v3po:vpp/bridge-domains/bridge-domain/testBD/l2-fib-table/l2-fib-entry/aa:bb:cc:dd:ee:ff",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1465806456783,
- "name": "Add L2 FIB entry (forward)",
- "description": "Adds L2 FIB static entry. Corresponds to invoking:\n\nvppctl l2fib add aa:bb:cc:dd:ee:ff [bd_id] local0\n\nTo verify run:\n\nvppctl show l2fib verbose",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\n \"l2-fib-entry\": [\n {\n \"phys-address\": \"aa:bb:cc:dd:ee:ff\",\n \"outgoing-interface\": \"local0\",\n \"action\": \"l2-fib-forward\"\n }\n ]\n}",
- "folder": "e742a44e-2e82-fe0c-d7c1-2f6b6bc1f0e9"
- },
- {
- "id": "5f4e6007-2144-0555-7567-f093b64acec9",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/tapp",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1462535811974,
- "name": "Add simple tap ifc -cfg",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "ebed4cf3-96db-7ea3-1216-a0802c8f47d3",
- "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"tapp\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:tap\",\r\n \"tap\" :{\r\n \"tap-name\" : \"tapp\"\r\n }\r\n }\r\n ]\r\n \r\n}"
- },
- {
- "id": "62f0370e-cdbb-c29d-3ea4-6ad08d4ceb08",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1464804304987,
- "name": "Add sub interface - cfg",
- "description": "Adds sub interface. Corresponsing vpp cli command:\n\nvppctl create sub GigabitEthernet0/9/0 1 dot1q 100 inner-dot1q any\n\nTo verify run:\n./build-root/install-vpp-native/vpp-api-test/bin/vpp_api_test json\nand invoke:\n\n#vat sw_interface_dump",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "1ea15402-cdce-9573-f746-fc9256e18e53",
- "rawModeData": "{\r\n \"sub-interface\": [\r\n {\r\n \"identifier\": \"1\",\r\n \"vlan-type\": \"802dot1q\",\r\n \"tags\": {\r\n \"tag\": [\r\n {\r\n \"index\": \"0\",\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:s-vlan\",\r\n \"vlan-id\": \"100\"\r\n }\r\n },\r\n {\r\n \"index\": \"1\",\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:c-vlan\",\r\n \"vlan-id\": \"any\"\r\n }\r\n }\r\n ]\r\n },\r\n \"match\": {\r\n \"vlan-tagged\": {\r\n \"match-exact-tags\": \"true\"\r\n }\r\n },\r\n \"enabled\": \"false\"\r\n }\r\n ]\r\n}"
- },
- {
- "id": "63fa7145-b1df-0d48-f38b-27c11cb3a5f6",
- "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
- "url": "http://localhost:8183/restconf/config/v3po:vpp/bridge-domains/bridge-domain/testBD",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1465806733493,
- "name": "Show bridge domain - cfg",
- "description": "Shows testBD bridge domain configuration.",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\r\n \"bridge-domain\": [\r\n {\r\n \"name\": \"testBD\",\r\n \"flood\": \"true\",\r\n \"forward\": \"false\",\r\n \"learn\": \"false\",\r\n \"unknown-unicast-flood\": \"false\",\r\n \"arp-termination\": \"false\"\r\n }\r\n ]\r\n}",
- "folder": "e742a44e-2e82-fe0c-d7c1-2f6b6bc1f0e9"
- },
- {
- "id": "65e4713c-3977-7b96-9b46-198a9fe3a592",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/ipv4/address/127.0.0.1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1466497176571,
- "name": "Set ipv4 local0 interface - cfg netmask",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "0ef5f1df-d43a-17fe-b006-249f83c88552",
- "rawModeData": "{\r\n \"address\": [{\r\n \"ip\" : \"127.0.0.1\",\r\n \"netmask\": \"255.255.255.128\"\r\n }]\r\n}"
- },
- {
- "id": "67e79c2e-77b7-8000-de1f-10f2136cd718",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1/ipv4/address/1.2.3.4",
- "pathVariables": {},
- "preRequestScript": "",
- "method": "PUT",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "data": [],
- "dataMode": "raw",
- "name": "Set ipv4 for sub-interface - cfg",
- "description": "Correponds to the following command:\n\nvppctl set interface ip address GigabitEthernet0/9/0.1 1.2.3.4/8\n\nTo verify invoke:\nvppctl show int",
- "descriptionFormat": "html",
- "time": 1467117222646,
- "version": 2,
- "responses": [],
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "folder": "0ef5f1df-d43a-17fe-b006-249f83c88552",
- "rawModeData": "{\r\n \"address\": [{\r\n \"ip\" : \"1.2.3.4\",\r\n \"prefix-length\" : \"8\"\r\n }]\r\n}"
- },
- {
- "id": "6cc318f9-94ec-b0c0-a3f9-69b085613f59",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/vhost1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": "{}",
- "time": 1462891488523,
- "name": "Delete vhost user ifc - cfg",
- "description": "Deletes vhost user interface.\nCorresponding vpp CLI command:\n\nvppctl delete vhost-user sw_if_index [index]\n\nTo verify invoke:\n\nvppctl show vhost-user\n\nor\n\nvppctl show int",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "015dc7da-a47b-fcdf-3dee-2760fb5de9fd",
- "rawModeData": "",
- "descriptionFormat": null
- },
- {
- "id": "7704eaea-3eb6-2a08-04f0-07c124c3a9ca",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/vhost1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1462891472552,
- "name": "Add vhost user ifc - cfg",
- "description": "Adds vhost-user interface.\nCorresponsing vpp cli command:\n\ncreate vhost-user socket /tmp/soc1 server\n\nTo verify invoke:\n\nvppctl show vhost-user\n\nor\n\nvppctl show int",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"vhost1\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:vhost-user\",\r\n \"enabled\": \"true\",\r\n \"vhost-user\" : {\r\n \"socket\": \"/tmp/soc1\",\r\n \"role\": \"server\"\r\n }\r\n }\r\n ]\r\n \r\n}",
- "folder": "015dc7da-a47b-fcdf-3dee-2760fb5de9fd"
- },
- {
- "id": "7b592c36-12a3-2867-ed71-80ec74695dec",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1460540047356,
- "name": "Enable local0 interface - cfg",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"local0\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"v3po:ethernet\": {\r\n \"mtu\": 64\r\n }\r\n }\r\n ]\r\n \r\n}"
- },
- {
- "id": "8f5860a3-ac28-811b-3830-52df067c1a60",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/v3po:vpp-state",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1460539994330,
- "name": "Read vpp-state - oper",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "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": "9362a506-1e6f-38eb-b7a9-e1bec3fc2177",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1460539962712,
- "name": "List ifcs - cfg",
- "description": "List ifcs - cfg",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "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": "9b3cbedf-15b4-fee0-6424-b32bc4781ca3",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/vpp-classifier:vpp-classifier/classify-table/table0",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1468493354688,
- "name": "Add classify table0",
- "description": "Adds classify table0. Corresponding vpp cli command:\n\nvppctl classify table mask l2 src\n\nTo verify invoke:\n\nvppctl sh class table verbose\n\nor:\n\nvat# classify_table_info table_id 0",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "d47d6b3b-4c3f-7671-5bba-447d6c59ea3b",
- "rawModeData": "{\n \"classify-table\": [\n {\n \"name\": \"table0\",\n \"nbuckets\": \"2\",\n \"memory_size\": \"1048576\",\n \"miss_next\": \"permit\",\n \"mask\": \"00:00:00:00:00:00:ff:ff:ff:ff:ff:ff:00:00:00:00\"\n }\n ]\n}"
- },
- {
- "id": "9ed8e7a8-8f38-a68c-bdb0-58f0743a55a0",
- "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
- "url": "http://localhost:8183/restconf/config/v3po:vpp/bridge-domains/bridge-domain/testBD/arp-termination-table/arp-termination-table-entry/1.2.3.4/aa:bb:cc:dd:ee:ff",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1471257339594,
- "name": "Delete ARP termination table entry ",
- "description": "Removes ARP termination termination entry. Corresponds to invoking:\n\nvat# bd_ip_mac_add_del bd_id [bd_id] 1.2.3.4 aa:bb:cc:dd:ee:ff del\n\nTo verify run:\n\nvppctl show bridge-domain 1 detail",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "",
- "folder": "e742a44e-2e82-fe0c-d7c1-2f6b6bc1f0e9"
- },
- {
- "id": "a47fb37c-a45d-078c-9842-396b80195aaf",
- "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
- "url": "http://localhost:8183/restconf/config/v3po:vpp/bridge-domains/bridge-domain/testBD/arp-termination-table/arp-termination-table-entry/1.2.3.4/aa:bb:cc:dd:ee:ff",
- "pathVariables": {},
- "preRequestScript": "",
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "name": "Add ARP termination table entry ",
- "description": "Adds ARP termination termination entry. Corresponds to invoking:\n\nvat# bd_ip_mac_add_del bd_id [bd_id] 1.2.3.4 aa:bb:cc:dd:ee:ff\n\nTo verify run:\n\nvppctl show bridge-domain 1 detail",
- "descriptionFormat": "html",
- "time": 1471256345214,
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\n \"arp-termination-table-entry\": [\n {\n \"ip-address\": \"1.2.3.4\",\n \"phys-address\": \"aa:bb:cc:dd:ee:ff\"\n }\n ]\n}",
- "folder": "e742a44e-2e82-fe0c-d7c1-2f6b6bc1f0e9"
- },
- {
- "id": "a68945f7-ee2d-e352-1bb9-1511757c21b2",
- "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/v3po:l2",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1465805545425,
- "name": "Add local0 to bridge domain",
- "description": "Adds l2 interconnection of bridge-based type to local0 interface.\nCorresponds to the following command:\n\nvppctl set interface l2 bridge local0 [bd_id]\n\nTo verify invoke:\n\nvppctl show bridge-domain [bd_id] detail",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\r\n \"l2\": {\r\n \"bridge-domain\": \"testBD\",\r\n \"split-horizon-group\": 1,\r\n \"bridged-virtual-interface\": \"false\"\r\n }\r\n}",
- "folder": "e742a44e-2e82-fe0c-d7c1-2f6b6bc1f0e9"
- },
- {
- "id": "a78cecbf-1b20-3051-af3e-213c947c94ac",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/vpp-classifier:vpp-classifier/classify-table/table1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1467377388428,
- "name": "Remove classify table1",
- "description": "Removes classify table1. Corresponds to the following command:\n\nvppctl classify table del table 1\n\nTo verify invoke:\n\nvppctl sh class table verbose",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "d47d6b3b-4c3f-7671-5bba-447d6c59ea3b",
- "rawModeData": ""
- },
- {
- "id": "aa1f621e-4ae7-f266-e85f-ec3797c3552a",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/vpp-classifier:vpp-classifier/classify-table/table0",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1467377830897,
- "name": "Remove classify table0",
- "description": "Removes classify table0. Corresponds to the following command:\n\nvppctl classify table del table 0\n\nTo verify invoke:\n\nvppctl sh class table verbose",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "d47d6b3b-4c3f-7671-5bba-447d6c59ea3b",
- "rawModeData": ""
- },
- {
- "id": "ac8d2039-0036-4764-1437-7e08f4a52527",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/greTun1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1469159528476,
- "name": "Add gre ifc - cfg",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"greTun1\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:gre-tunnel\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"routing\" : {\r\n \"ipv4-vrf-id\" : \"0\"\r\n },\r\n \"gre\" : {\r\n \"src\" : \"192.168.1.6\",\r\n \"dst\" : \"192.168.1.9\",\r\n \"outer-fib-id\" : \"0\"\r\n }\r\n }\r\n ]\r\n \r\n}",
- "folder": "2e489b42-8432-15f1-f4bc-859c34a3c570"
- },
- {
- "id": "ad06e7aa-527e-7b8d-fff1-d000de301eca",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/vpp-classifier-context:vpp-classifier-context",
- "pathVariables": {},
- "preRequestScript": "",
- "method": "GET",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "data": [],
- "dataMode": "raw",
- "name": "List ACL contexts - context",
- "description": "List mapping context for ACLs stored in context datastore",
- "descriptionFormat": "html",
- "time": 1474279194630,
- "version": 2,
- "responses": [],
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "folder": "f5bf94b3-feb4-1db7-6caa-f52d37b8977e",
- "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": "ae996349-eec7-2ac4-9fde-1ec9fc63cd3f",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/ipv4/address/127.0.0.1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1466497187475,
- "name": "Remove ipv4 from local0 interface - cfg",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "0ef5f1df-d43a-17fe-b006-249f83c88552",
- "rawModeData": ""
- },
- {
- "id": "b31e6fc8-2cf3-92e3-3ac9-e9d244b6eb16",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/",
- "preRequestScript": null,
- "pathVariables": {},
- "method": "GET",
- "data": null,
- "dataMode": "params",
- "tests": null,
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1465805728052,
- "name": "Show local0 - cfg",
- "description": "Shows local0 interface configuration",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "e742a44e-2e82-fe0c-d7c1-2f6b6bc1f0e9"
- },
- {
- "id": "ba60c6cb-bb5f-2d45-66c1-a4382d348b9b",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/ipv4/address/127.0.0.1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1466496859574,
- "name": "Set ipv4 local0 interface - cfg",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "0ef5f1df-d43a-17fe-b006-249f83c88552",
- "rawModeData": "{\r\n \"address\": [{\r\n \"ip\" : \"127.0.0.1\",\r\n \"prefix-length\" : \"24\"\r\n }]\r\n}"
- },
- {
- "id": "c4923db5-50eb-0106-10fc-3f1361593d2a",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/vpp-classifier:vpp-classifier/classify-table/table0/classify-session/00:00:00:00:00:00:01:02:03:04:05:07:00:00:00:00",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1468493583927,
- "name": "Add another classify session",
- "description": "Adds second classify session to table0. Corresponding vpp cli command:\n\nvppctl classify session acl-hit-next deny opaque-index 0 table-index 0 match l2 src 01:02:03:04:05:07\n\nTo verify invoke:\n\nvppctl sh class table verbose",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "d47d6b3b-4c3f-7671-5bba-447d6c59ea3b",
- "rawModeData": "{\n \"classify-session\": [\n {\n \"hit_next\": \"deny\",\n \"match\": \"00:00:00:00:00:00:01:02:03:04:05:07:00:00:00:00\"\n }\n ]\n}"
- },
- {
- "id": "c6272b59-2200-d334-0abc-6e13deb0dedd",
- "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
- "url": "http://localhost:8183/restconf/config/v3po:vpp/bridge-domains/bridge-domain/testBD/l2-fib-table/l2-fib-entry/00:01:02:03:04:05",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1465814845273,
- "name": "Add L2 FIB entry (filter)",
- "description": "Adds L2 FIB static entry. Corresponds to invoking:\n\nvppctl l2fib add 00:01:02:03:04:05 [bd_id] filter\n\nTo verify run:\n\nvppctl show l2fib verbose",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\n \"l2-fib-entry\": [\n {\n \"phys-address\": \"00:01:02:03:04:05\",\n \"outgoing-interface\": \"local0\",\n \"static-config\": \"true\",\n \"action\": \"l2-fib-filter\"\n }\n ]\n}",
- "folder": "e742a44e-2e82-fe0c-d7c1-2f6b6bc1f0e9"
- },
- {
- "id": "ca164bb4-73ab-a692-e74b-b7c526b2a1b6",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/ietf-interfaces:interfaces-state/interface/local0",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1465472429324,
- "name": "Read local0 - oper",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "0ef5f1df-d43a-17fe-b006-249f83c88552",
- "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": "ca295d02-4940-e584-e446-64a79ce733f9",
- "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
- "url": "http://localhost:8183/restconf/operational/v3po:vpp-state/bridge-domains/bridge-domain/testBD",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1465806752970,
- "name": "Show bridge domain - oper",
- "description": "Shows testBD bridge domain operational state.\nCorresponds to invoking:\n\nvppctl show bridge-domain [bd_id] detail",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\r\n \"bridge-domain\": [\r\n {\r\n \"name\": \"testBD\",\r\n \"flood\": \"true\",\r\n \"forward\": \"false\",\r\n \"learn\": \"false\",\r\n \"unknown-unicast-flood\": \"false\",\r\n \"arp-termination\": \"false\"\r\n }\r\n ]\r\n}",
- "folder": "e742a44e-2e82-fe0c-d7c1-2f6b6bc1f0e9"
- },
- {
- "id": "ce66b067-e7de-224b-6e46-41a4a4e2305c",
- "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n",
- "url": "http://localhost:8183/restconf/config/v3po:vpp/bridge-domains/bridge-domain/testBD/l2-fib-table/l2-fib-entry/11:22:33:44:55:66",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1465806064247,
- "name": "Add L2 FIB entry (static, forward)",
- "description": "Adds L2 FIB static entry. Corresponds to invoking:\n\nvppctl l2fib add 11:22:33:44:55:66 [bd_id] local0 static\n\nTo verify run:\n\nvppctl show l2fib verbose",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\n \"l2-fib-entry\": [\n {\n \"phys-address\": \"11:22:33:44:55:66\",\n \"outgoing-interface\": \"local0\",\n \"static-config\": \"true\",\n \"action\": \"l2-fib-forward\"\n }\n ]\n}",
- "folder": "e742a44e-2e82-fe0c-d7c1-2f6b6bc1f0e9"
- },
- {
- "id": "ea9e0f3b-ede6-2104-892b-bb8fd72e3d5d",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-access-control-list:access-lists/acl/ietf-access-control-list:eth-acl/acl1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1471942268865,
- "name": "Write acl1 list (L2)",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\r\n \"acl\": [\r\n {\r\n \"acl-type\": \"ietf-access-control-list:eth-acl\",\r\n \"acl-name\": \"acl1\",\r\n \"access-list-entries\": {\r\n \"ace\": [\r\n {\r\n \"rule-name\": \"rule1\",\r\n \"matches\": {\r\n \"destination-mac-address\": \"AA:BB:CC:DD:00:00\",\r\n \"destination-mac-address-mask\": \"FF:FF:FF:FF:00:00\",\r\n \"source-mac-address\": \"00:00:00:00:AA:BB\",\r\n \"source-mac-address-mask\": \"00:00:00:00:FF:FF\"\r\n },\r\n \"actions\": {\r\n \"deny\": {}\r\n }\r\n },\r\n {\r\n \"rule-name\": \"rule2\",\r\n \"matches\": {\r\n \"source-mac-address\": \"01:02:03:04:05:06\"\r\n },\r\n \"actions\": {\r\n \"deny\": {}\r\n }\r\n },\r\n {\r\n \"rule-name\": \"rule3\",\r\n \"matches\": {\r\n \"destination-mac-address\": \"11:22:33:44:55:66\"\r\n },\r\n \"actions\": {\r\n \"deny\": {}\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n}",
- "folder": "c05d7211-11b0-5688-2079-afa51196045c"
- },
- {
- "id": "fe6a8289-d2dc-e671-2490-5546d223f47f",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-access-control-list:access-lists/acl/ietf-access-control-list:eth-acl/acl2",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1471940027513,
- "name": "Write acl2 list (L2)",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\r\n \"acl\": [\r\n {\r\n \"acl-type\": \"ietf-access-control-list:eth-acl\",\r\n \"acl-name\": \"acl2\",\r\n \"access-list-entries\": {\r\n \"ace\": [\r\n {\r\n \"rule-name\": \"rule1\",\r\n \"matches\": {\r\n \"destination-mac-address\": \"11:11:11:11:11:11\",\r\n \"source-mac-address\": \"22:22:22:22:22:22\"\r\n },\r\n \"actions\": {\r\n \"deny\": {}\r\n }\r\n },\r\n {\r\n \"rule-name\": \"rule2\",\r\n \"matches\": {\r\n \"destination-mac-address\": \"33:33:33:33:33:33\"\r\n },\r\n \"actions\": {\r\n \"deny\": {}\r\n }\r\n },\r\n {\r\n \"rule-name\": \"rule3\",\r\n \"matches\": {\r\n \"source-mac-address\": \"44:44:44:44:44:44\"\r\n },\r\n \"actions\": {\r\n \"deny\": {}\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n}",
- "folder": "c05d7211-11b0-5688-2079-afa51196045c"
- },
- {
- "id": "5e93fbca-86d0-12a5-45fd-45d7dfa3bd40",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-access-control-list:access-lists/acl/ietf-access-control-list:ipv4-acl/acl3",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1472135918219,
- "name": "Write acl3 list (IP4)",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\r\n \"acl\": [\r\n {\r\n \"acl-type\": \"ietf-access-control-list:ipv4-acl\",\r\n \"acl-name\": \"acl3\",\r\n \"access-list-entries\": {\r\n \"ace\": [\r\n {\r\n \"rule-name\": \"rule1\",\r\n \"matches\": {\r\n \"destination-ipv4-network\": \"1.2.3.1/24\",\r\n \"protocol\": \"4\",\r\n \"dscp\": \"11\",\r\n \"source-ipv4-network\": \"1.2.4.2/24\"\r\n },\r\n \"actions\": {\r\n \"deny\": {}\r\n }\r\n },\r\n {\r\n \"rule-name\": \"rule2\",\r\n \"matches\": {\r\n \"destination-ipv4-network\": \"1.1.1.1/16\",\r\n \"protocol\": \"4\",\r\n \"dscp\": \"63\",\r\n \"source-ipv4-network\": \"2.2.2.2/32\"\r\n },\r\n \"actions\": {\r\n \"deny\": {}\r\n }\r\n },\r\n {\r\n \"rule-name\": \"rule3\",\r\n \"matches\": {\r\n \"source-ipv4-network\": \"1.2.3.4/32\"\r\n },\r\n \"actions\": {\r\n \"deny\": {}\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n}",
- "folder": "c05d7211-11b0-5688-2079-afa51196045c"
- },
- {
- "id": "5140ac58-342a-1576-8b0e-99eb8b3b1fb2",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-access-control-list:access-lists/acl/ietf-access-control-list:ipv6-acl/acl4",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1472199072153,
- "name": "Write acl4 list (IP6)",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\r\n \"acl\": [\r\n {\r\n \"acl-type\": \"ietf-access-control-list:ipv6-acl\",\r\n \"acl-name\": \"acl4\",\r\n \"access-list-entries\": {\r\n \"ace\": [\r\n {\r\n \"rule-name\": \"rule1\",\r\n \"matches\": {\r\n \"destination-ipv6-network\": \"1111:2222:3333:4444:5555:6666:7777:8888/64\",\r\n \"protocol\": \"6\",\r\n \"dscp\": \"11\",\r\n \"source-ipv6-network\": \"aaaa:bbbb:cccc:dddd:5555:6666:7777:8888/32\"\r\n },\r\n \"actions\": {\r\n \"deny\": {}\r\n }\r\n },\r\n {\r\n \"rule-name\": \"rule2\",\r\n \"matches\": {\r\n \"destination-ipv6-network\": \"1111:2222:3333:4444:5555:6666:7777:8888/96\",\r\n \"protocol\": \"6\",\r\n \"dscp\": \"11\",\r\n \"source-ipv6-network\": \"aaaa:bbbb:cccc:dddd:5555:6666:7777:8888/8\"\r\n },\r\n \"actions\": {\r\n \"deny\": {}\r\n }\r\n },\r\n {\r\n \"rule-name\": \"rule3\",\r\n \"matches\": {\r\n \"destination-ipv6-network\": \"1111:2222:3333:4444:5555:6666:7777:8888/128\"\r\n },\r\n \"actions\": {\r\n \"deny\": {}\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n}",
- "folder": "c05d7211-11b0-5688-2079-afa51196045c"
- },
- {
- "id": "9f58c827-d698-fc60-ec49-c2ccbca97c35",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-access-control-list:access-lists/acl/vpp-acl:mixed-acl/acl5",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1476266995233,
- "name": "Write acl5 list (IP+MAC)",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\r\n \"acl\": [\r\n {\r\n \"acl-type\": \"vpp-acl:mixed-acl\",\r\n \"acl-name\": \"acl5\",\r\n \"access-list-entries\": {\r\n \"ace\": [\r\n {\r\n \"rule-name\": \"rule1(ip4+mac)\",\r\n \"matches\": {\r\n \"vpp-acl:destination-mac-address\": \"AA:BB:CC:DD:00:00\",\r\n \"vpp-acl:destination-mac-address-mask\": \"FF:FF:FF:FF:00:00\",\r\n \"vpp-acl:source-mac-address\": \"00:00:00:00:AA:BB\",\r\n \"vpp-acl:source-mac-address-mask\": \"00:00:00:00:FF:FF\",\r\n \"vpp-acl:destination-ipv4-network\": \"1.2.3.1/24\",\r\n \"vpp-acl:protocol\": \"4\",\r\n \"vpp-acl:dscp\": \"11\",\r\n \"vpp-acl:source-ipv4-network\": \"1.2.4.2/24\"\r\n },\r\n \"actions\": {\r\n \"deny\": {}\r\n }\r\n },\r\n {\r\n \"rule-name\": \"rule2(ip4+mac)\",\r\n \"matches\": {\r\n \"vpp-acl:source-mac-address\": \"01:02:03:04:05:06\",\r\n \"vpp-acl:destination-ipv4-network\": \"1.1.1.1/16\",\r\n \"vpp-acl:protocol\": \"4\",\r\n \"vpp-acl:dscp\": \"63\",\r\n \"vpp-acl:source-ipv4-network\": \"2.2.2.2/32\"\r\n },\r\n \"actions\": {\r\n \"deny\": {}\r\n }\r\n },\r\n {\r\n \"rule-name\": \"rule3(ip6+mac)\",\r\n \"matches\": {\r\n \"vpp-acl:destination-mac-address\": \"11:22:33:44:55:66\",\r\n \"vpp-acl:destination-ipv6-network\": \"1111:2222:3333:4444:5555:6666:7777:8888/64\"\r\n },\r\n \"actions\": {\r\n \"deny\": {}\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n}",
- "folder": "c05d7211-11b0-5688-2079-afa51196045c"
- },
- {
- "id": "93b5345a-434f-9459-26c2-dc2cad9176e0",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-access-control-list:access-lists/acl/vpp-acl:mixed-acl/acl6",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1476780298679,
- "name": "Write acl6 list (L4 rules)",
- "description": "Deny any traffic where destination port is 80 and source port in range [1000,2000].",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\n\t\"acl\": [\n\t\t{\n\t\t\t\"acl-name\": \"acl6\", \n\t\t\t\"acl-type\": \"vpp-acl:mixed-acl\", \n\t\t\t\"access-list-entries\": {\n\t\t\t\t\"ace\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"matches\": {\n \"destination-ipv4-network\": \"0.0.0.0/0\",\n\t\t\t\t\t\t\t\"destination-port-range\": {\n\t\t\t\t\t\t\t\t\"lower-port\": 80\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}, \n\t\t\t\t\t\t\t\"source-port-range\": {\n\t\t\t\t\t\t\t\t\"lower-port\": 1000,\n\t\t\t\t\t\t\t\t\"upper-port\": 2000\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, \n\t\t\t\t\t\t\"actions\": {\n\t\t\t\t\t\t\t\"deny\": {}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"rule-name\": \"rule1\"\n\t\t\t\t\t}]}}]}\n",
- "folder": "c05d7211-11b0-5688-2079-afa51196045c"
- },
- {
- "id": "4d3d06fe-8a64-d0e4-400a-79c4fbd6db73",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-access-control-list:access-lists/acl/ietf-access-control-list:eth-acl/acl1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1471595112052,
- "name": "Read acl1 list (cfg)",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "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}",
- "folder": "c05d7211-11b0-5688-2079-afa51196045c"
- },
- {
- "id": "33280f11-2d61-09d3-f726-9907ef00dc19",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/ietf-acl/ingress",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1471935414498,
- "name": "Enable L2 aACL on local0 interface",
- "description": "Creates chain of classfy tabless/sessions in VPP and assigns them to local0 interface (asumption: local0 is in l2 mode).\n\nCan be verified with:\nvppctl show classify table verbose\n\nthen:\nvppctl show inacl type l2",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\n \"ingress\": {\n \"access-lists\": {\n \"acl\": [\n {\n \"type\" : \"ietf-access-control-list:eth-acl\",\n \"name\" : \"acl1\"\n },\n {\n \"type\" : \"ietf-access-control-list:eth-acl\",\n \"name\" : \"acl2\"\n }\n ],\n \"default-action\": \"permit\",\n \"mode\": \"l2\"\n }\n }\n}",
- "folder": "c05d7211-11b0-5688-2079-afa51196045c"
- },
- {
- "id": "60d4ab79-dea1-de5a-63eb-6e26d3d1481b",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/ietf-acl/ingress/access-lists/acl/ietf-access-control-list:ipv4-acl/acl3",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1472135956801,
- "name": "Enable L3 IP4 ACL on local0 interface",
- "description": "Creates chain of classfy tabless/sessions in VPP and assigns them to local0 interface.\n\nCan be verified with:\nvppctl show classify table verbose\n\nthen (depending on acl mode):\nvppctl show inacl type l2\nor\nvppctl show inacl type ip4",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\n\n \"acl\": [\n {\n \"type\" : \"ietf-access-control-list:ipv4-acl\",\n \"name\" : \"acl3\"\n }\n ]\n}",
- "folder": "c05d7211-11b0-5688-2079-afa51196045c"
- },
- {
- "id": "d668c31c-b904-cd65-124c-dd2a89149b70",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/ietf-acl/ingress/access-lists/acl/ietf-access-control-list:ipv6-acl/acl4",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1472212582064,
- "name": "Enable L3 IP6 ACL on local0 interface",
- "description": "Creates chain of classfy tabless/sessions in VPP and assigns them to local0 interface.\n\nCan be verified with:\nvppctl show classify table verbose\n\nthen (depending on acl mode):\nvppctl show inacl type l2\nor\nvppctl show inacl type ip6",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\n\n \"acl\": [\n {\n \"type\" : \"ietf-access-control-list:ipv6-acl\",\n \"name\" : \"acl4\"\n }\n ]\n}",
- "folder": "c05d7211-11b0-5688-2079-afa51196045c"
- },
- {
- "id": "13b938a5-7a53-513f-44b9-33d869b8cb53",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/ietf-acl/ingress/access-lists/acl/vpp-acl:mixed-acl/acl5",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1476273830067,
- "name": "Enable L3 IP4/MAC ACL on local0 interface",
- "description": "Creates chain of classfy tabless/sessions in VPP and assigns them to local0 interface.\n\nCan be verified with:\nvppctl show classify table verbose\n\nthen (depending on acl mode):\n\nvppctl show inacl type l2\n\nor\n\nvppctl show inacl type ip4\n\nvppctl show inacl type ip6",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\n\n \"acl\": [\n {\n \"type\" : \"vpp-acl:mixed-acl\",\n \"name\" : \"acl5\"\n }\n ]\n}",
- "folder": "c05d7211-11b0-5688-2079-afa51196045c"
- },
- {
- "id": "bca26b70-fe05-a1b4-f93a-1f683341d492",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/ietf-acl/ingress/access-lists/acl/vpp-acl:mixed-acl/acl6",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1476778885469,
- "name": "Enable L4 ACL on local0 interface",
- "description": "Creates chain of classfy tabless/sessions in VPP and assigns them to local0 interface.\n\nCan be verified with:\nvppctl show classify table verbose\n\nthen (depending on acl mode):\n\nvppctl show inacl type l2\n\nor\n\nvppctl show inacl type ip4\n\nvppctl show inacl type ip6",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\n\n \"acl\": [\n {\n \"type\" : \"vpp-acl:mixed-acl\",\n \"name\" : \"acl6\"\n }\n ]\n}",
- "folder": "c05d7211-11b0-5688-2079-afa51196045c"
- },
- {
- "id": "4442a2fd-497d-ee8d-22cd-43b72c358f67",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/local0/v3po:ietf-acl",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1472215679330,
- "name": "Disable ACLs on local0",
- "description": "Disables all ACLs assigned to local0 interface.\n\nTo verify, invoke:\n\nvppctl show classify table verbose\n\nand:\n\nvppctl show inacl type l2\n\nvppctl show inacl type ip4\n\nvppctl show inacl type ip6",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "",
- "folder": "c05d7211-11b0-5688-2079-afa51196045c"
- },
- {
- "id": "161987f9-8912-f724-2f2d-d7548b12e8f9",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-access-control-list:access-lists/acl/ietf-access-control-list:eth-acl/acl1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1471942346155,
- "name": "Delete acl1 list",
- "description": "Removes acl1 list from config data tree.\nRequest fails if acl1 is assigned to some interface",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "",
- "folder": "c05d7211-11b0-5688-2079-afa51196045c"
- },
- {
- "id": "d265bf51-6e6d-7087-5b55-b6afde56c325",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1464804333865,
- "name": "Enable GigabitEthernet0/9/0.1 interface - cfg",
- "description": "Enables GigabitEthernet0/9/0.1 sub interface. Equivalent vppctl command:\n\nvppctl set in state GigabitEthernet0/9/0.1 up\n\nTo enable sub interface, super interface should be enabled first.\n\nTo verify invoke:\n\nvppctl show int",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "1ea15402-cdce-9573-f746-fc9256e18e53",
- "rawModeData": "{\r\n \"sub-interface\": [\r\n {\r\n \"identifier\": \"1\",\r\n \"vlan-type\": \"802dot1q\",\r\n \"tags\": {\r\n \"tag\": [\r\n {\r\n \"index\": \"0\",\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:s-vlan\",\r\n \"vlan-id\": \"100\"\r\n }\r\n },\r\n {\r\n \"index\": \"1\",\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:c-vlan\",\r\n \"vlan-id\": \"any\"\r\n }\r\n }\r\n ]\r\n },\r\n \"match\": {\r\n \"vlan-tagged\": {\r\n \"match-exact-tags\": \"true\"\r\n }\r\n },\r\n \"enabled\": \"true\"\r\n }\r\n ]\r\n}"
- },
- {
- "id": "e1bd94dd-ed59-9a39-9997-916c4f9a207e",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/vpp-classifier:vpp-classifier/classify-table/table0/classify-session/00:00:00:00:00:00:01:02:03:04:05:06:00:00:00:00",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1468493546163,
- "name": "Add classify session",
- "description": "Adds classify session to table0. Corresponding vpp cli command:\n\nvppctl classify session acl-hit-next deny opaque-index 0 table-index 0 match l2 src 01:02:03:04:05:06\n\nTo verify invoke:\n\nvppctl sh class table verbose",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "d47d6b3b-4c3f-7671-5bba-447d6c59ea3b",
- "rawModeData": "{\n \"classify-session\": [\n {\n \"hit_next\": \"deny\",\n \"match\": \"00:00:00:00:00:00:01:02:03:04:05:06:00:00:00:00\"\n }\n ]\n}"
- },
- {
- "id": "e332c510-7523-f788-3670-dc801b10d391",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/vpp-classifier:vpp-classifier-state/",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1467377066230,
- "name": "Get classify tables - oper",
- "description": "Shows classify tables configured in the VPP.\n\nCorresponds to:\n\nvppctl sh class table verbose",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "d47d6b3b-4c3f-7671-5bba-447d6c59ea3b",
- "rawModeData": ""
- },
- {
- "id": "e3dab7db-c96e-1462-ff59-2c69471fa5f3",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1/l2/rewrite",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1464805111410,
- "name": "Enable tag-rewrite pop 1 - cfg",
- "description": "Enables tag-rewrite pop 1 operation for GigabitEthernet0/9/0.1 sub-interface. Corresponsing vpp cli command:\n\nvppctl set interface l2 tag-rewrite GigabitEthernet0/9/0.1 pop 1\n\nTo verify run:\n./build-root/install-vpp-native/vpp-api-test/bin/vpp_api_test json\nand invoke:\n\n#vat sw_interface_dump\n\nor if sub-interface was added to bridge domain:\n\nvppctl show bridge-domain [bd_id] detail",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "1ea15402-cdce-9573-f746-fc9256e18e53",
- "rawModeData": "{\r\n \"rewrite\": {\r\n \"pop-tags\": \"1\"\r\n }\r\n}"
- },
- {
- "id": "e59e4c3d-e2d9-7124-3d94-6fe77b88e8ec",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/vpp-classifier:vpp-classifier/",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1467377260818,
- "name": "Get classify tables - cfg",
- "description": "Shows classify table configuration.",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "d47d6b3b-4c3f-7671-5bba-447d6c59ea3b",
- "rawModeData": ""
- },
- {
- "id": "ed295c83-ac16-df21-9ac5-7176369736d9",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/operational/vpp-classifier:vpp-classifier-state/classify-table/table0",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "GET",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1467378420028,
- "name": "Get classify table - oper",
- "description": "Shows classify table 0 operational state.\n\nCorresponds to:\n\nvat# classify_table_info table_id 0",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "d47d6b3b-4c3f-7671-5bba-447d6c59ea3b",
- "rawModeData": ""
- },
- {
- "id": "f42817ab-a13f-b9ec-50aa-ed037c6b03be",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/greTun1",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "DELETE",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1469159546949,
- "name": "Delete gre ifc - cfg",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "",
- "folder": "2e489b42-8432-15f1-f4bc-859c34a3c570"
- },
- {
- "id": "f71aac57-d1b8-0ece-7e2c-47b94ee0ffe0",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1/l2",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1464813539029,
- "name": "Add sub interface to bridge-domain",
- "description": "Adds sub interface to bridge domain. Corresponsing vpp cli command:\n\nvppctl set interface l2 bridge GigabitEthernet0/9/0.1 1 1\n\nTo verify invoke:\nvppctl show bridge-domain 1 detail",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "folder": "1ea15402-cdce-9573-f746-fc9256e18e53",
- "rawModeData": "{\r\n \"l2\": {\r\n \"bridge-domain\": \"testBD\",\r\n \"split-horizon-group\": 1,\r\n \"bridged-virtual-interface\": \"false\"\r\n }\r\n}"
- },
- {
- "id": "fc8daee5-81f4-ef32-9d05-a2a5a24b3d8e",
- "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
- "url": "http://localhost:8183/restconf/config/ietf-interfaces:interfaces/interface/tapp2",
- "preRequestScript": "",
- "pathVariables": {},
- "method": "PUT",
- "data": [],
- "dataMode": "raw",
- "version": 2,
- "tests": "",
- "currentHelper": "normal",
- "helperAttributes": {},
- "time": 1462796801468,
- "name": "Modify complex tap ifc - cfg",
- "description": "",
- "collectionId": "5bad4634-e5cf-900e-9733-0976aa9bea64",
- "responses": [],
- "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"tapp2\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:tap\",\r\n \"tap\" :{\r\n \"tap-name\" : \"tapp2\",\r\n \"mac\" : \"00:ff:ff:ff:ff:ae\",\r\n \"device-instance\" : 77\r\n }\r\n }\r\n ]\r\n \r\n}",
- "folder": "ebed4cf3-96db-7ea3-1216-a0802c8f47d3"
- }
- ]
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/asciidoc/Readme.adoc b/v3po/v3po2vpp/asciidoc/Readme.adoc
deleted file mode 100644
index d9fb563ab..000000000
--- a/v3po/v3po2vpp/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,103 +0,0 @@
-= Honeycomb translation layer SPI implementation for VPP CORE
-
-Provides customizers for VPP YANG models translation.
-
-== Handlers
-
-=== Writers
-Current order of v3po-api writers is:
-
-. BridgeDomain
-. VhostUser
-. VxlanGpe
-. Tap
-. Vxlan
-. Interface
-. SubInterface
-. L2
-. Subinterface-L2
-. Ethernet
-. Routing
-. ClassifyTable
-. ClassifySession
-. Acl
-. Ipv6
-. Ipv4
-. Address
-. Neighbor
-. L2FibEntry
-. Rewrite
-. Address
-. Acl
-
-To find out current order in runtime, turn on logging for writer registry:
-
- log:set TRACE io.fd.honeycomb.v3po.translate.util.write.registry
-
-=== Readers
-There is not a strict order for readers, but current configuration produces approx. this order:
-
-Contexts
-. VppState
-. Version
-. BridgeDomains
-. BridgeDomain
-. L2FibTable
-. L2FibEntry
-. InterfacesState
-. Interface
-. VppInterfaceStateAugmentation
-. Ethernet
-. Tap
-. VhostUser
-. Vxlan
-. VxlanGpe
-. L2
-. Acl
-. Interface2
-. Ipv4
-. Address
-. Neighbor
-. Ipv6
-. SubinterfaceStateAugmentation
-. SubInterfaces
-. SubInterface
-. L2
-. Rewrite
-. Ipv4
-. Address
-. Acl
-. VppClassifierState
-. ClassifyTable
-. ClassifySession
-. NetconfState
-
-== VPP to IETF-ACL model translation
-
-Package provides VPP translation code for draft-ietf-netmod-acl-model-08.
-Access control lists are mapped to chains of classify tables, each with single classify session.
-
-=== Available operations
-
-==== Configuration data
-Configuration data for the model is stored in Honeycomb. Corresponding classify tables and sessions
-are not created until control access list is assigned to an interface.
-
-Classify tables and sessions are removed from VPP when ACL assignment is deleted.
-
-ACLs can be shared among interfaces, but each time, new instance of classify table chain would be created in VPP.
-
-ACLs that are assigned to an interface have to be unassigned before update/removal.
-
-==== Operational state
-Operational read in terms of ietf-acl model is not supported (would require storing additional metadata in vpp).
-As a consequence, configuration data initialization based on operational state is not possible.
-
-To check how ietf-acl model was translated to classify tables/session, low-level vpp-classfier model can be used.
-
-=== Restrictions
-
-VPP classfier works in form of offsets and masks of 16B units.
-The offset always starts at the beginning of L2 Ethernet header
-of input packet. Because IP header can have variable length,
-source/destination port matching (L4 features of ietf-acl model) is not possible. \ No newline at end of file
diff --git a/v3po/v3po2vpp/pom.xml b/v3po/v3po2vpp/pom.xml
deleted file mode 100644
index 79f1d6650..000000000
--- a/v3po/v3po2vpp/pom.xml
+++ /dev/null
@@ -1,122 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-impl-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../../vpp-common/vpp-impl-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.v3po</groupId>
- <artifactId>v3po2vpp</artifactId>
- <name>${project.artifactId}</name>
- <version>1.16.12-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <dependencies>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>translate-spi</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>notification-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>translate-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-translate-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>v3po-api</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>translate-impl</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>cfg-init</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.vpp</groupId>
- <artifactId>jvpp-core</artifactId>
- </dependency>
-
- <!-- DI -->
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- </dependency>
- <dependency>
- <groupId>net.jmob</groupId>
- <artifactId>guice.conf</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-multibindings</artifactId>
- </dependency>
-
- <!-- Testing Dependencies -->
- <dependency>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-translate-test</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.skinny-framework</groupId>
- <artifactId>skinny-logback</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-testlib</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-all</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/AclWriterFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/AclWriterFactory.java
deleted file mode 100644
index 23fc2e314..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/AclWriterFactory.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.translate.v3po;
-
-import static io.fd.honeycomb.translate.v3po.InterfacesWriterFactory.IETF_ACL_ID;
-import static io.fd.honeycomb.translate.v3po.SubinterfaceAugmentationWriterFactory.SUBIF_IETF_ACL_ID;
-
-import com.google.common.collect.Sets;
-import io.fd.honeycomb.translate.impl.write.GenericListWriter;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.IetfAclWriter;
-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.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.AccessLists;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.Acl;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.AccessListEntries;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.Ace;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.Actions;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.Matches;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.acl.transport.header.fields.DestinationPortRange;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.acl.transport.header.fields.SourcePortRange;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public final class AclWriterFactory implements WriterFactory {
-
- public static final InstanceIdentifier<Acl> ACL_ID =
- InstanceIdentifier.create(AccessLists.class).child(Acl.class);
-
- @Override
- public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
-
- final InstanceIdentifier<Acl> aclIdRelative = InstanceIdentifier.create(Acl.class);
-
- final InstanceIdentifier<Ace> aceId = aclIdRelative.child(AccessListEntries.class).child(Ace.class);
- final InstanceIdentifier<Actions> actionsId = aceId.child(Actions.class);
- final InstanceIdentifier<Matches> matchesId = aceId.child(Matches.class);
- final InstanceIdentifier<SourcePortRange> srcPortId = matchesId.child((Class)SourcePortRange.class);
- final InstanceIdentifier<DestinationPortRange> dstPortId = matchesId.child((Class)DestinationPortRange.class);
-
- registry.subtreeAddBefore(Sets.newHashSet(aceId, actionsId, matchesId, srcPortId, dstPortId),
- new GenericListWriter<>(ACL_ID, new IetfAclWriter()),
- Sets.newHashSet(IETF_ACL_ID, SUBIF_IETF_ACL_ID));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/DisabledInterfacesManager.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/DisabledInterfacesManager.java
deleted file mode 100644
index 9772923c3..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/DisabledInterfacesManager.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.translate.v3po;
-
-import com.google.common.base.Optional;
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
-import io.fd.honeycomb.translate.util.read.BindingBrokerReader;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-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.opendaylight.params.xml.ns.yang.v3po.context.rev160909.DisabledInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.context.rev160909.DisabledInterfacesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.context.rev160909.disabled.interfaces.DisabledInterfaceIndex;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.context.rev160909.disabled.interfaces.DisabledInterfaceIndexBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.context.rev160909.disabled.interfaces.DisabledInterfaceIndexKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-
-/**
- * Facade on top of {@link MappingContext} making access to {@link DisabledInterfaces} easier.
- */
-public class DisabledInterfacesManager {
-
- private static final InstanceIdentifier<DisabledInterfaces>
- DISABLED_IFCS_ROOT = InstanceIdentifier.create(DisabledInterfaces.class);
-
- /**
- * Read the list of currently disabled interfaces.
- */
- public List<Integer> getDisabledInterfaces(@Nonnull final MappingContext ctx) {
- final Optional<DisabledInterfaces> read = ctx.read(DISABLED_IFCS_ROOT);
- if (read.isPresent()) {
- return read.get().getDisabledInterfaceIndex().stream()
- .map(DisabledInterfaceIndex::getIndex)
- .collect(Collectors.toList());
- } else {
- return Collections.emptyList();
- }
- }
-
- /**
- * Check whether a specific interface is disabled.
- */
- public boolean isInterfaceDisabled(final int index, @Nonnull final MappingContext ctx) {
- return ctx.read(getKeyedId(index))
- .isPresent();
- }
-
- /**
- * Make a specific interface disabled.
- */
- public void disableInterface(final int index, @Nonnull final MappingContext ctx) {
- ctx.put(getKeyedId(index), getDisabledInterfaceIndex(index));
- }
-
- /**
- * Remove interface disability.
- */
- public void removeDisabledInterface(final int index, @Nonnull final MappingContext ctx) {
- ctx.delete(getKeyedId(index));
- }
-
- private static DisabledInterfaceIndex getDisabledInterfaceIndex(final int index) {
- return new DisabledInterfaceIndexBuilder().setIndex(index).build();
- }
-
- private static KeyedInstanceIdentifier<DisabledInterfaceIndex, DisabledInterfaceIndexKey> getKeyedId(final int id) {
- return DISABLED_IFCS_ROOT.child(DisabledInterfaceIndex.class, new DisabledInterfaceIndexKey(id));
- }
-
- public static final class ContextsReaderFactory implements ReaderFactory {
-
- @Inject
- @Named("honeycomb-context")
- private DataBroker contextBindingBrokerDependency;
-
- @Override
- public void init(final ModifiableReaderRegistryBuilder registry) {
- registry.add(new BindingBrokerReader<>(DISABLED_IFCS_ROOT,
- contextBindingBrokerDependency,
- LogicalDatastoreType.OPERATIONAL, DisabledInterfacesBuilder.class));
- }
- }
-
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/EgressIetfAClWriterProvider.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/EgressIetfAClWriterProvider.java
deleted file mode 100644
index f14900f03..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/EgressIetfAClWriterProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.translate.v3po;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.common.AclTableContextManagerImpl;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.egress.EgressIetfAclWriter;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.MappingTable;
-
-class EgressIetfAClWriterProvider implements Provider<EgressIetfAclWriter> {
-
- private final FutureJVppCore jvpp;
-
- @Inject
- public EgressIetfAClWriterProvider(final FutureJVppCore jvpp) {
- this.jvpp = jvpp;
- }
-
- @Override
- public EgressIetfAclWriter get() {
- return new EgressIetfAclWriter(jvpp, new AclTableContextManagerImpl(MappingTable.Direction.Egress));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/IngressIetfAClWriterProvider.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/IngressIetfAClWriterProvider.java
deleted file mode 100644
index 5d97f41ae..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/IngressIetfAClWriterProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.translate.v3po;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.common.AclTableContextManagerImpl;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.ingress.IngressIetfAclWriter;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.MappingTable;
-
-class IngressIetfAClWriterProvider implements Provider<IngressIetfAclWriter> {
-
- private final FutureJVppCore jvpp;
-
- @Inject
- public IngressIetfAClWriterProvider(final FutureJVppCore jvpp) {
- this.jvpp = jvpp;
- }
-
- @Override
- public IngressIetfAclWriter get() {
- return new IngressIetfAclWriter(jvpp, new AclTableContextManagerImpl(MappingTable.Direction.Ingress));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesStateReaderFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesStateReaderFactory.java
deleted file mode 100644
index 82909e228..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesStateReaderFactory.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * 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.translate.v3po;
-
-import com.google.common.collect.Sets;
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import io.fd.honeycomb.translate.impl.read.GenericInitListReader;
-import io.fd.honeycomb.translate.impl.read.GenericInitReader;
-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.v3po.interfacesstate.EthernetCustomizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.GreCustomizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.InterfaceCustomizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.L2Customizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.ProxyArpCustomizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.TapCustomizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.VhostUserCustomizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.VxlanCustomizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.VxlanGpeCustomizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.acl.ingress.AclCustomizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.ip.Ipv4AddressCustomizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.ip.Ipv4Customizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.ip.Ipv4NeighbourCustomizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.ip.Ipv6Customizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.pbb.PbbRewriteStateCustomizer;
-import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv6;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Neighbor;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.AclBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Ethernet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Gre;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.L2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.ProxyArp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Tap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.VhostUser;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Vxlan;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.VxlanGpe;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.acl.Ingress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip4Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip6Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.L2Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.PbbRewriteStateInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.PbbRewriteStateInterfaceAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.interfaces.state._interface.PbbRewriteState;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public final class InterfacesStateReaderFactory implements ReaderFactory {
-
- private final NamingContext ifcNamingCtx;
- private final NamingContext bdNamingCtx;
- private final VppClassifierContextManager classifyContext;
- private final DisabledInterfacesManager ifcDisableContext;
- private final FutureJVppCore jvpp;
-
- static final InstanceIdentifier<InterfacesState> IFC_STATE_ID =
- InstanceIdentifier.create(InterfacesState.class);
- static final InstanceIdentifier<Interface> IFC_ID = IFC_STATE_ID.child(Interface.class);
-
- @Inject
- public InterfacesStateReaderFactory(final FutureJVppCore jvpp,
- @Named("interface-context") final NamingContext ifcNamingCtx,
- @Named("bridge-domain-context") final NamingContext bdNamingCtx,
- @Named("classify-table-context") final VppClassifierContextManager classifyContext,
- final DisabledInterfacesManager ifcDisableContext) {
- this.jvpp = jvpp;
- this.ifcNamingCtx = ifcNamingCtx;
- this.bdNamingCtx = bdNamingCtx;
- this.classifyContext = classifyContext;
- this.ifcDisableContext = ifcDisableContext;
- }
-
- @Override
- public void init(final ModifiableReaderRegistryBuilder registry) {
- // InterfacesState(Structural)
- registry.addStructuralReader(IFC_STATE_ID, InterfacesStateBuilder.class);
- // Interface
- registry.add(new GenericInitListReader<>(IFC_ID, new InterfaceCustomizer(jvpp, ifcNamingCtx, ifcDisableContext)));
-
- // v3po.yang
- initVppIfcAugmentationReaders(registry, IFC_ID);
- // ietf-ip.yang
- initInterface2AugmentationReaders(registry, IFC_ID);
- // vpp-vlan.yang
- new SubinterfaceStateAugmentationReaderFactory(jvpp, ifcNamingCtx, bdNamingCtx, classifyContext).init(registry);
- //vpp-pbb.yang
- initPbbRewriteAugmentation(registry, IFC_ID);
- }
-
- private void initInterface2AugmentationReaders(final ModifiableReaderRegistryBuilder registry,
- final InstanceIdentifier<Interface> ifcId) {
- // Interface2Augmentation(Structural)
- final InstanceIdentifier<Interface2> ifc2AugId = ifcId.augmentation(Interface2.class);
- registry.addStructuralReader(ifc2AugId, Interface2Builder.class);
- // Ipv4
- final InstanceIdentifier<Ipv4> ipv4Id = ifc2AugId.child(Ipv4.class);
- registry.add(new GenericReader<>(ipv4Id, new Ipv4Customizer(jvpp)));
- // Address
- final InstanceIdentifier<Address> ipv4AddrId = ipv4Id.child(Address.class);
- registry.add(new GenericInitListReader<>(ipv4AddrId, new Ipv4AddressCustomizer(jvpp, ifcNamingCtx)));
- // Neighbor
- final InstanceIdentifier<Neighbor> neighborId = ipv4Id.child(Neighbor.class);
- registry.add(new GenericListReader<>(neighborId, new Ipv4NeighbourCustomizer(jvpp)));
- // Ipv6
- final InstanceIdentifier<Ipv6> ipv6Id = ifc2AugId.child(Ipv6.class);
- registry.add(new GenericReader<>(ipv6Id, new Ipv6Customizer(jvpp, ifcNamingCtx)));
- }
-
- private void initVppIfcAugmentationReaders(final ModifiableReaderRegistryBuilder registry,
- final InstanceIdentifier<Interface> ifcId) {
- // VppInterfaceStateAugmentation
- final InstanceIdentifier<VppInterfaceStateAugmentation> vppIfcAugId =
- ifcId.augmentation(VppInterfaceStateAugmentation.class);
- registry.addStructuralReader(vppIfcAugId, VppInterfaceStateAugmentationBuilder.class);
- // Ethernet
- registry.add(new GenericInitReader<>(vppIfcAugId.child(Ethernet.class),
- new EthernetCustomizer(jvpp, ifcNamingCtx)));
- // Tap
- registry.add(new GenericInitReader<>(vppIfcAugId.child(Tap.class), new TapCustomizer(jvpp, ifcNamingCtx)));
- // VhostUser
- registry.add(new GenericInitReader<>(vppIfcAugId.child(VhostUser.class),
- new VhostUserCustomizer(jvpp, ifcNamingCtx)));
- // Vxlan
- registry.add(new GenericInitReader<>(vppIfcAugId.child(Vxlan.class), new VxlanCustomizer(jvpp, ifcNamingCtx)));
- // VxlanGpe
- registry.add(new GenericInitReader<>(vppIfcAugId.child(VxlanGpe.class),
- new VxlanGpeCustomizer(jvpp, ifcNamingCtx)));
- // Gre
- registry.add(new GenericInitReader<>(vppIfcAugId.child(Gre.class), new GreCustomizer(jvpp, ifcNamingCtx)));
- // L2
- registry.add(new GenericInitReader<>(vppIfcAugId.child(L2.class),
- new L2Customizer(jvpp, ifcNamingCtx, bdNamingCtx)));
-
- // Acl(Structural)
- final InstanceIdentifier<Acl> aclIid = vppIfcAugId.child(Acl.class);
- registry.addStructuralReader(aclIid, AclBuilder.class);
- // Ingress(Subtree)
- final InstanceIdentifier<Ingress> ingressIdRelative = InstanceIdentifier.create(Ingress.class);
- registry.subtreeAdd(
- Sets.newHashSet(ingressIdRelative.child(L2Acl.class), ingressIdRelative.child(Ip4Acl.class),
- ingressIdRelative.child(Ip6Acl.class)),
- new GenericInitReader<>(aclIid.child(Ingress.class),
- new AclCustomizer(jvpp, ifcNamingCtx, classifyContext)));
-
- // Proxy ARP
- registry.add(new GenericReader<>(vppIfcAugId.child(ProxyArp.class), new ProxyArpCustomizer(jvpp,
- ifcNamingCtx)));
- }
-
- private void initPbbRewriteAugmentation(final ModifiableReaderRegistryBuilder registry,
- final InstanceIdentifier<Interface> ifcId) {
- registry.addStructuralReader(ifcId.augmentation(PbbRewriteStateInterfaceAugmentation.class),
- PbbRewriteStateInterfaceAugmentationBuilder.class);
-
- registry.add(new GenericReader<>(ifcId.augmentation(PbbRewriteStateInterfaceAugmentation.class).child(
- PbbRewriteState.class), new PbbRewriteStateCustomizer(jvpp)));
- }
-
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesWriterFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesWriterFactory.java
deleted file mode 100644
index 7bf5a432c..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesWriterFactory.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * 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.translate.v3po;
-
-import static io.fd.honeycomb.translate.v3po.VppClassifierHoneycombWriterFactory.CLASSIFY_SESSION_ID;
-import static io.fd.honeycomb.translate.v3po.VppClassifierHoneycombWriterFactory.CLASSIFY_TABLE_ID;
-
-import com.google.common.collect.Sets;
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import io.fd.honeycomb.translate.impl.write.GenericListWriter;
-import io.fd.honeycomb.translate.impl.write.GenericWriter;
-import io.fd.honeycomb.translate.v3po.interfaces.EthernetCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.GreCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.InterfaceCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.L2Customizer;
-import io.fd.honeycomb.translate.v3po.interfaces.LoopbackCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.ProxyArpCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.RoutingCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.TapCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.VhostUserCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.VxlanCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.VxlanGpeCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.egress.EgressIetfAclWriter;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.ingress.AclCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.ingress.IetfAclCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.ingress.IngressIetfAclWriter;
-import io.fd.honeycomb.translate.v3po.interfaces.ip.Ipv4AddressCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.ip.Ipv4Customizer;
-import io.fd.honeycomb.translate.v3po.interfaces.ip.Ipv4NeighbourCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.ip.Ipv6Customizer;
-import io.fd.honeycomb.translate.v3po.interfaces.pbb.PbbRewriteCustomizer;
-import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
-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 java.util.Set;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface1;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv6;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Neighbor;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Ethernet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Gre;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.IetfAcl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.L2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Loopback;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ProxyArp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Routing;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Tap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VhostUser;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Vxlan;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VxlanGpe;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.acl.Ingress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip4Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip6Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.L2Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessLists;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.PbbRewriteInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.interfaces._interface.PbbRewrite;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public final class InterfacesWriterFactory implements WriterFactory {
-
- public static final InstanceIdentifier<Interface> IFC_ID =
- InstanceIdentifier.create(Interfaces.class).child(Interface.class);
- public static final InstanceIdentifier<VppInterfaceAugmentation> VPP_IFC_AUG_ID =
- IFC_ID.augmentation(VppInterfaceAugmentation.class);
- public static final InstanceIdentifier<Acl> ACL_ID = VPP_IFC_AUG_ID.child(Acl.class);
- public static final InstanceIdentifier<Ingress> INGRESS_ACL_ID = ACL_ID.child(Ingress.class);
- public static final InstanceIdentifier<L2> L2_ID = VPP_IFC_AUG_ID.child(L2.class);
- public static final InstanceIdentifier<IetfAcl> IETF_ACL_ID = VPP_IFC_AUG_ID.child(IetfAcl.class);
- public static final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Ingress>
- INGRESS_IETF_ACL_ID = IETF_ACL_ID.child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Ingress.class);
- public static final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Egress>
- EGRESS_IETF_ACL_ID = IETF_ACL_ID.child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Egress.class);
-
- private final FutureJVppCore jvpp;
- private final IngressIetfAclWriter ingressAclWriter;
- private final EgressIetfAclWriter egressAclWriter;
- private final NamingContext bdNamingContext;
- private final NamingContext ifcNamingContext;
- private final VppClassifierContextManager classifyTableContext;
- private final DisabledInterfacesManager ifcDisableContext;
-
- @Inject
- public InterfacesWriterFactory(final FutureJVppCore vppJvppIfcDependency,
- final IngressIetfAclWriter ingressAclWriter,
- final EgressIetfAclWriter egressAclWriter,
- @Named("bridge-domain-context") final NamingContext bridgeDomainContextDependency,
- @Named("interface-context") final NamingContext interfaceContextDependency,
- @Named("classify-table-context") final VppClassifierContextManager classifyTableContext,
- final DisabledInterfacesManager ifcDisableContext) {
- this.jvpp = vppJvppIfcDependency;
- this.ingressAclWriter = ingressAclWriter;
- this.egressAclWriter = egressAclWriter;
- this.bdNamingContext = bridgeDomainContextDependency;
- this.ifcNamingContext = interfaceContextDependency;
- this.ifcDisableContext = ifcDisableContext;
- this.classifyTableContext = classifyTableContext;
- }
-
- @Override
- public void init(final ModifiableWriterRegistryBuilder registry) {
- // Interfaces
- // Interface =
- registry.add(new GenericListWriter<>(IFC_ID, new InterfaceCustomizer(jvpp, ifcNamingContext)));
- // VppInterfaceAugmentation
- addVppInterfaceAgmentationWriters(IFC_ID, registry);
- // Interface1 (ietf-ip augmentation)
- addInterface1AugmentationWriters(IFC_ID, registry);
- // SubinterfaceAugmentation
- new SubinterfaceAugmentationWriterFactory(jvpp, ingressAclWriter, egressAclWriter, ifcNamingContext, bdNamingContext,
- classifyTableContext).init(registry);
-
- addPbbAugmentationWriters(IFC_ID, registry);
- }
-
- private void addInterface1AugmentationWriters(final InstanceIdentifier<Interface> ifcId,
- final ModifiableWriterRegistryBuilder registry) {
- final InstanceIdentifier<Interface1> ifc1AugId = ifcId.augmentation(Interface1.class);
- // Ipv6(after interface) =
- registry.addAfter(new GenericWriter<>(ifc1AugId.child(Ipv6.class), new Ipv6Customizer(jvpp)),
- ifcId);
- // Ipv4(after interface)
- final InstanceIdentifier<Ipv4> ipv4Id = ifc1AugId.child(Ipv4.class);
- registry.addAfter(new GenericWriter<>(ipv4Id, new Ipv4Customizer(jvpp)),
- ifcId);
- // Address(after Ipv4) =
- final InstanceIdentifier<Address> ipv4AddressId = ipv4Id.child(Address.class);
- registry.addAfter(new GenericListWriter<>(ipv4AddressId, new Ipv4AddressCustomizer(jvpp, ifcNamingContext)),
- ipv4Id);
- // Neighbor(after ipv4Address)
- registry.addAfter(new GenericListWriter<>(ipv4Id.child(Neighbor.class), new Ipv4NeighbourCustomizer(jvpp,
- ifcNamingContext)),
- ipv4AddressId);
- }
-
- private void addVppInterfaceAgmentationWriters(final InstanceIdentifier<Interface> ifcId,
- final ModifiableWriterRegistryBuilder registry) {
- // VhostUser(Needs to be executed before Interface customizer) =
- final InstanceIdentifier<VhostUser> vhostId = VPP_IFC_AUG_ID.child(VhostUser.class);
- registry.addBefore(new GenericWriter<>(vhostId, new VhostUserCustomizer(jvpp, ifcNamingContext)),
- ifcId);
- // Vxlan(Needs to be executed before Interface customizer) =
- final InstanceIdentifier<Vxlan> vxlanId = VPP_IFC_AUG_ID.child(Vxlan.class);
- registry.addBefore(new GenericWriter<>(vxlanId, new VxlanCustomizer(jvpp, ifcNamingContext, ifcDisableContext)),
- ifcId);
- // VxlanGpe(Needs to be executed before Interface customizer) =
- final InstanceIdentifier<VxlanGpe> vxlanGpeId = VPP_IFC_AUG_ID.child(VxlanGpe.class);
- registry.addBefore(new GenericWriter<>(vxlanGpeId,
- new VxlanGpeCustomizer(jvpp, ifcNamingContext, ifcDisableContext)), ifcId);
- // Tap(Needs to be executed before Interface customizer) =
- final InstanceIdentifier<Tap> tapId = VPP_IFC_AUG_ID.child(Tap.class);
- registry.addBefore(new GenericWriter<>(tapId, new TapCustomizer(jvpp, ifcNamingContext)),
- ifcId);
- // Loopback(Needs to be executed before Interface customizer) =
- final InstanceIdentifier<Loopback> loopbackId = VPP_IFC_AUG_ID.child(Loopback.class);
- registry.addBefore(new GenericWriter<>(loopbackId, new LoopbackCustomizer(jvpp, ifcNamingContext)),
- ifcId);
-
- // Gre(Needs to be executed before Interface customizer) =
- final InstanceIdentifier<Gre> greId = VPP_IFC_AUG_ID.child(Gre.class);
- registry.addBefore(new GenericWriter<>(greId, new GreCustomizer(jvpp, ifcNamingContext)),
- ifcId);
-
-
- final Set<InstanceIdentifier<?>> specificIfcTypes = Sets.newHashSet(vhostId, vxlanGpeId, vxlanGpeId, tapId);
-
- // Ethernet =
- registry.add(new GenericWriter<>(VPP_IFC_AUG_ID.child(Ethernet.class), new EthernetCustomizer(jvpp)));
- // Routing(Execute only after specific interface customizers) =
- registry.addAfter(
- new GenericWriter<>(VPP_IFC_AUG_ID.child(Routing.class), new RoutingCustomizer(jvpp, ifcNamingContext)),
- specificIfcTypes);
- // L2(Execute only after subinterface (and all other ifc types) =
- registry.addAfter(new GenericWriter<>(L2_ID, new L2Customizer(jvpp, ifcNamingContext, bdNamingContext)),
- SubinterfaceAugmentationWriterFactory.SUB_IFC_ID);
- // Proxy Arp (execute after specific interface customizers)
- registry.addAfter(
- new GenericWriter<>(VPP_IFC_AUG_ID.child(ProxyArp.class), new ProxyArpCustomizer(jvpp)),
- specificIfcTypes);
- // Ingress (execute after classify table and session writers)
- // also handles L2Acl, Ip4Acl and Ip6Acl:
- final InstanceIdentifier<Ingress> ingressId = InstanceIdentifier.create(Ingress.class);
- registry
- .subtreeAddAfter(
- Sets.newHashSet(ingressId.child(L2Acl.class), ingressId.child(Ip4Acl.class),
- ingressId.child(Ip6Acl.class)),
- new GenericWriter<>(INGRESS_ACL_ID,
- new AclCustomizer(jvpp, ifcNamingContext, classifyTableContext)),
- Sets.newHashSet(CLASSIFY_TABLE_ID, CLASSIFY_SESSION_ID));
-
- // Ingress IETF-ACL, also handles AccessLists and Acl:
- final InstanceIdentifier<AccessLists> accessListsIdIngress = InstanceIdentifier.create(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Ingress.class)
- .child(AccessLists.class);
- final InstanceIdentifier<?> aclIdIngress = accessListsIdIngress.child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.access.lists.Acl.class);
- registry.subtreeAdd(
- Sets.newHashSet(accessListsIdIngress, aclIdIngress),
- new GenericWriter<>(INGRESS_IETF_ACL_ID, new IetfAclCustomizer(ingressAclWriter, ifcNamingContext)));
-
- // Ingress IETF-ACL, also handles AccessLists and Acl:
- final InstanceIdentifier<AccessLists> accessListsIdEgress = InstanceIdentifier.create(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Egress.class)
- .child(AccessLists.class);
- final InstanceIdentifier<?> aclIdEgress = accessListsIdEgress.child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.access.lists.Acl.class);
- registry.subtreeAdd(
- Sets.newHashSet(accessListsIdEgress, aclIdEgress),
- new GenericWriter<>(EGRESS_IETF_ACL_ID,
- new io.fd.honeycomb.translate.v3po.interfaces.acl.egress.IetfAclCustomizer(egressAclWriter,
- ifcNamingContext)));
- }
-
- private void addPbbAugmentationWriters(final InstanceIdentifier<Interface> ifcId,
- final ModifiableWriterRegistryBuilder registry) {
- final InstanceIdentifier<PbbRewrite> pbbRewriteId =
- ifcId.augmentation(PbbRewriteInterfaceAugmentation.class).child(PbbRewrite.class);
-
- registry.add(new GenericWriter<>(pbbRewriteId, new PbbRewriteCustomizer(jvpp, ifcNamingContext)));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/SubinterfaceAugmentationWriterFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/SubinterfaceAugmentationWriterFactory.java
deleted file mode 100644
index 1ef8b3865..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/SubinterfaceAugmentationWriterFactory.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * 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.translate.v3po;
-
-import static io.fd.honeycomb.translate.v3po.VppClassifierHoneycombWriterFactory.CLASSIFY_SESSION_ID;
-import static io.fd.honeycomb.translate.v3po.VppClassifierHoneycombWriterFactory.CLASSIFY_TABLE_ID;
-
-import com.google.common.collect.Sets;
-import io.fd.honeycomb.translate.impl.write.GenericListWriter;
-import io.fd.honeycomb.translate.impl.write.GenericWriter;
-import io.fd.honeycomb.translate.v3po.interfaces.RewriteCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.SubInterfaceCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.SubInterfaceL2Customizer;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.egress.EgressIetfAclWriter;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.ingress.IngressIetfAclWriter;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.ingress.SubInterfaceAclCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.ingress.SubInterfaceIetfAclCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.ip.SubInterfaceIpv4AddressCustomizer;
-import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
-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 org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.or.any.Dot1qTag;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip4Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip6Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.L2Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessLists;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.SubInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.match.attributes.match.type.vlan.tagged.VlanTagged;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.IetfAcl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.L2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Match;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Tags;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.acl.Ingress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.l2.Rewrite;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.tags.Tag;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.tag.rewrite.PushTags;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public final class SubinterfaceAugmentationWriterFactory implements WriterFactory {
-
- private final FutureJVppCore jvpp;
- private final IngressIetfAclWriter ingressAclWriter;
- private final EgressIetfAclWriter egressAclWriter;
- private final NamingContext ifcContext;
- private final NamingContext bdContext;
- private final VppClassifierContextManager classifyTableContext;
-
- public static final InstanceIdentifier<SubinterfaceAugmentation> SUB_IFC_AUG_ID =
- InterfacesWriterFactory.IFC_ID.augmentation(SubinterfaceAugmentation.class);
- public static final InstanceIdentifier<SubInterface> SUB_IFC_ID =
- SUB_IFC_AUG_ID.child(SubInterfaces.class).child(SubInterface.class);
- public static final InstanceIdentifier<L2> L2_ID = SUB_IFC_ID.child(
- L2.class);
- public static final InstanceIdentifier<Acl> SUBIF_ACL_ID = SUB_IFC_ID.child(Acl.class);
- public static final InstanceIdentifier<Ingress> SUBIF_INGRESS_ACL_ID = SUBIF_ACL_ID.child(Ingress.class);
- public static final InstanceIdentifier<IetfAcl> SUBIF_IETF_ACL_ID = SUB_IFC_ID.child(IetfAcl.class);
- public static final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.Ingress> SUBIF_INGRESS_IETF_ACL_ID = SUBIF_IETF_ACL_ID.child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.Ingress.class);
- public static final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.Egress> SUBIF_EGRESS_IETF_ACL_ID = SUBIF_IETF_ACL_ID.child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.Egress.class);
-
- public SubinterfaceAugmentationWriterFactory(final FutureJVppCore jvpp,
- final IngressIetfAclWriter ingressAclWriter,
- final EgressIetfAclWriter egressAclWriter,
- final NamingContext ifcContext, final NamingContext bdContext, final VppClassifierContextManager classifyTableContext) {
- this.jvpp = jvpp;
- this.ingressAclWriter = ingressAclWriter;
- this.egressAclWriter = egressAclWriter;
- this.ifcContext = ifcContext;
- this.bdContext = bdContext;
- this.classifyTableContext = classifyTableContext;
- }
-
- @Override
- public void init(final ModifiableWriterRegistryBuilder registry) {
- // Subinterfaces
- // Subinterface(Handle only after all interface related stuff gets processed) =
- registry.subtreeAddAfter(
- // TODO HONEYCOMB-188 this customizer covers quite a lot of complex child nodes (maybe refactor ?)
- Sets.newHashSet(
- InstanceIdentifier.create(SubInterface.class).child(Tags.class),
- InstanceIdentifier.create(SubInterface.class).child(Tags.class).child(Tag.class),
- InstanceIdentifier.create(SubInterface.class).child(Tags.class).child(Tag.class).child(
- Dot1qTag.class),
- InstanceIdentifier.create(SubInterface.class).child(Match.class),
- InstanceIdentifier.create(SubInterface.class).child(Match.class).child(VlanTagged.class)),
- new GenericListWriter<>(SUB_IFC_ID, new SubInterfaceCustomizer(jvpp, ifcContext)),
- InterfacesWriterFactory.IFC_ID);
- // L2 =
- registry.addAfter(new GenericWriter<>(L2_ID, new SubInterfaceL2Customizer(jvpp, ifcContext, bdContext)),
- SUB_IFC_ID);
- // Rewrite(also handles pushTags + pushTags/dot1qtag) =
- final InstanceIdentifier<Rewrite> rewriteId = L2_ID.child(Rewrite.class);
- registry.subtreeAddAfter(
- Sets.newHashSet(
- InstanceIdentifier.create(Rewrite.class).child(PushTags.class),
- InstanceIdentifier.create(Rewrite.class).child(PushTags.class)
- .child(org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.Dot1qTag.class)),
- new GenericWriter<>(rewriteId, new RewriteCustomizer(jvpp, ifcContext)),
- L2_ID);
- // Ipv4(handled after L2 and L2/rewrite is done) =
- final InstanceIdentifier<Address> ipv4SubifcAddressId = SUB_IFC_ID.child(Ipv4.class).child(Address.class);
- registry.addAfter(new GenericListWriter<>(ipv4SubifcAddressId,
- new SubInterfaceIpv4AddressCustomizer(jvpp, ifcContext)),
- rewriteId);
-
- // Ingress (execute after classify table and session writers)
- // also handles L2Acl, Ip4Acl and Ip6Acl:
- final InstanceIdentifier<Ingress> aclId = InstanceIdentifier.create(Ingress.class);
- registry
- .subtreeAddAfter(
- Sets.newHashSet(aclId.child(L2Acl.class), aclId.child(Ip4Acl.class), aclId.child(Ip6Acl.class)),
- new GenericWriter<>(SUBIF_INGRESS_ACL_ID, new SubInterfaceAclCustomizer(jvpp, ifcContext, classifyTableContext)),
- Sets.newHashSet(CLASSIFY_TABLE_ID, CLASSIFY_SESSION_ID));
-
- // Ingress IETF-ACL, also handles AccessLists and Acl:
- final InstanceIdentifier<AccessLists> accessListsIdIngress = InstanceIdentifier.create(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.Ingress.class)
- .child(AccessLists.class);
- final InstanceIdentifier<?> aclIdIngress = accessListsIdIngress.child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.access.lists.Acl.class);
- registry.subtreeAdd(
- Sets.newHashSet(accessListsIdIngress, aclIdIngress),
- new GenericWriter<>(SUBIF_INGRESS_IETF_ACL_ID, new SubInterfaceIetfAclCustomizer(ingressAclWriter, ifcContext)));
-
- // Egress IETF-ACL, also handles AccessLists and Acl:
- final InstanceIdentifier<AccessLists> accessListsIdEgress = InstanceIdentifier.create(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.Egress.class)
- .child(AccessLists.class);
- final InstanceIdentifier<?> aclIdEgress = accessListsIdEgress.child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.access.lists.Acl.class);
- registry.subtreeAdd(
- Sets.newHashSet(accessListsIdEgress, aclIdEgress),
- new GenericWriter<>(SUBIF_EGRESS_IETF_ACL_ID, new io.fd.honeycomb.translate.v3po.interfaces.acl.egress.SubInterfaceIetfAclCustomizer(
- egressAclWriter, ifcContext)));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/SubinterfaceStateAugmentationReaderFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/SubinterfaceStateAugmentationReaderFactory.java
deleted file mode 100644
index ee943bff8..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/SubinterfaceStateAugmentationReaderFactory.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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.translate.v3po;
-
-import com.google.common.collect.Sets;
-import io.fd.honeycomb.translate.impl.read.GenericInitListReader;
-import io.fd.honeycomb.translate.impl.read.GenericInitReader;
-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.v3po.interfacesstate.RewriteCustomizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.SubInterfaceCustomizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.SubInterfaceL2Customizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.acl.ingress.SubInterfaceAclCustomizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.ip.SubInterfaceIpv4AddressCustomizer;
-import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.or.any.Dot1qTag;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip4Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip6Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.L2Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceStateAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceStateAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.SubInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.SubInterfacesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.match.attributes.match.type.vlan.tagged.VlanTagged;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.AclBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.L2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Match;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Tags;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.acl.Ingress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.l2.Rewrite;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.tags.Tag;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.tag.rewrite.PushTags;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-final class SubinterfaceStateAugmentationReaderFactory implements ReaderFactory {
-
- private final FutureJVppCore jvpp;
- private final NamingContext ifcCtx;
- private final NamingContext bdCtx;
- private final VppClassifierContextManager classifyCtx;
-
- SubinterfaceStateAugmentationReaderFactory(final FutureJVppCore jvpp, final NamingContext ifcCtx,
- final NamingContext bdCtx,
- final VppClassifierContextManager classifyCtx) {
- this.jvpp = jvpp;
- this.ifcCtx = ifcCtx;
- this.bdCtx = bdCtx;
- this.classifyCtx = classifyCtx;
- }
-
- @Override
- public void init(final ModifiableReaderRegistryBuilder registry) {
- // SubinterfaceStateAugmentation(Structural)
- final InstanceIdentifier<SubinterfaceStateAugmentation> subIfcAugId =
- InterfacesStateReaderFactory.IFC_ID.augmentation(SubinterfaceStateAugmentation.class);
- registry.addStructuralReader(subIfcAugId, SubinterfaceStateAugmentationBuilder.class);
- // SubInterfaces(Structural)
- final InstanceIdentifier<SubInterfaces> subIfcsId = subIfcAugId.child(SubInterfaces.class);
- registry.addStructuralReader(subIfcsId, SubInterfacesBuilder.class);
- // SubInterface(Subtree)
- final InstanceIdentifier<SubInterface> subIfcId = subIfcsId.child(SubInterface.class);
- registry.subtreeAdd(Sets.newHashSet(
- InstanceIdentifier.create(SubInterface.class).child(Tags.class),
- InstanceIdentifier.create(SubInterface.class).child(Tags.class).child(Tag.class),
- InstanceIdentifier.create(SubInterface.class).child(Tags.class).child(Tag.class).child(Dot1qTag.class),
- InstanceIdentifier.create(SubInterface.class).child(Match.class),
- InstanceIdentifier.create(SubInterface.class).child(Match.class).child(VlanTagged.class)),
- new GenericInitListReader<>(subIfcId, new SubInterfaceCustomizer(jvpp, ifcCtx)));
- // L2
- final InstanceIdentifier<L2> l2Id = subIfcId.child(L2.class);
- registry.add(new GenericInitReader<>(l2Id, new SubInterfaceL2Customizer(jvpp, ifcCtx, bdCtx)));
- // Rewrite(Subtree)
- registry.subtreeAdd(Sets.newHashSet(
- InstanceIdentifier.create(Rewrite.class).child(PushTags.class),
- InstanceIdentifier.create(Rewrite.class).child(PushTags.class)
- .child(
- org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.Dot1qTag.class)),
- new GenericReader<>(l2Id.child(Rewrite.class), new RewriteCustomizer(jvpp, ifcCtx)));
- // Ipv4(Structural)
- final InstanceIdentifier<Ipv4> ipv4Id = subIfcId.child(Ipv4.class);
- registry.addStructuralReader(ipv4Id, Ipv4Builder.class);
- // Address
- registry.add(
- new GenericInitListReader<>(ipv4Id.child(Address.class), new SubInterfaceIpv4AddressCustomizer(jvpp, ifcCtx)));
- // Acl(Structural)
- final InstanceIdentifier<Acl> aclIid = subIfcId.child(Acl.class);
- registry.addStructuralReader(aclIid, AclBuilder.class);
- // Ingress(Subtree)
- final InstanceIdentifier<Ingress> ingressIdRelative = InstanceIdentifier.create(Ingress.class);
- registry.subtreeAdd(
- Sets.newHashSet(ingressIdRelative.child(L2Acl.class), ingressIdRelative.child(Ip4Acl.class),
- ingressIdRelative.child(Ip6Acl.class)),
- new GenericInitReader<>(aclIid.child(Ingress.class),
- new SubInterfaceAclCustomizer(jvpp, ifcCtx, classifyCtx)));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/V3poModule.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/V3poModule.java
deleted file mode 100644
index d1bf234a3..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/V3poModule.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.translate.v3po;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.multibindings.Multibinder;
-import com.google.inject.name.Names;
-import io.fd.honeycomb.notification.ManagedNotificationProducer;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.v3po.cfgattrs.V3poConfiguration;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.egress.EgressIetfAclWriter;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.ingress.IngressIetfAclWriter;
-import io.fd.honeycomb.translate.v3po.notification.InterfaceChangeNotificationProducer;
-import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
-import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManagerImpl;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import net.jmob.guice.conf.core.ConfigurationModule;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class V3poModule extends AbstractModule {
-
- private static final Logger LOG = LoggerFactory.getLogger(V3poModule.class);
-
- @Override
- protected void configure() {
- LOG.debug("Installing V3PO module");
- install(ConfigurationModule.create());
- requestInjection(V3poConfiguration.class);
-
- // TODO HONEYCOMB-173 put into constants
- // Naming contexts
- bind(NamingContext.class)
- .annotatedWith(Names.named("interface-context"))
- .toInstance(new NamingContext("interface-", "interface-context"));
- bind(NamingContext.class)
- .annotatedWith(Names.named("bridge-domain-context"))
- .toInstance(new NamingContext("bridge-domain-", "bridge-domain-context"));
- bind(VppClassifierContextManager.class)
- .annotatedWith(Names.named("classify-table-context"))
- .toInstance(new VppClassifierContextManagerImpl("classify-table-"));
-
- // Executor needed for keepalives
- bind(ScheduledExecutorService.class).toInstance(Executors.newScheduledThreadPool(1));
-
- // Utils
- bind(IngressIetfAclWriter.class).toProvider(IngressIetfAClWriterProvider.class);
- bind(EgressIetfAclWriter.class).toProvider(EgressIetfAClWriterProvider.class);
- // Context utility for deleted interfaces
- bind(DisabledInterfacesManager.class).toInstance(new DisabledInterfacesManager());
-
- // Readers
- final Multibinder<ReaderFactory> readerFactoryBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class);
- readerFactoryBinder.addBinding().to(InterfacesStateReaderFactory.class);
- readerFactoryBinder.addBinding().to(VppStateHoneycombReaderFactory.class);
- readerFactoryBinder.addBinding().to(VppClassifierReaderFactory.class);
- // Expose disabled interfaces in operational data
- readerFactoryBinder.addBinding().to(DisabledInterfacesManager.ContextsReaderFactory.class);
- // Expose vpp-classfier-context interfaces in operational data
- readerFactoryBinder.addBinding().to(VppClassifierContextManagerImpl.ContextsReaderFactory.class);
-
- // Writers
- final Multibinder<WriterFactory> writerFactoryBinder = Multibinder.newSetBinder(binder(), WriterFactory.class);
- writerFactoryBinder.addBinding().to(InterfacesWriterFactory.class);
- writerFactoryBinder.addBinding().to(VppHoneycombWriterFactory.class);
- writerFactoryBinder.addBinding().to(VppClassifierHoneycombWriterFactory.class);
- writerFactoryBinder.addBinding().to(AclWriterFactory.class);
-
- // Notifications
- final Multibinder<ManagedNotificationProducer> notifiersBinder =
- Multibinder.newSetBinder(binder(), ManagedNotificationProducer.class);
- notifiersBinder.addBinding().to(InterfaceChangeNotificationProducer.class);
- LOG.info("Module V3PO successfully configured");
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppClassifierHoneycombWriterFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppClassifierHoneycombWriterFactory.java
deleted file mode 100644
index 66cd13244..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppClassifierHoneycombWriterFactory.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.translate.v3po;
-
-import static io.fd.honeycomb.translate.v3po.InterfacesWriterFactory.ACL_ID;
-
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import io.fd.honeycomb.translate.impl.write.GenericListWriter;
-import io.fd.honeycomb.translate.v3po.vppclassifier.ClassifySessionWriter;
-import io.fd.honeycomb.translate.v3po.vppclassifier.ClassifyTableWriter;
-import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
-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.vpp.classifier.rev161214.VppClassifier;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.classify.table.base.attributes.ClassifySession;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.ClassifyTable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-public final class VppClassifierHoneycombWriterFactory implements WriterFactory {
-
- public static final InstanceIdentifier<ClassifyTable> CLASSIFY_TABLE_ID =
- InstanceIdentifier.create(VppClassifier.class).child(ClassifyTable.class);
-
- public static final InstanceIdentifier<ClassifySession> CLASSIFY_SESSION_ID =
- CLASSIFY_TABLE_ID.child(ClassifySession.class);
-
- private final FutureJVppCore jvpp;
- private final VppClassifierContextManager classifyTableContext;
-
- @Inject
- public VppClassifierHoneycombWriterFactory(@Nonnull final FutureJVppCore jvpp,
- @Named("classify-table-context") @Nonnull final VppClassifierContextManager classifyTableContext) {
- this.jvpp = jvpp;
- this.classifyTableContext = classifyTableContext;
- }
-
- @Override
- public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
- // Ordering here is: First create table, then create sessions and then assign as ACL
- // ClassifyTable
- registry.addBefore(
- new GenericListWriter<>(CLASSIFY_TABLE_ID, new ClassifyTableWriter(jvpp, classifyTableContext)),
- CLASSIFY_SESSION_ID);
- // ClassifyTableSession
- registry.addBefore(
- new GenericListWriter<>(CLASSIFY_SESSION_ID, new ClassifySessionWriter(jvpp, classifyTableContext)),
- ACL_ID);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppClassifierReaderFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppClassifierReaderFactory.java
deleted file mode 100644
index b7a67c853..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppClassifierReaderFactory.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.translate.v3po;
-
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import io.fd.honeycomb.translate.impl.read.GenericInitListReader;
-import io.fd.honeycomb.translate.impl.read.GenericListReader;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
-import io.fd.honeycomb.translate.v3po.vppclassifier.ClassifySessionReader;
-import io.fd.honeycomb.translate.v3po.vppclassifier.ClassifyTableReader;
-import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppClassifierState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppClassifierStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.classify.table.base.attributes.ClassifySession;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.state.ClassifyTable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public final class VppClassifierReaderFactory implements ReaderFactory {
-
- private final FutureJVppCore jvpp;
- private final VppClassifierContextManager classifyCtx;
-
- @Inject
- public VppClassifierReaderFactory(final FutureJVppCore jvpp,
- @Named("classify-table-context") final VppClassifierContextManager classifyCtx) {
- this.jvpp = jvpp;
- this.classifyCtx = classifyCtx;
- }
-
- @Override
- public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
- // VppClassifierState
- final InstanceIdentifier<VppClassifierState> vppStateId = InstanceIdentifier.create(VppClassifierState.class);
- registry.addStructuralReader(vppStateId, VppClassifierStateBuilder.class);
- // ClassifyTable
- final InstanceIdentifier<ClassifyTable> classTblId = vppStateId.child(ClassifyTable.class);
- registry.add(new GenericInitListReader<>(classTblId, new ClassifyTableReader(jvpp, classifyCtx)));
- // ClassifySession
- final InstanceIdentifier<ClassifySession> classSesId = classTblId.child(ClassifySession.class);
- registry.add(new GenericListReader<>(classSesId, new ClassifySessionReader(jvpp, classifyCtx)));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppHoneycombWriterFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppHoneycombWriterFactory.java
deleted file mode 100644
index 7a59eede8..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppHoneycombWriterFactory.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.translate.v3po;
-
-import static io.fd.honeycomb.translate.v3po.InterfacesWriterFactory.L2_ID;
-
-import com.google.common.collect.Sets;
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import io.fd.honeycomb.translate.impl.write.GenericListWriter;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.v3po.vpp.ArpTerminationTableEntryCustomizer;
-import io.fd.honeycomb.translate.v3po.vpp.BridgeDomainCustomizer;
-import io.fd.honeycomb.translate.v3po.vpp.L2FibEntryCustomizer;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.Vpp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domain.attributes.ArpTerminationTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domain.attributes.arp.termination.table.ArpTerminationTableEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.L2FibTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.BridgeDomains;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-public final class VppHoneycombWriterFactory implements WriterFactory {
-
- private final FutureJVppCore jvpp;
- private final NamingContext bdContext;
- private final NamingContext ifcContext;
-
- @Inject
- public VppHoneycombWriterFactory(final FutureJVppCore vppJvppWriterDependency,
- @Named("bridge-domain-context") final NamingContext bridgeDomainContextVppDependency,
- @Named("interface-context") final NamingContext interfaceContextVppDependency) {
- this.jvpp = vppJvppWriterDependency;
- this.bdContext = bridgeDomainContextVppDependency;
- this.ifcContext = interfaceContextVppDependency;
- }
-
- @Override
- public void init(final ModifiableWriterRegistryBuilder registry) {
- // Vpp has no handlers
- // BridgeDomains has no handlers
- // BridgeDomain =
- final InstanceIdentifier<BridgeDomain> bdId =
- InstanceIdentifier.create(Vpp.class).child(BridgeDomains.class).child(BridgeDomain.class);
- registry.add(new GenericListWriter<>(bdId, new BridgeDomainCustomizer(jvpp, bdContext)));
- // L2FibTable has no handlers
- // L2FibEntry(handled after BridgeDomain and L2 of ifc and subifc) =
- final InstanceIdentifier<L2FibEntry> l2FibEntryId = bdId.child(L2FibTable.class).child(L2FibEntry.class);
- registry.addAfter(
- new GenericListWriter<>(l2FibEntryId, new L2FibEntryCustomizer(jvpp, bdContext, ifcContext)),
- Sets.newHashSet(
- bdId,
- L2_ID,
- SubinterfaceAugmentationWriterFactory.L2_ID));
- // ArpTerminationTable has no handlers
- // ArpTerminationTableEntry(handled after BridgeDomain) =
- final InstanceIdentifier<ArpTerminationTableEntry> arpEntryId =
- bdId.child(ArpTerminationTable.class).child(ArpTerminationTableEntry.class);
- registry.addAfter(
- new GenericListWriter<>(arpEntryId, new ArpTerminationTableEntryCustomizer(jvpp, bdContext)),
- bdId);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppStateHoneycombReaderFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppStateHoneycombReaderFactory.java
deleted file mode 100644
index 67c435b16..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppStateHoneycombReaderFactory.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.translate.v3po;
-
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import io.fd.honeycomb.translate.impl.read.GenericInitListReader;
-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.util.read.KeepaliveReaderWrapper;
-import io.fd.honeycomb.translate.v3po.vppstate.BridgeDomainCustomizer;
-import io.fd.honeycomb.translate.v3po.vppstate.L2FibEntryCustomizer;
-import io.fd.honeycomb.translate.v3po.vppstate.VersionCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.ReadTimeoutException;
-import io.fd.honeycomb.translate.vpp.util.VppStatusListener;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.concurrent.ScheduledExecutorService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.L2FibTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.L2FibTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.BridgeDomains;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.BridgeDomainsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.Version;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomain;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public final class VppStateHoneycombReaderFactory implements ReaderFactory {
-
- private final FutureJVppCore jVpp;
- private final NamingContext ifcCtx;
- private final NamingContext bdCtx;
- private final ScheduledExecutorService keepaliveExecutor;
- private final VppStatusListener vppStatusListener;
-
- @Inject
- public VppStateHoneycombReaderFactory(final FutureJVppCore jVpp,
- @Named("interface-context") final NamingContext ifcCtx,
- @Named("bridge-domain-context") final NamingContext bdCtx,
- final ScheduledExecutorService keepaliveExecutorDependency,
- final VppStatusListener vppStatusListener) {
- this.jVpp = jVpp;
- this.ifcCtx = ifcCtx;
- this.bdCtx = bdCtx;
- this.keepaliveExecutor = keepaliveExecutorDependency;
- this.vppStatusListener = vppStatusListener;
- }
-
- @Override
- public void init(final ModifiableReaderRegistryBuilder registry) {
- // VppState(Structural)
- final InstanceIdentifier<VppState> vppStateId = InstanceIdentifier.create(VppState.class);
- registry.addStructuralReader(vppStateId, VppStateBuilder.class);
- // Version
- // Wrap with keepalive reader to detect connection issues
- // Relying on VersionCustomizer to provide a "timing out read"
- registry.add(new KeepaliveReaderWrapper<>(
- new GenericReader<>(vppStateId.child(Version.class), new VersionCustomizer(jVpp)),
- keepaliveExecutor, ReadTimeoutException.class, 30, vppStatusListener));
- // BridgeDomains(Structural)
- final InstanceIdentifier<BridgeDomains> bridgeDomainsId = vppStateId.child(BridgeDomains.class);
- registry.addStructuralReader(bridgeDomainsId, BridgeDomainsBuilder.class);
- // BridgeDomain
- final InstanceIdentifier<BridgeDomain> bridgeDomainId = bridgeDomainsId.child(BridgeDomain.class);
- registry.add(new GenericInitListReader<>(bridgeDomainId, new BridgeDomainCustomizer(jVpp, bdCtx)));
- // L2FibTable(Structural)
- final InstanceIdentifier<L2FibTable> l2FibTableId = bridgeDomainId.child(L2FibTable.class);
- registry.addStructuralReader(l2FibTableId, L2FibTableBuilder.class);
- // L2FibEntry
- registry.add(new GenericInitListReader<>(l2FibTableId.child(L2FibEntry.class),
- new L2FibEntryCustomizer(jVpp, bdCtx, ifcCtx)));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/cfgattrs/V3poConfiguration.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/cfgattrs/V3poConfiguration.java
deleted file mode 100644
index 9cf5b4d5d..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/cfgattrs/V3poConfiguration.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.translate.v3po.cfgattrs;
-
-import net.jmob.guice.conf.core.BindConfig;
-import net.jmob.guice.conf.core.Syntax;
-
-@BindConfig(value = "v3po", syntax = Syntax.JSON)
-public class V3poConfiguration {
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/EthernetCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/EthernetCustomizer.java
deleted file mode 100644
index 856366f2b..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/EthernetCustomizer.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-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 javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Ethernet;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class EthernetCustomizer extends FutureJVppCustomizer implements WriterCustomizer<Ethernet> {
-
- private static final Logger LOG = LoggerFactory.getLogger(EthernetCustomizer.class);
-
- public EthernetCustomizer(final FutureJVppCore vppApi) {
- super(vppApi);
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Ethernet> id,
- @Nonnull final Ethernet dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- LOG.warn("Unsupported, ignoring configuration {}", dataAfter);
- // VPP API does not support setting MTU
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Ethernet> id,
- @Nonnull final Ethernet dataBefore, @Nonnull final Ethernet dataAfter,
- @Nonnull final WriteContext writeContext) {
- LOG.warn("Unsupported, ignoring configuration {}", dataAfter);
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Ethernet> id,
- @Nonnull final Ethernet dataBefore, @Nonnull final WriteContext writeContext) {
- LOG.warn("Unsupported, ignoring configuration delete {}", id);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/GreCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/GreCustomizer.java
deleted file mode 100644
index 146d97c5c..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/GreCustomizer.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (c) 2016 Intel 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.translate.v3po.interfaces;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import com.google.common.net.InetAddresses;
-import io.fd.honeycomb.translate.vpp.util.AbstractInterfaceTypeCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-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.core.dto.GreAddDelTunnel;
-import io.fd.vpp.jvpp.core.dto.GreAddDelTunnelReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.net.InetAddress;
-import java.util.concurrent.CompletionStage;
-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.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.GreTunnel;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Gre;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GreCustomizer extends AbstractInterfaceTypeCustomizer<Gre> implements JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(GreCustomizer.class);
- private final NamingContext interfaceContext;
-
- public GreCustomizer(final FutureJVppCore vppApi, final NamingContext interfaceContext) {
- super(vppApi);
- this.interfaceContext = interfaceContext;
- }
-
- private static GreAddDelTunnel getGreTunnelRequest(final byte isAdd, final byte[] srcAddr, final byte[] dstAddr,
- final int outerFibId, final byte isIpv6) {
- final GreAddDelTunnel greAddDelTunnel = new GreAddDelTunnel();
- greAddDelTunnel.isAdd = isAdd;
- greAddDelTunnel.srcAddress = srcAddr;
- greAddDelTunnel.dstAddress = dstAddr;
- greAddDelTunnel.outerFibId = outerFibId;
- greAddDelTunnel.isIpv6 = isIpv6;
- return greAddDelTunnel;
- }
-
- @Override
- protected Class<? extends InterfaceType> getExpectedInterfaceType() {
- return GreTunnel.class;
- }
-
- @Override
- protected final void writeInterface(@Nonnull final InstanceIdentifier<Gre> id, @Nonnull final Gre dataAfter,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String swIfName = id.firstKeyOf(Interface.class).getName();
-
- createGreTunnel(id, swIfName, dataAfter, writeContext);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Gre> id, @Nonnull final Gre dataBefore,
- @Nonnull final Gre dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException.UpdateFailedException {
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter,
- new UnsupportedOperationException("Gre tunnel update is not supported"));
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Gre> id, @Nonnull final Gre dataBefore,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String swIfName = id.firstKeyOf(Interface.class).getName();
- deleteGreTunnel(id, swIfName, dataBefore, writeContext);
- }
-
- private void createGreTunnel(final InstanceIdentifier<Gre> id, final String swIfName, final Gre gre,
- final WriteContext writeContext) throws WriteFailedException {
- final byte isIpv6 = (byte) (isIpv6(gre)
- ? 1
- : 0);
- final InetAddress srcAddress = InetAddresses.forString(getAddressString(gre.getSrc()));
- final InetAddress dstAddress = InetAddresses.forString(getAddressString(gre.getDst()));
-
- int outerFibId = gre.getOuterFibId().intValue();
-
- LOG.debug("Setting gre tunnel for interface: {}. Gre: {}", swIfName, gre);
- final CompletionStage<GreAddDelTunnelReply> greAddDelTunnelReplyCompletionStage =
- getFutureJVpp().greAddDelTunnel(getGreTunnelRequest((byte) 1 /* is add */, srcAddress.getAddress(),
- dstAddress.getAddress(), outerFibId, isIpv6));
-
- final GreAddDelTunnelReply reply =
- getReplyForCreate(greAddDelTunnelReplyCompletionStage.toCompletableFuture(), id, gre);
- LOG.debug("Gre tunnel set successfully for: {}, gre: {}", swIfName, gre);
- if (interfaceContext.containsName(reply.swIfIndex, writeContext.getMappingContext())) {
- // VPP keeps gre tunnels present even after they are delete(reserving ID for next tunnel)
- // This may cause inconsistencies in mapping context when configuring tunnels like this:
- // 1. Add tunnel 2. Delete tunnel 3. Read interfaces (reserved mapping e.g. gre_tunnel0 -> 6
- // will get into mapping context) 4. Add tunnel (this will add another mapping with the same
- // reserved ID and context is invalid)
- // That's why a check has to be performed here removing mapping gre_tunnel0 -> 6 mapping and storing
- // new name for that ID
- final String formerName = interfaceContext.getName(reply.swIfIndex, writeContext.getMappingContext());
- LOG.debug("Removing updated mapping of a gre tunnel, id: {}, former name: {}, new name: {}",
- reply.swIfIndex, formerName, swIfName);
- interfaceContext.removeName(formerName, writeContext.getMappingContext());
- }
- // Add new interface to our interface context
- interfaceContext.addName(reply.swIfIndex, swIfName, writeContext.getMappingContext());
- }
-
- private boolean isIpv6(final Gre gre) {
- if (gre.getSrc().getIpv4Address() == null) {
- checkArgument(gre.getDst().getIpv4Address() == null, "Inconsistent ip addresses: %s, %s", gre.getSrc(),
- gre.getDst());
- return true;
- } else {
- checkArgument(gre.getDst().getIpv6Address() == null, "Inconsistent ip addresses: %s, %s", gre.getSrc(),
- gre.getDst());
- return false;
- }
- }
-
- private String getAddressString(final IpAddress addr) {
- return addr.getIpv4Address() == null
- ? addr.getIpv6Address().getValue()
- : addr.getIpv4Address().getValue();
- }
-
- private void deleteGreTunnel(final InstanceIdentifier<Gre> id, final String swIfName, final Gre gre,
- final WriteContext writeContext) throws WriteFailedException {
- final byte isIpv6 = (byte) (isIpv6(gre)
- ? 1
- : 0);
- final InetAddress srcAddress = InetAddresses.forString(getAddressString(gre.getSrc()));
- final InetAddress dstAddress = InetAddresses.forString(getAddressString(gre.getDst()));
-
- int outerFibId = gre.getOuterFibId().intValue();
-
- LOG.debug("Deleting gre tunnel for interface: {}. Gre: {}", swIfName, gre);
- final CompletionStage<GreAddDelTunnelReply> greAddDelTunnelReplyCompletionStage =
- getFutureJVpp().greAddDelTunnel(getGreTunnelRequest((byte) 0 /* is add */, srcAddress.getAddress(),
- dstAddress.getAddress(), outerFibId, isIpv6));
-
- getReplyForDelete(greAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
- LOG.debug("Gre tunnel deleted successfully for: {}, gre: {}", swIfName, gre);
- // Remove interface from our interface context
- interfaceContext.removeName(swIfName, writeContext.getMappingContext());
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterconnectionWriteUtils.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterconnectionWriteUtils.java
deleted file mode 100644
index 7d2d28c90..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterconnectionWriteUtils.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static java.util.Objects.requireNonNull;
-
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-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.core.dto.SwInterfaceSetL2Bridge;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetL2BridgeReply;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetL2Xconnect;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetL2XconnectReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.Interconnection;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.interconnection.BridgeBased;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.interconnection.XconnectBased;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Utility class providing Interconnection CUD support.
- */
-final class InterconnectionWriteUtils implements JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(InterconnectionWriteUtils.class);
-
- private final FutureJVppCore futureJVppCore;
- private final NamingContext interfaceContext;
- private final NamingContext bridgeDomainContext;
-
- InterconnectionWriteUtils(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext bridgeDomainContext) {
- this.futureJVppCore = requireNonNull(futureJVppCore, "futureJVppCore should not be null");
- this.interfaceContext = requireNonNull(interfaceContext, "interfaceContext should not be null");
- this.bridgeDomainContext = requireNonNull(bridgeDomainContext, "bridgeDomainContext should not be null");
- }
-
- void setInterconnection(final InstanceIdentifier<? extends DataObject> id, final int swIfIndex,
- final String ifcName, final Interconnection ic, final WriteContext writeContext)
- throws WriteFailedException {
-
- if (ic == null) { // TODO in case of update we should delete interconnection
- LOG.trace("Interconnection is not set. Skipping");
- } else if (ic instanceof XconnectBased) {
- setXconnectBasedL2(id, swIfIndex, ifcName, (XconnectBased) ic, writeContext, (byte) 1 /*enable*/);
- } else if (ic instanceof BridgeBased) {
- setBridgeBasedL2(id, swIfIndex, ifcName, (BridgeBased) ic, writeContext, (byte) 1 /*enable*/);
- } else {
- // Choices&cases are not data objects, so they cannot have a dedicated Reader/Writer
- // This choice is already from augment, so its not possible to augment augmented choice
- LOG.error("Unable to handle Interconnection of type {}", ic.getClass());
- throw new WriteFailedException(id, "Unable to handle Interconnection of type " + ic.getClass());
- }
- }
-
- void deleteInterconnection(final InstanceIdentifier<? extends DataObject> id, final int swIfIndex,
- final String ifcName, final Interconnection ic, final WriteContext writeContext)
- throws WriteFailedException {
-
- if (ic == null) { // TODO in case of update we should delete interconnection
- LOG.trace("Interconnection is not set. Skipping");
- } else if (ic instanceof XconnectBased) {
- setXconnectBasedL2(id, swIfIndex, ifcName, (XconnectBased) ic, writeContext, (byte) 0 /*disable*/);
- } else if (ic instanceof BridgeBased) {
- setBridgeBasedL2(id, swIfIndex, ifcName, (BridgeBased) ic, writeContext, (byte) 0 /*disable*/);
- } else {
- LOG.error("Unable to delete Interconnection of type {}", ic.getClass());
- throw new WriteFailedException(id, "Unable to delete Interconnection of type " + ic.getClass());
- }
- }
-
- private void setBridgeBasedL2(final InstanceIdentifier<? extends DataObject> id, final int swIfIndex,
- final String ifcName, final BridgeBased bb,
- final WriteContext writeContext, final byte enabled) throws WriteFailedException {
- LOG.debug("Setting bridge based interconnection(bridge-domain={}) for interface: {}", bb.getBridgeDomain(),
- ifcName);
-
- String bdName = bb.getBridgeDomain();
-
- int bdId = bridgeDomainContext.getIndex(bdName, writeContext.getMappingContext());
- checkArgument(bdId > 0, "Unable to set Interconnection for Interface: %s, bridge domain: %s does not exist",
- ifcName, bdName);
-
- byte bvi = bb.isBridgedVirtualInterface()
- ? (byte) 1
- : (byte) 0;
- byte shg = 0;
- if (bb.getSplitHorizonGroup() != null) {
- shg = bb.getSplitHorizonGroup().byteValue();
- }
-
- final CompletionStage<SwInterfaceSetL2BridgeReply> swInterfaceSetL2BridgeReplyCompletionStage = futureJVppCore
- .swInterfaceSetL2Bridge(getL2BridgeRequest(swIfIndex, bdId, shg, bvi, enabled));
- getReplyForWrite(swInterfaceSetL2BridgeReplyCompletionStage.toCompletableFuture(), id);
-
- LOG.debug("Bridge based interconnection updated successfully for: {}, interconnection: {}", ifcName, bb);
- }
-
- private SwInterfaceSetL2Bridge getL2BridgeRequest(final int swIfIndex, final int bdId, final byte shg,
- final byte bvi, final byte enabled) {
- final SwInterfaceSetL2Bridge swInterfaceSetL2Bridge = new SwInterfaceSetL2Bridge();
- swInterfaceSetL2Bridge.rxSwIfIndex = swIfIndex;
- swInterfaceSetL2Bridge.bdId = bdId;
- swInterfaceSetL2Bridge.shg = shg;
- swInterfaceSetL2Bridge.bvi = bvi;
- swInterfaceSetL2Bridge.enable = enabled;
- return swInterfaceSetL2Bridge;
- }
-
- private void setXconnectBasedL2(final InstanceIdentifier<? extends DataObject> id, final int swIfIndex,
- final String ifcName, final XconnectBased ic,
- final WriteContext writeContext, final byte enabled) throws WriteFailedException {
- String outSwIfName = ic.getXconnectOutgoingInterface();
- LOG.debug("Setting xconnect based interconnection(outgoing ifc={}) for interface: {}", outSwIfName, ifcName);
-
- int outSwIfIndex = interfaceContext.getIndex(outSwIfName, writeContext.getMappingContext());
- checkArgument(outSwIfIndex > 0,
- "Unable to set Interconnection for Interface: %s, outgoing interface: %s does not exist",
- ifcName, outSwIfIndex);
-
- final CompletionStage<SwInterfaceSetL2XconnectReply> swInterfaceSetL2XconnectReplyCompletionStage =
- futureJVppCore
- .swInterfaceSetL2Xconnect(getL2XConnectRequest(swIfIndex, outSwIfIndex, enabled));
- getReplyForWrite(swInterfaceSetL2XconnectReplyCompletionStage.toCompletableFuture(), id);
- LOG.debug("Xconnect based interconnection updated successfully for: {}, interconnection: {}", ifcName, ic);
- }
-
- private SwInterfaceSetL2Xconnect getL2XConnectRequest(final int rxIfc, final int txIfc,
- final byte enabled) {
-
- final SwInterfaceSetL2Xconnect swInterfaceSetL2Xconnect = new SwInterfaceSetL2Xconnect();
- swInterfaceSetL2Xconnect.enable = enabled;
- swInterfaceSetL2Xconnect.rxSwIfIndex = rxIfc;
- swInterfaceSetL2Xconnect.txSwIfIndex = txIfc;
- return swInterfaceSetL2Xconnect;
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceCustomizer.java
deleted file mode 100644
index 17b48f628..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceCustomizer.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-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.core.dto.SwInterfaceSetFlags;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Ietf interface write customizer that only caches interface objects for child writers
- */
-public class InterfaceCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<Interface, InterfaceKey>, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(InterfaceCustomizer.class);
- private final NamingContext interfaceContext;
-
- public InterfaceCustomizer(final FutureJVppCore vppApi, final NamingContext interfaceContext) {
- super(vppApi);
- this.interfaceContext = interfaceContext;
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Interface> id,
- @Nonnull final Interface dataAfter,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
-
- setInterface(id, dataAfter, writeContext);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Interface> id,
- @Nonnull final Interface dataBefore,
- @Nonnull final Interface dataAfter,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- updateInterface(id, dataBefore, dataAfter, writeContext);
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Interface> id,
- @Nonnull final Interface dataBefore,
- @Nonnull final WriteContext writeContext) {
- // Nothing to be done here, customizers for specific interface types e.g. vxlan handle the delete
- }
-
- private void setInterface(final InstanceIdentifier<Interface> id, final Interface swIf,
- final WriteContext writeContext) throws WriteFailedException {
- LOG.debug("Setting interface: {} to: {}", id, swIf);
- setInterfaceAttributes(id, swIf, swIf.getName(), writeContext);
- }
-
- private void setInterfaceAttributes(final InstanceIdentifier<Interface> id, final Interface swIf,
- final String swIfName, final WriteContext writeContext)
- throws WriteFailedException {
-
- setInterfaceFlags(id, swIfName, interfaceContext.getIndex(swIfName, writeContext.getMappingContext()),
- swIf.isEnabled()
- ? (byte) 1
- : (byte) 0);
- }
-
- private void updateInterface(final InstanceIdentifier<Interface> id,
- final Interface dataBefore,
- final Interface dataAfter, final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("Updating interface:{} to: {}", id, dataAfter);
- setInterfaceAttributes(id, dataAfter, dataAfter.getName(), writeContext);
- }
-
- private void setInterfaceFlags(final InstanceIdentifier<Interface> id, final String swIfName, final int swIfIndex,
- final byte enabled) throws WriteFailedException {
- final CompletionStage<SwInterfaceSetFlagsReply> swInterfaceSetFlagsReplyFuture =
- getFutureJVpp().swInterfaceSetFlags(
- getSwInterfaceSetFlagsInput(swIfIndex, enabled, (byte) 0 /* deleted */));
-
- LOG.debug("Updating interface flags for: {}, index: {}, enabled: {}", swIfName, swIfIndex, enabled);
-
- getReplyForWrite(swInterfaceSetFlagsReplyFuture.toCompletableFuture(), id);
- LOG.debug("Interface flags updated successfully for: {}, index: {}, enabled: {}",
- swIfName, swIfIndex, enabled);
- }
-
- private SwInterfaceSetFlags getSwInterfaceSetFlagsInput(final int swIfIndex, final byte enabled,
- final byte deleted) {
- final SwInterfaceSetFlags swInterfaceSetFlags = new SwInterfaceSetFlags();
- swInterfaceSetFlags.swIfIndex = swIfIndex;
- swInterfaceSetFlags.adminUpDown = enabled;
- swInterfaceSetFlags.linkUpDown = enabled;
- swInterfaceSetFlags.deleted = deleted;
- return swInterfaceSetFlags;
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/L2Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/L2Customizer.java
deleted file mode 100644
index cf9da357d..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/L2Customizer.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-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 javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.L2;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class L2Customizer extends FutureJVppCustomizer implements WriterCustomizer<L2> {
-
- private static final Logger LOG = LoggerFactory.getLogger(L2Customizer.class);
- private final NamingContext interfaceContext;
- private final InterconnectionWriteUtils icWriteUtils;
-
- public L2Customizer(final FutureJVppCore vppApi, final NamingContext interfaceContext,
- final NamingContext bridgeDomainContext) {
- super(vppApi);
- this.interfaceContext = interfaceContext;
- this.icWriteUtils = new InterconnectionWriteUtils(vppApi, interfaceContext, bridgeDomainContext);
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<L2> id, @Nonnull final L2 dataAfter,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
-
- final String ifcName = id.firstKeyOf(Interface.class).getName();
- final int swIfc = interfaceContext.getIndex(ifcName, writeContext.getMappingContext());
- setL2(id, swIfc, ifcName, dataAfter, writeContext);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<L2> id, @Nonnull final L2 dataBefore,
- @Nonnull final L2 dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
-
- final String ifcName = id.firstKeyOf(Interface.class).getName();
- final int swIfc = interfaceContext.getIndex(ifcName, writeContext.getMappingContext());
- // No update, again calling set
- setL2(id, swIfc, ifcName, dataAfter, writeContext);
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<L2> id, @Nonnull final L2 dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- final String ifcName = id.firstKeyOf(Interface.class).getName();
- final int swIfc = interfaceContext.getIndex(ifcName, writeContext.getMappingContext());
- deleteL2(id, swIfc, ifcName, dataBefore, writeContext);
- }
-
- private void setL2(final InstanceIdentifier<L2> id, final int swIfIndex, final String ifcName, final L2 l2,
- final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("Setting L2 for interface: {}", ifcName);
- // Nothing besides interconnection here
- icWriteUtils.setInterconnection(id, swIfIndex, ifcName, l2.getInterconnection(), writeContext);
- }
-
- private void deleteL2(final InstanceIdentifier<L2> id, final int swIfIndex, final String ifcName, final L2 l2Before,
- final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("Deleting L2 for interface: {}", ifcName);
- // Nothing besides interconnection here
- icWriteUtils.deleteInterconnection(id, swIfIndex, ifcName, l2Before.getInterconnection(), writeContext);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/LoopbackCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/LoopbackCustomizer.java
deleted file mode 100644
index 47a71750d..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/LoopbackCustomizer.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import io.fd.honeycomb.translate.vpp.util.AbstractInterfaceTypeCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.vpp.util.MacTranslator;
-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.core.dto.CreateLoopback;
-import io.fd.vpp.jvpp.core.dto.CreateLoopbackReply;
-import io.fd.vpp.jvpp.core.dto.DeleteLoopback;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Loopback;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class LoopbackCustomizer extends AbstractInterfaceTypeCustomizer<Loopback>
- implements MacTranslator, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(LoopbackCustomizer.class);
- private final NamingContext interfaceContext;
-
- public LoopbackCustomizer(final FutureJVppCore vppApi, final NamingContext interfaceContext) {
- super(vppApi);
- this.interfaceContext = interfaceContext;
- }
-
- @Override
- protected Class<? extends InterfaceType> getExpectedInterfaceType() {
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.Loopback.class;
- }
-
- @Override
- protected final void writeInterface(@Nonnull final InstanceIdentifier<Loopback> id, @Nonnull final Loopback dataAfter,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String ifcName = id.firstKeyOf(Interface.class).getName();
- createLoopback(id, ifcName, dataAfter, writeContext);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Loopback> id, @Nonnull final Loopback dataBefore,
- @Nonnull final Loopback dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter,
- new UnsupportedOperationException("Modification of loopback interface is not supported"));
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Loopback> id, @Nonnull final Loopback dataBefore,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String ifcName = id.firstKeyOf(Interface.class).getName();
-
- final int index;
- try {
- index = interfaceContext.getIndex(ifcName, writeContext.getMappingContext());
- } catch (IllegalArgumentException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
-
- deleteLoopback(id, ifcName, index, dataBefore, writeContext);
- }
-
- private void createLoopback(final InstanceIdentifier<Loopback> id, final String swIfName, final Loopback loopback,
- final WriteContext writeContext) throws WriteFailedException {
- LOG.debug("Setting loopback interface: {}. Loopback: {}", swIfName, loopback);
-
- final CreateLoopback createLoopback = new CreateLoopback();
- if (loopback.getMac() != null) {
- createLoopback.macAddress = parseMac(loopback.getMac().getValue());
- }
- final CreateLoopbackReply reply =
- getReplyForCreate(getFutureJVpp().createLoopback(createLoopback).toCompletableFuture(), id, loopback);
-
- LOG.debug("Loopback set successfully for: {}, loopback: {}", swIfName, loopback);
- // Add new interface to our interface context
- interfaceContext.addName(reply.swIfIndex, swIfName, writeContext.getMappingContext());
- }
-
- private void deleteLoopback(final InstanceIdentifier<Loopback> id, final String swIfName, final int index,
- final Loopback dataBefore, final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("Deleting loopback interface: {}. Loopback: {}", swIfName, dataBefore);
- final DeleteLoopback deleteLoopback = new DeleteLoopback();
- deleteLoopback.swIfIndex = index;
- getReplyForDelete(getFutureJVpp().deleteLoopback(deleteLoopback).toCompletableFuture(), id);
- LOG.debug("Loopback deleted successfully for: {}, loopback: {}", swIfName, dataBefore);
- // Remove deleted interface from interface context
- interfaceContext.removeName(swIfName, writeContext.getMappingContext());
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ProxyArpCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ProxyArpCustomizer.java
deleted file mode 100644
index 43a34cdcd..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ProxyArpCustomizer.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import com.google.common.net.InetAddresses;
-import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
-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.core.dto.ProxyArpAddDel;
-import io.fd.vpp.jvpp.core.dto.ProxyArpAddDelReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.net.InetAddress;
-import java.util.concurrent.Future;
-import javax.annotation.Nonnull;
-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.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ProxyArp;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ProxyArpCustomizer extends FutureJVppCustomizer implements WriterCustomizer<ProxyArp>, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(ProxyArpCustomizer.class);
-
- public ProxyArpCustomizer(final FutureJVppCore vppApi) {
- super(vppApi);
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull InstanceIdentifier<ProxyArp> id, @Nonnull ProxyArp dataAfter,
- @Nonnull WriteContext writeContext) throws WriteFailedException {
- final String swIfName = id.firstKeyOf(Interface.class).getName();
- createProxyArp(getProxyArpRequestFuture(id, swIfName, dataAfter, (byte) 1 /* 1 is add */), id, dataAfter);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull InstanceIdentifier<ProxyArp> id, @Nonnull ProxyArp dataBefore,
- @Nonnull ProxyArp dataAfter, @Nonnull WriteContext writeContext)
- throws WriteFailedException.UpdateFailedException {
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter,
- new UnsupportedOperationException("ARP proxy update is not supported"));
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull InstanceIdentifier<ProxyArp> id, @Nonnull ProxyArp dataBefore,
- @Nonnull WriteContext writeContext) throws WriteFailedException {
-
- final String swIfName = id.firstKeyOf(Interface.class).getName();
- deleteProxyArp(getProxyArpRequestFuture(id, swIfName, dataBefore, (byte) 0 /* 0 is delete */), id);
- }
-
- private Future<ProxyArpAddDelReply> getProxyArpRequestFuture(InstanceIdentifier<ProxyArp> id, String swIfName,
- ProxyArp proxyArp, byte operation)
- throws WriteFailedException {
- LOG.debug("Setting Proxy ARP settings for interface: {}", swIfName);
- final InetAddress srcAddress = InetAddresses.forString(getv4AddressString(proxyArp.getLowAddr()));
- final InetAddress dstAddress = InetAddresses.forString(getv4AddressString(proxyArp.getHighAddr()));
- final int vrfId = proxyArp.getVrfId().intValue();
- return getFutureJVpp().proxyArpAddDel(
- getProxyArpConfRequest(operation, srcAddress.getAddress(), dstAddress.getAddress(), vrfId))
- .toCompletableFuture();
- }
-
- private void createProxyArp(final Future<ProxyArpAddDelReply> future, final InstanceIdentifier<ProxyArp> identifier,
- final ProxyArp data)
- throws WriteFailedException {
- final ProxyArpAddDelReply reply = getReplyForCreate(future, identifier, data);
- LOG.debug("Proxy ARP setting create successful, with reply context:", reply.context);
- }
-
- private void deleteProxyArp(final Future<ProxyArpAddDelReply> future, final InstanceIdentifier<ProxyArp> identifier)
- throws WriteFailedException {
- final ProxyArpAddDelReply reply = getReplyForDelete(future, identifier);
- LOG.debug("Proxy ARP setting delete successful, with reply context:", reply.context);
- }
-
- private static ProxyArpAddDel getProxyArpConfRequest(final byte isAdd, final byte[] lAddr, final byte[] hAddr,
- final int vrfId) {
-
- final ProxyArpAddDel proxyArpAddDel = new ProxyArpAddDel();
- proxyArpAddDel.isAdd = isAdd;
- proxyArpAddDel.lowAddress = lAddr;
- proxyArpAddDel.hiAddress = hAddr;
- proxyArpAddDel.vrfId = vrfId;
- return proxyArpAddDel;
- }
-
- private String getv4AddressString(@Nonnull final Ipv4Address addr) {
- return addr.getValue();
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizer.java
deleted file mode 100644
index 204f5e152..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizer.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import com.google.common.base.Preconditions;
-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.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils;
-import io.fd.honeycomb.translate.vpp.util.TagRewriteOperation;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.vpp.jvpp.core.dto.L2InterfaceVlanTagRewrite;
-import io.fd.vpp.jvpp.core.dto.L2InterfaceVlanTagRewriteReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.List;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214._802dot1q;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.l2.Rewrite;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.l2.RewriteBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.tag.rewrite.PushTags;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Writer Customizer responsible for vlan tag rewrite.<br> Sends {@code l2_interface_vlan_tag_rewrite} message to
- * VPP.<br> Equivalent of invoking {@code vppctl set interface l2 tag-rewrite} command.
- */
-public class RewriteCustomizer extends FutureJVppCustomizer
- implements WriterCustomizer<Rewrite>, ByteDataTranslator, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(RewriteCustomizer.class);
- private final NamingContext interfaceContext;
-
- public RewriteCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext) {
- super(futureJVppCore);
- this.interfaceContext = Preconditions.checkNotNull(interfaceContext, "interfaceContext should not be null");
- }
-
- @Override
- public void writeCurrentAttributes(final InstanceIdentifier<Rewrite> id, final Rewrite dataAfter,
- final WriteContext writeContext)
- throws WriteFailedException {
- final String subifName = getSubInterfaceName(id);
- setTagRewrite(id, subifName, dataAfter, writeContext);
- }
-
- private static String getSubInterfaceName(final InstanceIdentifier<Rewrite> id) {
- return SubInterfaceUtils.getSubInterfaceName(id.firstKeyOf(Interface.class).getName(),
- Math.toIntExact(id.firstKeyOf(SubInterface.class).getIdentifier()));
- }
-
- private void setTagRewrite(final InstanceIdentifier<Rewrite> id, final String ifname, final Rewrite rewrite,
- final WriteContext writeContext) throws WriteFailedException {
- final int swIfIndex = interfaceContext.getIndex(ifname, writeContext.getMappingContext());
- LOG.debug("Setting tag rewrite for interface {}(id=): {}", ifname, swIfIndex, rewrite);
-
- final CompletionStage<L2InterfaceVlanTagRewriteReply> replyCompletionStage =
- getFutureJVpp().l2InterfaceVlanTagRewrite(getTagRewriteRequest(swIfIndex, rewrite));
-
- getReplyForWrite(replyCompletionStage.toCompletableFuture(), id);
- LOG.debug("Tag rewrite for interface {}(id=) set successfully: {}", ifname, swIfIndex, rewrite);
- }
-
- private L2InterfaceVlanTagRewrite getTagRewriteRequest(final int swIfIndex, final Rewrite rewrite) {
- final L2InterfaceVlanTagRewrite request = new L2InterfaceVlanTagRewrite();
- request.swIfIndex = swIfIndex;
- request.pushDot1Q = booleanToByte(_802dot1q.class == rewrite.getVlanType());
-
- final List<PushTags> pushTags = rewrite.getPushTags();
- final Short popTags = rewrite.getPopTags();
-
- final int numberOfTagsToPop = popTags == null
- ? 0
- : popTags.intValue();
- final int numberOfTagsToPush = pushTags == null
- ? 0
- : pushTags.size();
-
- request.vtrOp = TagRewriteOperation.get(numberOfTagsToPop, numberOfTagsToPush).ordinal();
-
- if (numberOfTagsToPush > 0) {
- for (final PushTags tag : pushTags) {
- if (tag.getIndex() == 0) {
- request.tag1 = tag.getDot1qTag().getVlanId().getValue();
- } else {
- request.tag2 = tag.getDot1qTag().getVlanId().getValue();
- }
- }
- }
-
- LOG.debug("Generated tag rewrite request: {}", request);
- return request;
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Rewrite> id,
- @Nonnull final Rewrite dataBefore,
- @Nonnull final Rewrite dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String subifName = getSubInterfaceName(id);
- setTagRewrite(id, subifName, dataAfter, writeContext);
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Rewrite> id,
- @Nonnull final Rewrite dataBefore, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String subifName = getSubInterfaceName(id);
-
- LOG.debug("Disabling tag rewrite for interface {}", subifName);
- final Rewrite rewrite = new RewriteBuilder().build(); // rewrite without push and pops will cause delete
- setTagRewrite(id, subifName, rewrite, writeContext);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizer.java
deleted file mode 100644
index 05ecf3648..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizer.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-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.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetTable;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetTableReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Routing;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RoutingCustomizer extends FutureJVppCustomizer implements WriterCustomizer<Routing>, JvppReplyConsumer,
- ByteDataTranslator {
-
- private static final Logger LOG = LoggerFactory.getLogger(RoutingCustomizer.class);
- private final NamingContext interfaceContext;
-
- public RoutingCustomizer(final FutureJVppCore vppApi, final NamingContext interfaceContext) {
- super(vppApi);
- this.interfaceContext = interfaceContext;
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Routing> id,
- @Nonnull final Routing dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
-
- final String ifName = id.firstKeyOf(Interface.class).getName();
- setRouting(id, ifName, dataAfter, writeContext);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Routing> id,
- @Nonnull final Routing dataBefore, @Nonnull final Routing dataAfter,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
-
- final String ifName = id.firstKeyOf(Interface.class).getName();
- setRouting(id, ifName, dataAfter, writeContext);
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Routing> id,
- @Nonnull final Routing dataBefore, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String ifName = id.firstKeyOf(Interface.class).getName();
- disableRouting(id, ifName, writeContext);
- }
-
- private void setRouting(@Nonnull final InstanceIdentifier<Routing> id, @Nonnull final String name,
- @Nonnull final Routing rt,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- final int swIfc = interfaceContext.getIndex(name, writeContext.getMappingContext());
- LOG.debug("Setting routing for interface: {}, {}. Routing: {}", name, swIfc, rt);
- checkArgument(rt.getIpv4VrfId() != null || rt.getIpv6VrfId() != null, "No vrf-id given");
-
- setVrfId(id, swIfc, rt.getIpv4VrfId(), false);
- setVrfId(id, swIfc, rt.getIpv6VrfId(), true);
-
- LOG.debug("Routing set successfully for interface: {}, {}, routing: {}", name, swIfc, rt);
- }
-
- private void setVrfId(final InstanceIdentifier<Routing> id, final int swIfc, final Long vrfId, boolean isIp6)
- throws WriteFailedException {
- if (vrfId == null) {
- return;
- }
- final CompletionStage<SwInterfaceSetTableReply> cs = getFutureJVpp()
- .swInterfaceSetTable(getInterfaceSetTableRequest(swIfc, booleanToByte(isIp6), vrfId.intValue()));
- getReplyForWrite(cs.toCompletableFuture(), id);
- }
-
- /**
- * In this case, there is no such thing as delete routing,only thing that can be done is to disable it by setting
- * default value 0
- */
- private void disableRouting(final InstanceIdentifier<Routing> id, final String name,
- final WriteContext writeContext) throws WriteFailedException {
- final int swIfc = interfaceContext.getIndex(name, writeContext.getMappingContext());
- LOG.debug("Disabling routing for interface: {}, {}.", name, swIfc);
-
- getReplyForDelete(getFutureJVpp()
- .swInterfaceSetTable(getInterfaceSetTableRequest(swIfc, (byte) 0, 0)).toCompletableFuture(), id);
- LOG.debug("Routing for interface: {}, {} successfully disabled", name, swIfc);
-
- }
-
- private SwInterfaceSetTable getInterfaceSetTableRequest(final int swIfc, final byte isIpv6, final int vrfId) {
- final SwInterfaceSetTable swInterfaceSetTable = new SwInterfaceSetTable();
- swInterfaceSetTable.isIpv6 = isIpv6;
- swInterfaceSetTable.swIfIndex = swIfc;
- swInterfaceSetTable.vrfId = vrfId;
- return swInterfaceSetTable;
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizer.java
deleted file mode 100644
index 364567772..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizer.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static com.google.common.base.Preconditions.checkState;
-import static io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils.getNumberOfTags;
-import static io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils.getSubInterfaceName;
-
-import com.google.common.base.Preconditions;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-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.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.vpp.jvpp.core.dto.CreateSubif;
-import io.fd.vpp.jvpp.core.dto.CreateSubifReply;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlags;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.CVlan;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.Dot1qVlanId;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.SVlan;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.or.any.Dot1qTag;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214._802dot1ad;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.match.attributes.MatchType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.match.attributes.match.type.Default;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.match.attributes.match.type.vlan.tagged.VlanTagged;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.tags.Tag;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Writer Customizer responsible for sub interface creation.<br> Sends {@code create_subif} message to VPP.<br>
- * Equivalent of invoking {@code vppclt create subif} command.
- */
-public class SubInterfaceCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<SubInterface, SubInterfaceKey>, ByteDataTranslator, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceCustomizer.class);
- private final NamingContext interfaceContext;
-
- public SubInterfaceCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext) {
- super(futureJVppCore);
- this.interfaceContext = Preconditions.checkNotNull(interfaceContext, "interfaceContext should not be null");
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<SubInterface> id,
- @Nonnull final SubInterface dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String superIfName = id.firstKeyOf(Interface.class).getName();
- createSubInterface(id, superIfName, dataAfter, writeContext);
- }
-
- private void createSubInterface(final InstanceIdentifier<SubInterface> id, @Nonnull final String superIfName,
- @Nonnull final SubInterface subInterface, final WriteContext writeContext)
- throws WriteFailedException {
- final int superIfIndex = interfaceContext.getIndex(superIfName, writeContext.getMappingContext());
- final CompletionStage<CreateSubifReply> createSubifReplyCompletionStage =
- getFutureJVpp().createSubif(getCreateSubifRequest(subInterface, superIfIndex));
-
- final CreateSubifReply reply =
- getReplyForCreate(createSubifReplyCompletionStage.toCompletableFuture(), id, subInterface);
-
- setInterfaceState(id, reply.swIfIndex, booleanToByte(subInterface.isEnabled()));
- interfaceContext.addName(reply.swIfIndex,
- getSubInterfaceName(superIfName, Math.toIntExact(subInterface.getIdentifier())),
- writeContext.getMappingContext());
- LOG.debug("Sub interface created successfully for: {}, subInterface: {}", superIfName, subInterface);
- }
-
- private CreateSubif getCreateSubifRequest(@Nonnull final SubInterface subInterface, final int swIfIndex) {
- // TODO HONEYCOMB-183 add validation
- CreateSubif request = new CreateSubif();
- request.subId = Math.toIntExact(subInterface.getIdentifier().intValue());
- request.swIfIndex = swIfIndex;
-
- final int numberOfTags = getNumberOfTags(subInterface.getTags());
- switch (numberOfTags) {
- case 0:
- request.noTags = 1;
- break;
- case 1:
- request.oneTag = 1;
- break;
- case 2:
- request.twoTags = 1;
- break;
- }
- request.dot1Ad = booleanToByte(_802dot1ad.class == subInterface.getVlanType());
-
- // TODO HONEYCOMB-183 match should be mandatory
- final MatchType matchType = subInterface.getMatch().getMatchType();
- request.exactMatch =
- booleanToByte(matchType instanceof VlanTagged && ((VlanTagged) matchType).isMatchExactTags());
- request.defaultSub = booleanToByte(matchType instanceof Default);
-
- if (numberOfTags > 0) {
- for (final Tag tag : subInterface.getTags().getTag()) {
- if (tag.getIndex() == 0) {
- setOuterTag(request, tag);
- } else if (tag.getIndex() == 1) {
- setInnerTag(request, tag);
- }
- }
- }
- return request;
- }
-
- private void setOuterTag(final CreateSubif request, final Tag outerTag) {
- checkState(SVlan.class == outerTag.getDot1qTag().getTagType(), "Service Tag expected at index 0");
- final Dot1qTag.VlanId vlanId = outerTag.getDot1qTag().getVlanId();
-
- request.outerVlanId = dot1qVlanIdToShort(vlanId.getDot1qVlanId());
- request.outerVlanIdAny = booleanToByte(Dot1qTag.VlanId.Enumeration.Any.equals(vlanId.getEnumeration()));
- }
-
- private void setInnerTag(final CreateSubif request, final Tag innerTag) {
- checkState(CVlan.class == innerTag.getDot1qTag().getTagType(), "Customer Tag expected at index 1");
- final Dot1qTag.VlanId vlanId = innerTag.getDot1qTag().getVlanId();
-
- request.innerVlanId = dot1qVlanIdToShort(vlanId.getDot1qVlanId());
- request.innerVlanIdAny = booleanToByte(Dot1qTag.VlanId.Enumeration.Any.equals(vlanId.getEnumeration()));
- }
-
- private static short dot1qVlanIdToShort(@Nullable Dot1qVlanId dot1qVlanId) {
- if (dot1qVlanId == null) {
- return 0; // tell VPP that optional argument is missing
- } else {
- return dot1qVlanId.getValue().shortValue();
- }
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<SubInterface> id,
- @Nonnull final SubInterface dataBefore, @Nonnull final SubInterface dataAfter,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String subIfaceName = getSubInterfaceName(id.firstKeyOf(Interface.class).getName(),
- Math.toIntExact(dataAfter.getIdentifier()));
- setInterfaceState(id, interfaceContext.getIndex(subIfaceName, writeContext.getMappingContext()),
- booleanToByte(dataAfter.isEnabled()));
- }
-
- private void setInterfaceState(final InstanceIdentifier<SubInterface> id, final int swIfIndex, final byte enabled)
- throws WriteFailedException {
- final SwInterfaceSetFlags swInterfaceSetFlags = new SwInterfaceSetFlags();
- swInterfaceSetFlags.swIfIndex = swIfIndex;
- swInterfaceSetFlags.adminUpDown = enabled;
-
- final CompletionStage<SwInterfaceSetFlagsReply> swInterfaceSetFlagsReplyFuture =
- getFutureJVpp().swInterfaceSetFlags(swInterfaceSetFlags);
-
- LOG.debug("Updating interface state for interface if={}, enabled: {}", swIfIndex, enabled);
-
- SwInterfaceSetFlagsReply reply =
- getReplyForWrite(swInterfaceSetFlagsReplyFuture.toCompletableFuture(), id);
- LOG.debug("Interface state updated successfully for interface index: {}, enabled: {}, ctxId: {}",
- swIfIndex, enabled, reply.context);
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<SubInterface> id,
- @Nonnull final SubInterface dataBefore,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException.DeleteFailedException {
- throw new UnsupportedOperationException("Sub interface delete is not supported");
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceL2Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceL2Customizer.java
deleted file mode 100644
index a485d0749..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceL2Customizer.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-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.vpp.util.SubInterfaceUtils;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.L2;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Customizer for writing vlan sub interface l2 configuration
- */
-public class SubInterfaceL2Customizer extends FutureJVppCustomizer implements WriterCustomizer<L2> {
-
- private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceL2Customizer.class);
- private final NamingContext interfaceContext;
- private final InterconnectionWriteUtils icWriterUtils;
-
- public SubInterfaceL2Customizer(final FutureJVppCore vppApi, final NamingContext interfaceContext,
- final NamingContext bridgeDomainContext) {
- super(vppApi);
- this.interfaceContext = interfaceContext;
- this.icWriterUtils = new InterconnectionWriteUtils(vppApi, interfaceContext, bridgeDomainContext);
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<L2> id, @Nonnull final L2 dataAfter,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String subInterfaceName = getSubInterfaceName(id);
- final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, writeContext.getMappingContext());
- setL2(id, subInterfaceIndex, subInterfaceName, dataAfter, writeContext);
- }
-
- private String getSubInterfaceName(@Nonnull final InstanceIdentifier<L2> id) {
- final InterfaceKey parentInterfacekey = id.firstKeyOf(Interface.class);
- final SubInterfaceKey subInterfacekey = id.firstKeyOf(SubInterface.class);
- return SubInterfaceUtils
- .getSubInterfaceName(parentInterfacekey.getName(), subInterfacekey.getIdentifier().intValue());
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<L2> id, @Nonnull final L2 dataBefore,
- @Nonnull final L2 dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
-
- final String subInterfaceName = getSubInterfaceName(id);
- final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, writeContext.getMappingContext());
- // Setting L2 to new values
- setL2(id, subInterfaceIndex, subInterfaceName, dataAfter, writeContext);
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<L2> id, @Nonnull final L2 dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- final String subInterfaceName = getSubInterfaceName(id);
- final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, writeContext.getMappingContext());
- deleteL2(id, subInterfaceIndex, subInterfaceName, dataBefore, writeContext);
- }
-
- private void setL2(final InstanceIdentifier<L2> id, final int swIfIndex, final String ifcName, final L2 l2,
- final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("Setting L2 for sub-interface: {}", ifcName);
- icWriterUtils.setInterconnection(id, swIfIndex, ifcName, l2.getInterconnection(), writeContext);
- }
-
- private void deleteL2(final InstanceIdentifier<L2> id, final int swIfIndex, final String ifcName, final L2 l2Before,
- final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("Deleting L2 for sub-interface: {}", ifcName);
- icWriterUtils.deleteInterconnection(id, swIfIndex, ifcName, l2Before.getInterconnection(), writeContext);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/TapCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/TapCustomizer.java
deleted file mode 100644
index ef3fd32ff..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/TapCustomizer.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import io.fd.honeycomb.translate.vpp.util.AbstractInterfaceTypeCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.vpp.util.MacTranslator;
-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.core.dto.TapConnect;
-import io.fd.vpp.jvpp.core.dto.TapConnectReply;
-import io.fd.vpp.jvpp.core.dto.TapDelete;
-import io.fd.vpp.jvpp.core.dto.TapDeleteReply;
-import io.fd.vpp.jvpp.core.dto.TapModify;
-import io.fd.vpp.jvpp.core.dto.TapModifyReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Tap;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TapCustomizer extends AbstractInterfaceTypeCustomizer<Tap> implements MacTranslator, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(TapCustomizer.class);
- private final NamingContext interfaceContext;
-
- public TapCustomizer(final FutureJVppCore vppApi, final NamingContext interfaceContext) {
- super(vppApi);
- this.interfaceContext = interfaceContext;
- }
-
- @Override
- protected Class<? extends InterfaceType> getExpectedInterfaceType() {
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.Tap.class;
- }
-
- @Override
- protected final void writeInterface(@Nonnull final InstanceIdentifier<Tap> id, @Nonnull final Tap dataAfter,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String ifcName = id.firstKeyOf(Interface.class).getName();
- createTap(id, ifcName, dataAfter, writeContext);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Tap> id, @Nonnull final Tap dataBefore,
- @Nonnull final Tap dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String ifcName = id.firstKeyOf(Interface.class).getName();
-
- final int index;
- try {
- index = interfaceContext.getIndex(ifcName, writeContext.getMappingContext());
- } catch (IllegalArgumentException e) {
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, e);
- }
-
- modifyTap(id, ifcName, index, dataBefore, dataAfter);
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Tap> id, @Nonnull final Tap dataBefore,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String ifcName = id.firstKeyOf(Interface.class).getName();
-
- final int index;
- try {
- index = interfaceContext.getIndex(ifcName, writeContext.getMappingContext());
- } catch (IllegalArgumentException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
-
- deleteTap(id, ifcName, index, dataBefore, writeContext);
- }
-
- private void createTap(final InstanceIdentifier<Tap> id, final String swIfName, final Tap tap,
- final WriteContext writeContext) throws WriteFailedException {
- LOG.debug("Setting tap interface: {}. Tap: {}", swIfName, tap);
- final CompletionStage<TapConnectReply> tapConnectFuture = getFutureJVpp()
- .tapConnect(getTapConnectRequest(tap.getTapName(), tap.getMac(), tap.getDeviceInstance()));
- final TapConnectReply reply = getReplyForCreate(tapConnectFuture.toCompletableFuture(), id, tap);
- LOG.debug("Tap set successfully for: {}, tap: {}", swIfName, tap);
- // Add new interface to our interface context
- interfaceContext.addName(reply.swIfIndex, swIfName, writeContext.getMappingContext());
- }
-
- private void modifyTap(final InstanceIdentifier<Tap> id, final String swIfName, final int index,
- final Tap tapBefore, final Tap tapAfter) throws WriteFailedException {
- LOG.debug("Modifying tap interface: {}. Tap: {}", swIfName, tapAfter);
- final CompletionStage<TapModifyReply> vxlanAddDelTunnelReplyCompletionStage =
- getFutureJVpp()
- .tapModify(getTapModifyRequest(tapAfter.getTapName(), index, tapAfter.getMac(),
- tapAfter.getDeviceInstance()));
- getReplyForUpdate(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture(), id, tapBefore, tapAfter);
- LOG.debug("Tap modified successfully for: {}, tap: {}", swIfName, tapAfter);
- }
-
- private void deleteTap(final InstanceIdentifier<Tap> id, final String swIfName, final int index,
- final Tap dataBefore, final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("Deleting tap interface: {}. Tap: {}", swIfName, dataBefore);
- final CompletionStage<TapDeleteReply> vxlanAddDelTunnelReplyCompletionStage =
- getFutureJVpp().tapDelete(getTapDeleteRequest(index));
- getReplyForDelete(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
- LOG.debug("Tap deleted successfully for: {}, tap: {}", swIfName, dataBefore);
- // Remove deleted interface from interface context
- interfaceContext.removeName(swIfName, writeContext.getMappingContext());
- }
-
- private TapConnect getTapConnectRequest(final String tapName, final PhysAddress mac, final Long deviceInstance) {
- final TapConnect tapConnect = new TapConnect();
- tapConnect.tapName = tapName.getBytes();
-
- if (mac == null) {
- tapConnect.useRandomMac = 1;
- tapConnect.macAddress = new byte[6];
- } else {
- tapConnect.useRandomMac = 0;
- tapConnect.macAddress = parseMac(mac.getValue());
- }
-
- if (deviceInstance == null) {
- tapConnect.renumber = 0;
- } else {
- tapConnect.renumber = 1;
- tapConnect.customDevInstance = Math.toIntExact(deviceInstance);
- }
-
- return tapConnect;
- }
-
- private TapModify getTapModifyRequest(final String tapName, final int swIndex, final PhysAddress mac,
- final Long deviceInstance) {
- final TapModify tapConnect = new TapModify();
- tapConnect.tapName = tapName.getBytes();
- tapConnect.swIfIndex = swIndex;
-
- if (mac == null) {
- tapConnect.useRandomMac = 1;
- tapConnect.macAddress = new byte[6];
- } else {
- tapConnect.useRandomMac = 0;
- tapConnect.macAddress = parseMac(mac.getValue());
- }
-
- if (deviceInstance == null) {
- tapConnect.renumber = 0;
- } else {
- tapConnect.renumber = 1;
- tapConnect.customDevInstance = Math.toIntExact(deviceInstance);
- }
-
- return tapConnect;
- }
-
- private TapDelete getTapDeleteRequest(final int swIndex) {
- final TapDelete tapConnect = new TapDelete();
- tapConnect.swIfIndex = swIndex;
- return tapConnect;
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizer.java
deleted file mode 100644
index 4f834c239..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizer.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import com.google.common.base.Preconditions;
-import io.fd.honeycomb.translate.vpp.util.AbstractInterfaceTypeCustomizer;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-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.core.dto.CreateVhostUserIf;
-import io.fd.vpp.jvpp.core.dto.CreateVhostUserIfReply;
-import io.fd.vpp.jvpp.core.dto.DeleteVhostUserIf;
-import io.fd.vpp.jvpp.core.dto.DeleteVhostUserIfReply;
-import io.fd.vpp.jvpp.core.dto.ModifyVhostUserIf;
-import io.fd.vpp.jvpp.core.dto.ModifyVhostUserIfReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VhostUserRole;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VhostUser;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Writer Customizer responsible for passing vhost user interface CRD operations to VPP
- */
-public class VhostUserCustomizer extends AbstractInterfaceTypeCustomizer<VhostUser>
- implements ByteDataTranslator, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(VhostUserCustomizer.class);
- private final NamingContext interfaceContext;
-
- public VhostUserCustomizer(@Nonnull final FutureJVppCore vppApi, @Nonnull final NamingContext interfaceContext) {
- super(vppApi);
- this.interfaceContext = Preconditions.checkNotNull(interfaceContext, "interfaceContext should not be null");
- }
-
- @Override
- protected Class<? extends InterfaceType> getExpectedInterfaceType() {
- return org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VhostUser.class;
- }
-
- @Override
- protected final void writeInterface(@Nonnull final InstanceIdentifier<VhostUser> id,
- @Nonnull final VhostUser dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String swIfName = id.firstKeyOf(Interface.class).getName();
- createVhostUserIf(id, swIfName, dataAfter, writeContext);
- }
-
- private void createVhostUserIf(final InstanceIdentifier<VhostUser> id, final String swIfName,
- final VhostUser vhostUser, final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("Creating vhost user interface: name={}, vhostUser={}", swIfName, vhostUser);
-
- final CompletionStage<CreateVhostUserIfReply> createVhostUserIfReplyCompletionStage =
- getFutureJVpp().createVhostUserIf(getCreateVhostUserIfRequest(vhostUser));
- final CreateVhostUserIfReply reply =
- getReplyForCreate(createVhostUserIfReplyCompletionStage.toCompletableFuture(), id, vhostUser);
- LOG.debug("Vhost user interface created successfully for: {}, vhostUser: {}", swIfName, vhostUser);
- // Add new interface to our interface context
- interfaceContext.addName(reply.swIfIndex, swIfName, writeContext.getMappingContext());
- }
-
- private CreateVhostUserIf getCreateVhostUserIfRequest(final VhostUser vhostUser) {
- CreateVhostUserIf request = new CreateVhostUserIf();
- request.isServer = booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole()));
- request.sockFilename = vhostUser.getSocket().getBytes();
- // TODO HONEYCOMB-177 expose device instance attribute just like for TAP
- request.renumber = 0;
- request.customDevInstance = 0;
- request.useCustomMac = 0;
- request.macAddress = new byte[]{};
- return request;
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<VhostUser> id,
- @Nonnull final VhostUser dataBefore, @Nonnull final VhostUser dataAfter,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String swIfName = id.firstKeyOf(Interface.class).getName();
- modifyVhostUserIf(id, swIfName, dataBefore, dataAfter, writeContext);
- }
-
- private void modifyVhostUserIf(final InstanceIdentifier<VhostUser> id, final String swIfName,
- final VhostUser vhostUserBefore, final VhostUser vhostUserAfter,
- final WriteContext writeContext) throws WriteFailedException {
- LOG.debug("Updating vhost user interface: name={}, vhostUser={}", swIfName, vhostUserAfter);
- final CompletionStage<ModifyVhostUserIfReply> modifyVhostUserIfReplyCompletionStage =
- getFutureJVpp()
- .modifyVhostUserIf(getModifyVhostUserIfRequest(vhostUserAfter,
- interfaceContext.getIndex(swIfName, writeContext.getMappingContext())));
-
- getReplyForUpdate(modifyVhostUserIfReplyCompletionStage.toCompletableFuture(), id, vhostUserBefore,
- vhostUserAfter);
- LOG.debug("Vhost user interface updated successfully for: {}, vhostUser: {}", swIfName, vhostUserAfter);
- }
-
- private ModifyVhostUserIf getModifyVhostUserIfRequest(final VhostUser vhostUser, final int swIfIndex) {
- ModifyVhostUserIf request = new ModifyVhostUserIf();
- request.isServer = booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole()));
- request.sockFilename = vhostUser.getSocket().getBytes();
- // TODO HONEYCOMB-177
- request.renumber = 0;
- request.customDevInstance = 0;
- request.swIfIndex = swIfIndex;
- return request;
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<VhostUser> id,
- @Nonnull final VhostUser dataBefore, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String swIfName = id.firstKeyOf(Interface.class).getName();
- deleteVhostUserIf(id, swIfName, dataBefore, writeContext);
- }
-
- private void deleteVhostUserIf(final InstanceIdentifier<VhostUser> id, final String swIfName,
- final VhostUser vhostUser, final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("Deleting vhost user interface: name={}, vhostUser={}", swIfName, vhostUser);
- final CompletionStage<DeleteVhostUserIfReply> deleteVhostUserIfReplyCompletionStage =
- getFutureJVpp().deleteVhostUserIf(getDeleteVhostUserIfRequest(
- interfaceContext.getIndex(swIfName, writeContext.getMappingContext())));
-
- getReplyForDelete(deleteVhostUserIfReplyCompletionStage.toCompletableFuture(), id);
- LOG.debug("Vhost user interface deleted successfully for: {}, vhostUser: {}", swIfName, vhostUser);
- // Remove interface from our interface context
- interfaceContext.removeName(swIfName, writeContext.getMappingContext());
- }
-
- private DeleteVhostUserIf getDeleteVhostUserIfRequest(final int swIfIndex) {
- DeleteVhostUserIf request = new DeleteVhostUserIf();
- request.swIfIndex = swIfIndex;
- return request;
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanCustomizer.java
deleted file mode 100644
index 4248a1f1c..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanCustomizer.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import com.google.common.net.InetAddresses;
-import io.fd.honeycomb.translate.v3po.DisabledInterfacesManager;
-import io.fd.honeycomb.translate.vpp.util.AbstractInterfaceTypeCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-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.core.dto.VxlanAddDelTunnel;
-import io.fd.vpp.jvpp.core.dto.VxlanAddDelTunnelReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.net.InetAddress;
-import java.util.concurrent.CompletionStage;
-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.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VxlanTunnel;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Vxlan;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class VxlanCustomizer extends AbstractInterfaceTypeCustomizer<Vxlan> implements JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(VxlanCustomizer.class);
-
- private final NamingContext interfaceNamingContext;
- private final DisabledInterfacesManager interfaceDisableContext;
-
- public VxlanCustomizer(@Nonnull final FutureJVppCore vppApi,
- @Nonnull final NamingContext interfaceNamingContext,
- @Nonnull final DisabledInterfacesManager interfaceDisableContext) {
- super(vppApi);
- this.interfaceNamingContext = interfaceNamingContext;
- this.interfaceDisableContext = interfaceDisableContext;
- }
-
- @Override
- protected Class<? extends InterfaceType> getExpectedInterfaceType() {
- return VxlanTunnel.class;
- }
-
- @Override
- protected final void writeInterface(@Nonnull final InstanceIdentifier<Vxlan> id, @Nonnull final Vxlan dataAfter,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String swIfName = id.firstKeyOf(Interface.class).getName();
- createVxlanTunnel(id, swIfName, dataAfter, writeContext);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Vxlan> id, @Nonnull final Vxlan dataBefore,
- @Nonnull final Vxlan dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException.UpdateFailedException {
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter,
- new UnsupportedOperationException("Vxlan tunnel update is not supported"));
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Vxlan> id, @Nonnull final Vxlan dataBefore,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String swIfName = id.firstKeyOf(Interface.class).getName();
- deleteVxlanTunnel(id, swIfName, dataBefore, writeContext);
- }
-
- private void createVxlanTunnel(final InstanceIdentifier<Vxlan> id, final String swIfName, final Vxlan vxlan,
- final WriteContext writeContext)
- throws WriteFailedException {
- final byte isIpv6 = (byte) (isIpv6(vxlan)
- ? 1
- : 0);
- final InetAddress srcAddress = InetAddresses.forString(getAddressString(vxlan.getSrc()));
- final InetAddress dstAddress = InetAddresses.forString(getAddressString(vxlan.getDst()));
-
- int encapVrfId = vxlan.getEncapVrfId().intValue();
- int vni = vxlan.getVni().getValue().intValue();
-
- LOG.debug("Setting vxlan tunnel for interface: {}. Vxlan: {}", swIfName, vxlan);
- final CompletionStage<VxlanAddDelTunnelReply> vxlanAddDelTunnelReplyCompletionStage =
- getFutureJVpp().vxlanAddDelTunnel(getVxlanTunnelRequest((byte) 1 /* is add */, srcAddress.getAddress(),
- dstAddress.getAddress(), encapVrfId, -1, vni, isIpv6));
-
- final VxlanAddDelTunnelReply reply =
- getReplyForCreate(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture(), id, vxlan);
- LOG.debug("Vxlan tunnel set successfully for: {}, vxlan: {}", swIfName, vxlan);
- if (interfaceNamingContext.containsName(reply.swIfIndex, writeContext.getMappingContext())) {
- // VPP keeps vxlan tunnels present even after they are delete(reserving ID for next tunnel)
- // This may cause inconsistencies in mapping context when configuring tunnels like this:
- // 1. Add tunnel 2. Delete tunnel 3. Read interfaces (reserved mapping e.g. vxlan_tunnel0 -> 6
- // will get into mapping context) 4. Add tunnel (this will add another mapping with the same
- // reserved ID and context is invalid)
- // That's why a check has to be performed here removing mapping vxlan_tunnel0 -> 6 mapping and storing
- // new name for that ID
- final String formerName = interfaceNamingContext.getName(reply.swIfIndex, writeContext.getMappingContext());
- LOG.debug("Removing updated mapping of a vxlan tunnel, id: {}, former name: {}, new name: {}",
- reply.swIfIndex, formerName, swIfName);
- interfaceNamingContext.removeName(formerName, writeContext.getMappingContext());
-
- }
-
- // Removing disability of an interface in case a vxlan tunnel formerly deleted is being reused in VPP
- // further details in above comment
- if (interfaceDisableContext.isInterfaceDisabled(reply.swIfIndex, writeContext.getMappingContext())) {
- LOG.debug("Removing disability of vxlan tunnel, id: {}, name: {}", reply.swIfIndex, swIfName);
- interfaceDisableContext.removeDisabledInterface(reply.swIfIndex, writeContext.getMappingContext());
- }
-
- // Add new interface to our interface context
- interfaceNamingContext.addName(reply.swIfIndex, swIfName, writeContext.getMappingContext());
- }
-
- private boolean isIpv6(final Vxlan vxlan) {
- if (vxlan.getSrc().getIpv4Address() == null) {
- checkArgument(vxlan.getDst().getIpv4Address() == null, "Inconsistent ip addresses: %s, %s", vxlan.getSrc(),
- vxlan.getDst());
- return true;
- } else {
- checkArgument(vxlan.getDst().getIpv6Address() == null, "Inconsistent ip addresses: %s, %s", vxlan.getSrc(),
- vxlan.getDst());
- return false;
- }
- }
-
- private String getAddressString(final IpAddress addr) {
- return addr.getIpv4Address() == null
- ? addr.getIpv6Address().getValue()
- : addr.getIpv4Address().getValue();
- }
-
- private void deleteVxlanTunnel(final InstanceIdentifier<Vxlan> id, final String swIfName, final Vxlan vxlan,
- final WriteContext writeContext) throws WriteFailedException {
- final byte isIpv6 = (byte) (isIpv6(vxlan)
- ? 1
- : 0);
- final InetAddress srcAddress = InetAddresses.forString(getAddressString(vxlan.getSrc()));
- final InetAddress dstAddress = InetAddresses.forString(getAddressString(vxlan.getDst()));
-
- int encapVrfId = vxlan.getEncapVrfId().intValue();
- int vni = vxlan.getVni().getValue().intValue();
-
- LOG.debug("Deleting vxlan tunnel for interface: {}. Vxlan: {}", swIfName, vxlan);
- final CompletionStage<VxlanAddDelTunnelReply> vxlanAddDelTunnelReplyCompletionStage =
- getFutureJVpp().vxlanAddDelTunnel(getVxlanTunnelRequest((byte) 0 /* is add */, srcAddress.getAddress(),
- dstAddress.getAddress(), encapVrfId, -1, vni, isIpv6));
-
- getReplyForDelete(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
- LOG.debug("Vxlan tunnel deleted successfully for: {}, vxlan: {}", swIfName, vxlan);
-
- final int index = interfaceNamingContext.getIndex(swIfName, writeContext.getMappingContext());
- // Mark this interface as disabled to not include it in operational reads
- // because VPP will keep the interface there
- LOG.debug("Marking vxlan tunnel as disabled, id: {}, name: {}", index, swIfName);
- interfaceDisableContext.disableInterface(index, writeContext.getMappingContext());
- // Remove interface from our interface naming context
- interfaceNamingContext.removeName(swIfName, writeContext.getMappingContext());
- }
-
- private static VxlanAddDelTunnel getVxlanTunnelRequest(final byte isAdd, final byte[] srcAddr, final byte[] dstAddr,
- final int encapVrfId,
- final int decapNextIndex, final int vni, final byte isIpv6) {
- final VxlanAddDelTunnel vxlanAddDelTunnel = new VxlanAddDelTunnel();
- vxlanAddDelTunnel.isAdd = isAdd;
- vxlanAddDelTunnel.srcAddress = srcAddr;
- vxlanAddDelTunnel.dstAddress = dstAddr;
- vxlanAddDelTunnel.encapVrfId = encapVrfId;
- vxlanAddDelTunnel.vni = vni;
- vxlanAddDelTunnel.decapNextIndex = decapNextIndex;
- vxlanAddDelTunnel.isIpv6 = isIpv6;
- return vxlanAddDelTunnel;
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanGpeCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanGpeCustomizer.java
deleted file mode 100644
index 3e1891e0f..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanGpeCustomizer.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import com.google.common.net.InetAddresses;
-import io.fd.honeycomb.translate.v3po.DisabledInterfacesManager;
-import io.fd.honeycomb.translate.vpp.util.AbstractInterfaceTypeCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-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.core.dto.VxlanGpeAddDelTunnel;
-import io.fd.vpp.jvpp.core.dto.VxlanGpeAddDelTunnelReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.net.InetAddress;
-import java.util.concurrent.CompletionStage;
-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.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VxlanGpeTunnel;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VxlanGpe;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class VxlanGpeCustomizer extends AbstractInterfaceTypeCustomizer<VxlanGpe> implements JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(VxlanGpeCustomizer.class);
- private final NamingContext interfaceNamingContext;
- private final DisabledInterfacesManager interfaceDisableContext;
-
- public VxlanGpeCustomizer(@Nonnull final FutureJVppCore vppApi,
- @Nonnull final NamingContext interfaceNamingContext,
- @Nonnull final DisabledInterfacesManager interfaceDisableContext) {
- super(vppApi);
- this.interfaceNamingContext = interfaceNamingContext;
- this.interfaceDisableContext = interfaceDisableContext;
- }
-
- @Override
- protected Class<? extends InterfaceType> getExpectedInterfaceType() {
- return VxlanGpeTunnel.class;
- }
-
- @Override
- protected final void writeInterface(@Nonnull final InstanceIdentifier<VxlanGpe> id,
- @Nonnull final VxlanGpe dataAfter,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String swIfName = id.firstKeyOf(Interface.class).getName();
- createVxlanGpeTunnel(id, swIfName, dataAfter, writeContext);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<VxlanGpe> id,
- @Nonnull final VxlanGpe dataBefore,
- @Nonnull final VxlanGpe dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException.UpdateFailedException {
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter,
- new UnsupportedOperationException("VxlanGpe tunnel update is not supported"));
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<VxlanGpe> id,
- @Nonnull final VxlanGpe dataBefore,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String swIfName = id.firstKeyOf(Interface.class).getName();
- deleteVxlanGpeTunnel(id, swIfName, dataBefore, writeContext);
- }
-
- private void createVxlanGpeTunnel(final InstanceIdentifier<VxlanGpe> id, final String swIfName,
- final VxlanGpe vxlanGpe, final WriteContext writeContext)
- throws WriteFailedException {
- final byte isIpv6 = (byte) (isIpv6(vxlanGpe)
- ? 1
- : 0);
- final InetAddress Local = InetAddresses.forString(getAddressString(vxlanGpe.getLocal()));
- final InetAddress Remote = InetAddresses.forString(getAddressString(vxlanGpe.getRemote()));
-
- int vni = vxlanGpe.getVni().getValue().intValue();
- byte protocol = (byte) vxlanGpe.getNextProtocol().getIntValue();
- int encapVrfId = vxlanGpe.getEncapVrfId().intValue();
- int decapVrfId = vxlanGpe.getDecapVrfId().intValue();
-
- LOG.debug("Setting VxlanGpe tunnel for interface: {}. VxlanGpe: {}", swIfName, vxlanGpe);
- final CompletionStage<VxlanGpeAddDelTunnelReply> VxlanGpeAddDelTunnelReplyCompletionStage =
- getFutureJVpp().vxlanGpeAddDelTunnel(getVxlanGpeTunnelRequest((byte) 1 /* is add */, Local.getAddress(),
- Remote.getAddress(), vni, protocol, encapVrfId, decapVrfId, isIpv6));
-
- final VxlanGpeAddDelTunnelReply reply =
- getReplyForCreate(VxlanGpeAddDelTunnelReplyCompletionStage.toCompletableFuture(), id, vxlanGpe);
- LOG.debug("VxlanGpe tunnel set successfully for: {}, VxlanGpe: {}", swIfName, vxlanGpe);
- if (interfaceNamingContext.containsName(reply.swIfIndex, writeContext.getMappingContext())) {
- final String formerName = interfaceNamingContext.getName(reply.swIfIndex, writeContext.getMappingContext());
- LOG.debug("Removing updated mapping of a vxlan-gpe tunnel, id: {}, former name: {}, new name: {}",
- reply.swIfIndex, formerName, swIfName);
- interfaceNamingContext.removeName(formerName, writeContext.getMappingContext());
- }
-
- // Removing disability of an interface in case a vxlan-gpe tunnel formerly deleted is being reused in VPP
- // further details in above comment
- if (interfaceDisableContext.isInterfaceDisabled(reply.swIfIndex, writeContext.getMappingContext())) {
- LOG.debug("Removing disability of vxlan tunnel, id: {}, name: {}", reply.swIfIndex, swIfName);
- interfaceDisableContext.removeDisabledInterface(reply.swIfIndex, writeContext.getMappingContext());
- }
-
- // Add new interface to our interface context
- interfaceNamingContext.addName(reply.swIfIndex, swIfName, writeContext.getMappingContext());
- }
-
- private boolean isIpv6(final VxlanGpe vxlanGpe) {
- if (vxlanGpe.getLocal().getIpv4Address() == null) {
- checkArgument(vxlanGpe.getRemote().getIpv4Address() == null, "Inconsistent ip addresses: %s, %s",
- vxlanGpe.getLocal(),
- vxlanGpe.getRemote());
- return true;
- } else {
- checkArgument(vxlanGpe.getRemote().getIpv6Address() == null, "Inconsistent ip addresses: %s, %s",
- vxlanGpe.getLocal(),
- vxlanGpe.getRemote());
- return false;
- }
- }
-
- private String getAddressString(final IpAddress addr) {
- return addr.getIpv4Address() == null
- ? addr.getIpv6Address().getValue()
- : addr.getIpv4Address().getValue();
- }
-
- private void deleteVxlanGpeTunnel(final InstanceIdentifier<VxlanGpe> id, final String swIfName,
- final VxlanGpe vxlanGpe, final WriteContext writeContext)
- throws WriteFailedException {
- final byte isIpv6 = (byte) (isIpv6(vxlanGpe)
- ? 1
- : 0);
- final InetAddress local = InetAddresses.forString(getAddressString(vxlanGpe.getLocal()));
- final InetAddress remote = InetAddresses.forString(getAddressString(vxlanGpe.getRemote()));
-
- int vni = vxlanGpe.getVni().getValue().intValue();
- byte protocol = (byte) vxlanGpe.getNextProtocol().getIntValue();
- int encapVrfId = vxlanGpe.getEncapVrfId().intValue();
- int decapVrfId = vxlanGpe.getDecapVrfId().intValue();
-
- LOG.debug("Deleting VxlanGpe tunnel for interface: {}. VxlanGpe: {}", swIfName, vxlanGpe);
- final CompletionStage<VxlanGpeAddDelTunnelReply> VxlanGpeAddDelTunnelReplyCompletionStage =
- getFutureJVpp()
- .vxlanGpeAddDelTunnel(getVxlanGpeTunnelRequest((byte) 0 /* is delete */, local.getAddress(),
- remote.getAddress(), vni, protocol, encapVrfId, decapVrfId, isIpv6));
- getReplyForDelete(VxlanGpeAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
- final int index = interfaceNamingContext.getIndex(swIfName, writeContext.getMappingContext());
- // Mark this interface as disabled to not include it in operational reads
- // because VPP will keep the interface there
- LOG.debug("Marking vxlan tunnel as disabled, id: {}, name: {}", index, swIfName);
- interfaceDisableContext.disableInterface(index, writeContext.getMappingContext());
- // Remove interface from our interface naming context
- interfaceNamingContext.removeName(swIfName, writeContext.getMappingContext());
- }
-
- private static VxlanGpeAddDelTunnel getVxlanGpeTunnelRequest(final byte isAdd, final byte[] local,
- final byte[] remote,
- final int vni, final byte protocol,
- final int encapVrfId, final int decapVrfId,
- final byte isIpv6) {
- final VxlanGpeAddDelTunnel VxlanGpeAddDelTunnel = new VxlanGpeAddDelTunnel();
- VxlanGpeAddDelTunnel.isAdd = isAdd;
- VxlanGpeAddDelTunnel.local = local;
- VxlanGpeAddDelTunnel.remote = remote;
- VxlanGpeAddDelTunnel.vni = vni;
- VxlanGpeAddDelTunnel.protocol = protocol;
- VxlanGpeAddDelTunnel.encapVrfId = encapVrfId;
- VxlanGpeAddDelTunnel.decapVrfId = decapVrfId;
- VxlanGpeAddDelTunnel.isIpv6 = isIpv6;
- return VxlanGpeAddDelTunnel;
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/IetfAclWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/IetfAclWriter.java
deleted file mode 100644
index e46f53ebf..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/IetfAclWriter.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl;
-
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import java.util.Optional;
-import java.util.stream.Stream;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.AccessLists;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.AclBase;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.Acl;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.AclKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Writer customizer responsible for Access Control Lists management. Does not send any messages to VPP. All the config
- * data are stored in HC and used when acl is assigned/unassigned to/from an interface.
- *
- * ACLs that are currently assigned to an interface cannot be updated/deleted.
- */
-public class IetfAclWriter implements ListWriterCustomizer<Acl, AclKey> {
-
- public static final InstanceIdentifier<AccessLists> ACL_ID =
- InstanceIdentifier.create(AccessLists.class);
-
- private static final Logger LOG = LoggerFactory.getLogger(IetfAclWriter.class);
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Acl> id, @Nonnull final Acl dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- LOG.debug("Creating ACL: iid={} dataAfter={}", id, dataAfter);
-
- // no vpp call, just updates DataTree
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Acl> id, @Nonnull final Acl dataBefore,
- @Nonnull final Acl dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("Updating ACL: iid={} dataBefore={} dataAfter={}", id, dataBefore, dataAfter);
-
- if (isAssigned(dataAfter, writeContext)) {
- throw new WriteFailedException(id,
- String.format("Failed to update data at %s: acl %s is already assigned", id, dataAfter));
- }
-
- LOG.debug("Updating unassigned ACL: iid={} dataBefore={} dataAfter={}", id, dataBefore, dataAfter);
-
- // no vpp call, just updates DataTree
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Acl> id, @Nonnull final Acl dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- LOG.debug("Deleting ACL: iid={} dataBefore={}", id, dataBefore);
-
- if (isAssigned(dataBefore, writeContext)) {
- throw new WriteFailedException(id,
- String.format("Failed to delete data at %s: acl %s is already assigned", id, dataBefore));
- }
-
- LOG.debug("Deleting unassigned ACL: iid={} dataBefore={}", id, dataBefore);
-
- // no vpp call, just updates DataTree
- }
-
- private static boolean isAssigned(@Nonnull final Acl acl,
- @Nonnull final WriteContext writeContext) {
- final String aclName = acl.getAclName();
- final Class<? extends AclBase> aclType = acl.getAclType();
- final Interfaces interfaces = writeContext.readAfter(InstanceIdentifier.create(Interfaces.class)).get();
-
- return interfaces.getInterface().stream()
- .map(i -> Optional.ofNullable(i.getAugmentation(VppInterfaceAugmentation.class))
- .map(aug -> aug.getIetfAcl())
- .map(ietfAcl -> ietfAcl.getIngress())
- .map(ingress -> ingress.getAccessLists())
- .map(accessLists -> accessLists.getAcl())
- )
- .flatMap(iacl -> iacl.isPresent()
- ? iacl.get().stream()
- : Stream.empty())
- .filter(assignedAcl -> aclName.equals(assignedAcl.getName()) && aclType.equals(assignedAcl.getType()))
- .findFirst().isPresent();
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AbstractIetfAclWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AbstractIetfAclWriter.java
deleted file mode 100644
index 347397aa3..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AbstractIetfAclWriter.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-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.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSessionReply;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTableReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.concurrent.CompletionStage;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.AclBase;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.AclKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.AccessListEntries;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.Ace;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.PacketHandling;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.AceType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.AceEth;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIp;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.AceIpVersion;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.ace.ip.version.AceIpv4;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.ace.ip.version.AceIpv6;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.mapping.table.MappingEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIpAndEth;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessLists;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.access.lists.Acl;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class AbstractIetfAclWriter implements IetfAclWriter, JvppReplyConsumer, AclTranslator {
-
- private static final Logger LOG = LoggerFactory.getLogger(AbstractIetfAclWriter.class);
- protected static final int NOT_DEFINED = -1;
- protected final FutureJVppCore jvpp;
-
- private Map<AclType, AceWriter<? extends AceType>> aceWriters = new HashMap<>();
-
- public AbstractIetfAclWriter(@Nonnull final FutureJVppCore futureJVppCore) {
- this.jvpp = Preconditions.checkNotNull(futureJVppCore, "futureJVppCore should not be null");
- aceWriters.put(AclType.ETH, new AceEthWriter());
- aceWriters.put(AclType.IP4, new AceIp4Writer());
- aceWriters.put(AclType.IP6, new AceIp6Writer());
- aceWriters.put(AclType.ETH_AND_IP, new AceIpAndEthWriter());
- }
-
- private static Stream<Ace> aclToAceStream(@Nonnull final Acl assignedAcl,
- @Nonnull final WriteContext writeContext) {
- final String aclName = assignedAcl.getName();
- final Class<? extends AclBase> aclType = assignedAcl.getType();
-
- // ietf-acl updates are handled first, so we use writeContext.readAfter
- final Optional<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.Acl>
- aclOptional =
- writeContext.readAfter(io.fd.honeycomb.translate.v3po.interfaces.acl.IetfAclWriter.ACL_ID.child(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.Acl.class,
- new AclKey(aclName, aclType)));
- checkArgument(aclOptional.isPresent(), "Acl lists not configured");
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.Acl
- acl = aclOptional.get();
-
- final AccessListEntries accessListEntries = acl.getAccessListEntries();
- checkArgument(accessListEntries != null, "access list entries not configured");
-
- return accessListEntries.getAce().stream();
- }
-
- protected void removeClassifyTables(@Nonnull final InstanceIdentifier<?> id, @Nonnull final MappingEntry entry)
- throws WriteFailedException {
- removeClassifyTable(id, entry.getL2TableId());
- removeClassifyTable(id, entry.getIp4TableId());
- removeClassifyTable(id, entry.getIp6TableId());
- }
-
- private void removeClassifyTable(@Nonnull final InstanceIdentifier<?> id, final int tableIndex)
- throws WriteFailedException {
-
- if (tableIndex == -1) {
- return; // classify table id is absent
- }
- final ClassifyAddDelTable request = new ClassifyAddDelTable();
- request.tableIndex = tableIndex;
- final CompletionStage<ClassifyAddDelTableReply> cs = jvpp.classifyAddDelTable(request);
- getReplyForDelete(cs.toCompletableFuture(), id);
- }
-
- protected static boolean appliesToIp4Path(final Ace ace) {
- final AceType aceType = ace.getMatches().getAceType();
- final AclType aclType = AclType.fromAce(ace);
- if (aclType == AclType.IP4) {
- return true;
- }
- if (aclType == AclType.ETH) {
- return true; // L2 only rules are possible for IP4 traffic
- }
- if (aclType == AclType.ETH_AND_IP && ((AceIpAndEth) aceType)
- .getAceIpVersion() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.and.eth.ace.ip.version.AceIpv4) {
- return true;
- }
- return false;
- }
-
- protected static boolean appliesToIp6Path(final Ace ace) {
- final AceType aceType = ace.getMatches().getAceType();
- final AclType aclType = AclType.fromAce(ace);
- if (aclType == AclType.IP6) {
- return true;
- }
- if (aclType == AclType.ETH) {
- return true; // L2 only rules are possible for IP6 traffic
- }
- if (aclType == AclType.ETH_AND_IP && ((AceIpAndEth) aceType)
- .getAceIpVersion() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.and.eth.ace.ip.version.AceIpv6) {
- return true;
- }
- return false;
- }
-
- protected static List<Ace> getACEs(@Nonnull final List<Acl> acls, @Nonnull final WriteContext writeContext,
- final Predicate<? super Ace> filter) {
- return acls.stream().flatMap(acl -> aclToAceStream(acl, writeContext)).filter(filter)
- .collect(Collectors.toList());
- }
-
- protected int writeAces(final InstanceIdentifier<?> id, final List<Ace> aces,
- final AccessLists.DefaultAction defaultAction, final InterfaceMode mode,
- final int vlanTags) throws WriteFailedException {
- if (aces.isEmpty()) {
- return NOT_DEFINED;
- }
-
- int nextTableIndex = configureDefaultAction(id, defaultAction);
- final ListIterator<Ace> iterator = aces.listIterator(aces.size());
- while (iterator.hasPrevious()) {
- final Ace ace = iterator.previous();
- LOG.trace("Processing ACE: {}", ace);
-
- final AceWriter aceWriter =
- aceWriters.get(AclType.fromAce(ace));
- if (aceWriter == null) {
- LOG.warn("AceProcessor for {} not registered. Skipping ACE.", ace.getClass());
- } else {
- final AceType aceType = ace.getMatches().getAceType();
- final PacketHandling action = ace.getActions().getPacketHandling();
- final ClassifyAddDelTable ctRequest = aceWriter.createTable(aceType, mode, nextTableIndex, vlanTags);
- nextTableIndex = createClassifyTable(id, ctRequest);
- final List<ClassifyAddDelSession> sessionRequests =
- aceWriter.createSession(action, aceType, mode, nextTableIndex, vlanTags);
- for (ClassifyAddDelSession csRequest : sessionRequests) {
- createClassifySession(id, csRequest);
- }
- }
- }
- return nextTableIndex;
- }
-
- private int configureDefaultAction(@Nonnull final InstanceIdentifier<?> id,
- final AccessLists.DefaultAction defaultAction)
- throws WriteFailedException {
- ClassifyAddDelTable ctRequest = createTable(-1);
- if (AccessLists.DefaultAction.Permit.equals(defaultAction)) {
- ctRequest.missNextIndex = -1;
- } else {
- ctRequest.missNextIndex = 0;
- }
- ctRequest.mask = new byte[16];
- ctRequest.skipNVectors = 0;
- ctRequest.matchNVectors = 1;
- return createClassifyTable(id, ctRequest);
- }
-
- private int createClassifyTable(@Nonnull final InstanceIdentifier<?> id,
- @Nonnull final ClassifyAddDelTable request)
- throws WriteFailedException {
- final CompletionStage<ClassifyAddDelTableReply> cs = jvpp.classifyAddDelTable(request);
-
- final ClassifyAddDelTableReply reply = getReplyForWrite(cs.toCompletableFuture(), id);
- return reply.newTableIndex;
- }
-
- private void createClassifySession(@Nonnull final InstanceIdentifier<?> id,
- @Nonnull final ClassifyAddDelSession request)
- throws WriteFailedException {
- final CompletionStage<ClassifyAddDelSessionReply> cs = jvpp.classifyAddDelSession(request);
-
- getReplyForWrite(cs.toCompletableFuture(), id);
- }
-
- private enum AclType {
- ETH, IP4, IP6, ETH_AND_IP;
-
- @Nonnull
- private static AclType fromAce(final Ace ace) {
- AclType result = null;
- final AceType aceType;
- try {
- aceType = ace.getMatches().getAceType();
- if (aceType instanceof AceEth) {
- result = ETH;
- } else if (aceType instanceof AceIp) {
- final AceIpVersion aceIpVersion = ((AceIp) aceType).getAceIpVersion();
- if (aceIpVersion == null) {
- throw new IllegalArgumentException("Incomplete ACE (ip-version was not provided): " + ace);
- }
- if (aceIpVersion instanceof AceIpv4) {
- result = IP4;
- } else if (aceIpVersion instanceof AceIpv6) {
- result = IP6;
- }
- } else if (aceType instanceof AceIpAndEth) {
- result = ETH_AND_IP;
- }
- } catch (NullPointerException e) {
- throw new IllegalArgumentException("Incomplete ACE: " + ace, e);
- }
- if (result == null) {
- throw new IllegalArgumentException(String.format("Not supported ace type %s", aceType));
- }
- return result;
- }
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceEthWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceEthWriter.java
deleted file mode 100644
index 14124dcc7..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceEthWriter.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import com.google.common.annotations.VisibleForTesting;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import java.util.Collections;
-import java.util.List;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.PacketHandling;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.AceEth;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-final class AceEthWriter implements AceWriter<AceEth>, AclTranslator, L2AclTranslator {
-
- @VisibleForTesting
- static final int MATCH_N_VECTORS = 1;
- private static final Logger LOG = LoggerFactory.getLogger(AceEthWriter.class);
-
- @Override
- public ClassifyAddDelTable createTable(@Nonnull final AceEth aceEth,
- @Nullable final InterfaceMode mode,
- final int nextTableIndex,
- final int vlanTags) {
- final ClassifyAddDelTable request = createTable(nextTableIndex);
-
- request.mask = new byte[16];
- boolean aceIsEmpty =
- destinationMacAddressMask(aceEth.getDestinationMacAddressMask(), aceEth.getDestinationMacAddress(),
- request);
- aceIsEmpty &=
- sourceMacAddressMask(aceEth.getSourceMacAddressMask(), aceEth.getSourceMacAddress(), request);
-
- if (aceIsEmpty) {
- throw new IllegalArgumentException(
- String.format("Ace %s does not define packet field match values", aceEth.toString()));
- }
-
- request.skipNVectors = 0;
- request.matchNVectors = MATCH_N_VECTORS;
-
- LOG.debug("ACE rule={} translated to table={}.", aceEth, request);
- return request;
- }
-
- @Override
- public List<ClassifyAddDelSession> createSession(@Nonnull final PacketHandling action,
- @Nonnull final AceEth aceEth,
- @Nullable final InterfaceMode mode,
- final int tableIndex,
- final int vlanTags) {
- final ClassifyAddDelSession request = createSession(action, tableIndex);
-
- request.match = new byte[16];
- boolean noMatch = destinationMacAddressMatch(aceEth.getDestinationMacAddress(), request);
- noMatch &= sourceMacAddressMatch(aceEth.getSourceMacAddress(), request);
-
- if (noMatch) {
- throw new IllegalArgumentException(
- String.format("Ace %s does not define neither source nor destination MAC address",
- aceEth.toString()));
- }
-
- LOG.debug("ACE action={}, rule={} translated to session={}.", action, aceEth, request);
- return Collections.singletonList(request);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIp4Writer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIp4Writer.java
deleted file mode 100644
index 7d75e3969..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIp4Writer.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import com.google.common.annotations.VisibleForTesting;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import java.util.ArrayList;
-import java.util.List;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.PacketHandling;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIp;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.ace.ip.version.AceIpv4;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-final class AceIp4Writer implements AceWriter<AceIp>, AclTranslator, Ip4AclTranslator {
-
- @VisibleForTesting
- static final int MATCH_N_VECTORS = 3; // number of 16B vectors
- private static final int TABLE_MASK_LENGTH = 48;
- private static final Logger LOG = LoggerFactory.getLogger(AceIp4Writer.class);
-
- @Override
- public ClassifyAddDelTable createTable(@Nonnull final AceIp aceIp,
- @Nullable final InterfaceMode mode,
- final int nextTableIndex,
- final int vlanTags) {
- checkArgument(aceIp.getAceIpVersion() instanceof AceIpv4, "Expected AceIpv4 version, but was %", aceIp);
- final AceIpv4 ipVersion = (AceIpv4) aceIp.getAceIpVersion();
-
- final int numberOfSessions = PortPair.fromRange(aceIp.getSourcePortRange(), aceIp.getDestinationPortRange()).size();
- final ClassifyAddDelTable request = createTable(nextTableIndex, numberOfSessions);
- request.skipNVectors = 0; // match entire L2 and L3 header
- request.matchNVectors = MATCH_N_VECTORS;
- request.mask = new byte[TABLE_MASK_LENGTH];
-
- final int baseOffset = getVlanTagsLen(vlanTags);
- boolean aceIsEmpty = ip4Mask(baseOffset, mode, aceIp, ipVersion, request);
- if (aceIsEmpty) {
- throw new IllegalArgumentException(
- String.format("Ace %s does not define packet field match values", aceIp.toString()));
- }
-
- LOG.debug("ACE rule={} translated to table={}.", aceIp, request);
- return request;
- }
-
- @Override
- public List<ClassifyAddDelSession> createSession(@Nonnull final PacketHandling action,
- @Nonnull final AceIp aceIp,
- @Nullable final InterfaceMode mode,
- final int tableIndex,
- final int vlanTags) {
- checkArgument(aceIp.getAceIpVersion() instanceof AceIpv4, "Expected AceIpv4 version, but was %", aceIp);
- final AceIpv4 ipVersion = (AceIpv4) aceIp.getAceIpVersion();
-
- final List<PortPair> portPairs = PortPair.fromRange(aceIp.getSourcePortRange(), aceIp.getDestinationPortRange());
- final List<ClassifyAddDelSession> requests = new ArrayList<>(portPairs.size());
- for (final PortPair pair : portPairs) {
- final ClassifyAddDelSession request = createSession(action, tableIndex);
- request.match = new byte[TABLE_MASK_LENGTH];
-
- final int baseOffset = getVlanTagsLen(vlanTags);
- boolean noMatch = ip4Match(baseOffset, mode, aceIp, ipVersion, pair.getSrc(), pair.getDst(), request);
- if (noMatch) {
- throw new IllegalArgumentException(
- String.format("Ace %s does not define packet field match values", aceIp.toString()));
- }
-
- LOG.debug("ACE action={}, rule={} translated to session={}.", action, aceIp, request);
- requests.add(request);
- }
- return requests;
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIp6Writer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIp6Writer.java
deleted file mode 100644
index cad80022e..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIp6Writer.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import java.util.ArrayList;
-import java.util.List;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.PacketHandling;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIp;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.ace.ip.version.AceIpv6;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-final class AceIp6Writer implements AceWriter<AceIp>, AclTranslator, Ip6AclTranslator {
-
- private static final Logger LOG = LoggerFactory.getLogger(AceIp6Writer.class);
-
- @Override
- public ClassifyAddDelTable createTable(@Nonnull final AceIp aceIp,
- @Nullable final InterfaceMode mode,
- final int nextTableIndex,
- final int vlanTags) {
- checkArgument(aceIp.getAceIpVersion() instanceof AceIpv6, "Expected AceIpv6 version, but was %", aceIp);
- final AceIpv6 ipVersion = (AceIpv6) aceIp.getAceIpVersion();
-
- final int numberOfSessions = PortPair.fromRange(aceIp.getSourcePortRange(), aceIp.getDestinationPortRange()).size();
- final ClassifyAddDelTable request = createTable(nextTableIndex, numberOfSessions);
- request.skipNVectors = 0; // match entire L2 and L3 header
- request.mask = new byte[getTableMaskLength(vlanTags)];
- request.matchNVectors = request.mask.length/16;
-
- final int baseOffset = getVlanTagsLen(vlanTags);
- boolean aceIsEmpty = ip6Mask(baseOffset, mode, aceIp, ipVersion, request);
- if (aceIsEmpty) {
- throw new IllegalArgumentException(
- String.format("Ace %s does not define packet field match values", aceIp.toString()));
- }
-
- LOG.debug("ACE rule={} translated to table={}.", aceIp, request);
- return request;
- }
-
- private static int getTableMaskLength(final int vlanTags) {
- if (vlanTags == 2) {
- return 80;
- } else {
- return 64;
- }
- }
-
- @Override
- public List<ClassifyAddDelSession> createSession(@Nonnull final PacketHandling action,
- @Nonnull final AceIp aceIp,
- @Nullable final InterfaceMode mode,
- final int tableIndex,
- final int vlanTags) {
- checkArgument(aceIp.getAceIpVersion() instanceof AceIpv6, "Expected AceIpv6 version, but was %", aceIp);
- final AceIpv6 ipVersion = (AceIpv6) aceIp.getAceIpVersion();
- final List<PortPair> portPairs =
- PortPair.fromRange(aceIp.getSourcePortRange(), aceIp.getDestinationPortRange());
-
- final List<ClassifyAddDelSession> requests = new ArrayList<>(portPairs.size());
- for (final PortPair pair : portPairs) {
- final ClassifyAddDelSession request = createSession(action, tableIndex);
- request.match = new byte[getTableMaskLength(vlanTags)];
-
- final int baseOffset = getVlanTagsLen(vlanTags);
- boolean noMatch = ip6Match(baseOffset, mode, aceIp, ipVersion, pair.getSrc(), pair.getDst(), request);
- if (noMatch) {
- throw new IllegalArgumentException(
- String.format("Ace %s does not define packet field match values", aceIp.toString()));
- }
-
- LOG.debug("ACE action={}, rule={} translated to session={}.", action, aceIp, request);
- requests.add(request);
- }
- return requests;
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIpAndEthWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIpAndEthWriter.java
deleted file mode 100644
index ca12cbe19..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIpAndEthWriter.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import java.util.ArrayList;
-import java.util.List;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.PacketHandling;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIpAndEth;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.and.eth.AceIpVersion;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.and.eth.ace.ip.version.AceIpv4;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.and.eth.ace.ip.version.AceIpv6;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class AceIpAndEthWriter
- implements AceWriter<AceIpAndEth>, AclTranslator, L2AclTranslator, Ip4AclTranslator, Ip6AclTranslator {
-
- private static final Logger LOG = LoggerFactory.getLogger(AceIpAndEthWriter.class);
-
- private static int maskLength(@Nonnull final AceIpAndEth ace, final int vlanTags) {
- if (ace.getAceIpVersion() != null) {
- if (ace.getAceIpVersion() instanceof AceIpv4) {
- return 48;
- } else {
- return vlanTags == 2
- ? 80
- : 64;
- }
- }
- return 16;
- }
-
- @Override
- public ClassifyAddDelTable createTable(@Nonnull final AceIpAndEth ace, @Nullable final InterfaceMode mode,
- final int nextTableIndex, final int vlanTags) {
- final int numberOfSessions = PortPair.fromRange(ace.getSourcePortRange(), ace.getDestinationPortRange()).size();
- final ClassifyAddDelTable request = createTable(nextTableIndex, numberOfSessions);
- final int maskLength = maskLength(ace, vlanTags);
- request.mask = new byte[maskLength];
- request.skipNVectors = 0;
- request.matchNVectors = maskLength / 16;
-
- boolean aceIsEmpty =
- destinationMacAddressMask(ace.getDestinationMacAddressMask(), ace.getDestinationMacAddress(), request);
- aceIsEmpty &= sourceMacAddressMask(ace.getSourceMacAddressMask(), ace.getSourceMacAddress(), request);
-
- // if we use classifier API, we need to know ip version (fields common for ip4 and ip6 have different offsets):
- final AceIpVersion aceIpVersion = ace.getAceIpVersion();
- checkArgument(aceIpVersion != null, "AceIpAndEth have to define IpVersion");
-
- final int baseOffset = getVlanTagsLen(vlanTags);
- if (aceIpVersion instanceof AceIpv4) {
- final AceIpv4 ipVersion = (AceIpv4) aceIpVersion;
- aceIsEmpty &= ip4Mask(baseOffset, mode, ace, ipVersion, request);
- } else if (aceIpVersion instanceof AceIpv6) {
- final AceIpv6 ipVersion = (AceIpv6) aceIpVersion;
- aceIsEmpty &= ip6Mask(baseOffset, mode, ace, ipVersion, request);
- } else {
- throw new IllegalArgumentException(String.format("Unsupported IP version %s", aceIpVersion));
- }
-
- if (aceIsEmpty) {
- throw new IllegalArgumentException(
- String.format("Ace %s does not define packet field match values", ace.toString()));
- }
-
- LOG.debug("ACE rule={} translated to table={}.", ace, request);
- return request;
- }
-
- @Override
- public List<ClassifyAddDelSession> createSession(@Nonnull final PacketHandling action,
- @Nonnull final AceIpAndEth ace,
- @Nullable final InterfaceMode mode, final int tableIndex,
- final int vlanTags) {
- final List<PortPair> portPairs = PortPair.fromRange(ace.getSourcePortRange(), ace.getDestinationPortRange());
- final List<ClassifyAddDelSession> requests = new ArrayList<>(portPairs.size());
- for (final PortPair pair : portPairs) {
- final ClassifyAddDelSession request = createSession(action, tableIndex);
- request.match = new byte[maskLength(ace, vlanTags)];
-
- boolean noMatch = destinationMacAddressMatch(ace.getDestinationMacAddress(), request);
- noMatch &= sourceMacAddressMatch(ace.getSourceMacAddress(), request);
-
- final AceIpVersion aceIpVersion = ace.getAceIpVersion();
- checkArgument(aceIpVersion != null, "AceIpAndEth have to define IpVersion");
-
- final int baseOffset = getVlanTagsLen(vlanTags);
- if (aceIpVersion instanceof AceIpv4) {
- final AceIpv4 ipVersion = (AceIpv4) aceIpVersion;
- noMatch &= ip4Match(baseOffset, mode, ace, ipVersion, pair.getSrc(), pair.getDst(), request);
- } else if (aceIpVersion instanceof AceIpv6) {
- final AceIpv6 ipVersion = (AceIpv6) aceIpVersion;
- noMatch &= ip6Match(baseOffset, mode, ace, ipVersion, pair.getSrc(), pair.getDst(), request);
- } else {
- throw new IllegalArgumentException(String.format("Unsupported IP version %s", aceIpVersion));
- }
-
- if (noMatch) {
- throw new IllegalArgumentException(
- String.format("Ace %s does not define packet field match values", ace.toString()));
- }
- LOG.debug("ACE action={}, rule={} translated to session={}.", action, ace, request);
- requests.add(request);
- }
- return requests;
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceWriter.java
deleted file mode 100644
index ae540f94d..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceWriter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import java.util.List;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.PacketHandling;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.AceType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
-
-/**
- * Writer responsible for translation of ietf-acl model ACEs to VPP's classify tables and sessions.
- *
- * @param <T> type of access control list entry
- */
-interface AceWriter<T extends AceType> {
- /**
- * @param ace access list entry
- * @param mode interface mode (L2/L3)
- * @param nextTableIndex index of the next classify table in chain
- * @param vlanTags number of vlan tags
- */
- @Nonnull
- ClassifyAddDelTable createTable(@Nonnull final T ace, @Nullable final InterfaceMode mode, final int nextTableIndex,
- final int vlanTags);
-
- /**
- * @param action to be taken when packet does match the specified ace
- * @param ace access list entry
- * @param mode interface mode (L2/L3)
- * @param tableIndex index of corresponding classify table
- * @param vlanTags number of vlan tags
- */
- @Nonnull
- List<ClassifyAddDelSession> createSession(@Nonnull final PacketHandling action, @Nonnull T ace,
- @Nullable final InterfaceMode mode, final int tableIndex, final int vlanTags);
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AclTableContextManager.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AclTableContextManager.java
deleted file mode 100644
index bddc16a23..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AclTableContextManager.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.MappingContext;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.mapping.table.MappingEntry;
-
-/**
- * Manages interface metadata for ietf-acl model.
- */
-public interface AclTableContextManager {
-
- /**
- * Obtains mapping entry for given interface.
- *
- * @param index interface index
- * @param mappingContext mapping context providing context data for current transaction
- * @return ietf-acl metadata for given interface
- */
- Optional<MappingEntry> getEntry(final int index, @Nonnull final MappingContext mappingContext);
-
- /**
- * Adds mapping entry.
- *
- * @param entry to be added
- * @param mappingContext mapping context providing context data for current transaction
- */
- void addEntry(@Nonnull final MappingEntry entry, @Nonnull final MappingContext mappingContext);
-
- /**
- * Removes entry for given interface (if present).
- *
- * @param index interface index
- * @param mappingContext mapping context providing context data for current transaction
- */
- void removeEntry(final int index, @Nonnull final MappingContext mappingContext);
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AclTableContextManagerImpl.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AclTableContextManagerImpl.java
deleted file mode 100644
index 60fb0d24b..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AclTableContextManagerImpl.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.MappingContext;
-import javax.annotation.Nonnull;
-import javax.annotation.concurrent.ThreadSafe;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.Contexts;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.AclMappingEntryCtxAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.AclMappingEntryContext;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.MappingTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.MappingTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.mapping.table.MappingEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.mapping.table.MappingEntryKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-@ThreadSafe
-public class AclTableContextManagerImpl implements AclTableContextManager {
-
- private MappingTable.Direction direction;
-
- public AclTableContextManagerImpl(@Nonnull final MappingTable.Direction direction) {
- this.direction = checkNotNull(direction, "direction should not be null");
- }
-
- @Nonnull
- @Override
- public synchronized Optional<MappingEntry> getEntry(final int swIfIndex, @Nonnull final MappingContext mappingContext) {
- return mappingContext.read(getId(swIfIndex));
- }
-
- @Override
- public synchronized void addEntry(@Nonnull final MappingEntry entry, @Nonnull final MappingContext mappingContext) {
- mappingContext.put(getId(entry.getIndex()), entry);
- }
-
- @Override
- public synchronized void removeEntry(final int swIfIndex, @Nonnull final MappingContext mappingContext) {
- mappingContext.delete(getId(swIfIndex));
- }
-
- @VisibleForTesting
- protected InstanceIdentifier<MappingEntry> getId(final int index) {
- return InstanceIdentifier.create(Contexts.class)
- .augmentation(AclMappingEntryCtxAugmentation.class)
- .child(AclMappingEntryContext.class)
- .child(MappingTable.class, new MappingTableKey(direction))
- .child(MappingEntry.class, new MappingEntryKey(index));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AclTranslator.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AclTranslator.java
deleted file mode 100644
index 2d898f1d9..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AclTranslator.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import javax.annotation.Nonnegative;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.PacketHandling;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.packet.handling.Permit;
-
-/**
- * Utility that helps translating of ietf-acl model ACEs to VPP's classify tables and sessions.
- */
-interface AclTranslator {
- int TABLE_MEM_SIZE = 8 * 1024;
- int VLAN_TAG_LEN = 4;
-
- default ClassifyAddDelTable createTable(final int nextTableIndex) {
- return createTable(nextTableIndex, 1);
- }
-
- default ClassifyAddDelTable createTable(final int nextTableIndex, @Nonnegative final int numberOfSessions) {
- final ClassifyAddDelTable request = new ClassifyAddDelTable();
- request.isAdd = 1;
- request.tableIndex = -1; // value not present
- request.nbuckets = numberOfSessions;
- request.nextTableIndex = nextTableIndex;
-
-
- // TODO: HONEYCOMB-181 minimise memory used by classify tables (we create a lot of them to make ietf-acl model
- // mapping more convenient):
- // according to https://wiki.fd.io/view/VPP/Introduction_To_N-tuple_Classifiers#Creating_a_classifier_table,
- // classify table needs 16*(1 + match_n_vectors) bytes, but this does not quite work,
- // so setting 8K +1k*numberOfSessions for now
- checkArgument(numberOfSessions>0, "negative numberOfSessions %s", numberOfSessions);
- request.memorySize = TABLE_MEM_SIZE+1024*(numberOfSessions-1);
- request.missNextIndex = -1; // value not set, but anyway it is ignored for tables in chain
- return request;
- }
-
- default ClassifyAddDelSession createSession(@Nonnull final PacketHandling action, final int tableIndex) {
- final ClassifyAddDelSession request = new ClassifyAddDelSession();
- request.isAdd = 1;
- request.tableIndex = tableIndex;
- request.opaqueIndex = ~0; // value not used
-
- if (action instanceof Permit) {
- request.hitNextIndex = -1;
- } // deny (0) is default value
-
- return request;
- }
-
- default int getVlanTagsLen(final int vlanTags) {
- return vlanTags * VLAN_TAG_LEN;
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/IetfAclWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/IetfAclWriter.java
deleted file mode 100644
index 2e8750cd5..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/IetfAclWriter.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import java.util.List;
-import javax.annotation.Nonnegative;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessLists;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.access.lists.Acl;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public interface IetfAclWriter {
- default void write(@Nonnull final InstanceIdentifier<?> id, final int ifIndex, @Nonnull final List<Acl> acls,
- final AccessLists.DefaultAction defaultAction, @Nullable final InterfaceMode mode,
- @Nonnull final WriteContext writeContext, @Nonnull final MappingContext mappingContext)
- throws WriteFailedException {
- write(id, ifIndex, acls, defaultAction, mode, writeContext, 0, mappingContext);
- }
-
- void write(@Nonnull final InstanceIdentifier<?> id, int ifIndex, @Nonnull final List<Acl> acls,
- final AccessLists.DefaultAction defaultAction, @Nullable InterfaceMode mode,
- @Nonnull final WriteContext writeContext, @Nonnegative final int numberOfTags,
- @Nonnull final MappingContext mappingContext)
- throws WriteFailedException;
-
- void deleteAcl(@Nonnull final InstanceIdentifier<?> id, int ifIndex, @Nonnull final MappingContext mappingContext)
- throws WriteFailedException;
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/Ip4AclTranslator.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/Ip4AclTranslator.java
deleted file mode 100644
index 304d6c1f0..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/Ip4AclTranslator.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import com.google.common.primitives.Ints;
-import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.AclIpHeaderFields;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.AclIpv4HeaderFields;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
-
-interface Ip4AclTranslator extends Ipv4Translator {
- int ETHER_TYPE_OFFSET = 12; // first 14 bytes represent L2 header (2x6)
- int DSCP_OFFSET = 15;
- int DSCP_MASK = 0xfc;
-
- int IP_PROTOCOL_OFFSET = ETHER_TYPE_OFFSET + 11;
- int IP_PROTOCOL_MASK = 0xff;
-
- int IP4_LEN = 4;
- int IP4_MASK_BIT_LENGTH = 32;
- int SRC_IP_OFFSET = ETHER_TYPE_OFFSET + 14;
- int DST_IP_OFFSET = SRC_IP_OFFSET + IP4_LEN;
- int SRC_PORT_OFFSET = DST_IP_OFFSET + IP4_LEN;
- int DST_PORT_OFFSET = SRC_PORT_OFFSET + 2;
-
- default boolean ip4Mask(final int baseOffset, final InterfaceMode mode, final AclIpHeaderFields header,
- final AclIpv4HeaderFields ip4, final ClassifyAddDelTable request) {
- boolean aceIsEmpty = true;
- if (InterfaceMode.L2.equals(mode)) {
- // in L2 mode we need to match ether type
- request.mask[baseOffset + ETHER_TYPE_OFFSET] = (byte) 0xff;
- request.mask[baseOffset + ETHER_TYPE_OFFSET + 1] = (byte) 0xff;
- }
- if (header.getDscp() != null) {
- aceIsEmpty = false;
- request.mask[baseOffset + DSCP_OFFSET] = (byte) DSCP_MASK; // first 6 bits
- }
- if (header.getProtocol() != null) { // Internet Protocol number
- aceIsEmpty = false;
- request.mask[baseOffset + IP_PROTOCOL_OFFSET] = (byte) IP_PROTOCOL_MASK;
- }
- if (header.getSourcePortRange() != null) {
- // TODO (HONEYCOMB-253): port matching will not work correctly if Options are present
- aceIsEmpty = false;
- request.mask[baseOffset + SRC_PORT_OFFSET] = (byte) 0xff;
- request.mask[baseOffset + SRC_PORT_OFFSET + 1] = (byte) 0xff;
- }
- if (header.getDestinationPortRange() != null) {
- // TODO (HONEYCOMB-253): port matching will not work correctly if Options are present
- aceIsEmpty = false;
- request.mask[baseOffset + DST_PORT_OFFSET] = (byte) 0xff;
- request.mask[baseOffset + DST_PORT_OFFSET + 1] = (byte) 0xff;
- }
- if (ip4.getSourceIpv4Network() != null) {
- aceIsEmpty = false;
- System.arraycopy(Impl.toByteMask(ip4.getSourceIpv4Network()), 0, request.mask,
- baseOffset + SRC_IP_OFFSET, IP4_LEN);
- }
- if (ip4.getDestinationIpv4Network() != null) {
- aceIsEmpty = false;
- System.arraycopy(Impl.toByteMask(ip4.getDestinationIpv4Network()), 0, request.mask,
- baseOffset + DST_IP_OFFSET, IP4_LEN);
- }
- return aceIsEmpty;
- }
-
- default boolean ip4Match(final int baseOffset, final InterfaceMode mode, final AclIpHeaderFields header,
- final AclIpv4HeaderFields ip4, final Integer srcPort,
- final Integer dstPort, final ClassifyAddDelSession request) {
- boolean noMatch = true;
- if (InterfaceMode.L2.equals(mode)) {
- // match IP4 etherType (0x0800)
- request.match[baseOffset + ETHER_TYPE_OFFSET] = 0x08;
- request.match[baseOffset + ETHER_TYPE_OFFSET + 1] = 0x00;
- }
- if (header.getDscp() != null) {
- noMatch = false;
- request.match[baseOffset + DSCP_OFFSET] = (byte) (DSCP_MASK & (header.getDscp().getValue() << 2));
- }
- if (header.getProtocol() != null) { // Internet Protocol number
- noMatch = false;
- request.match[baseOffset + IP_PROTOCOL_OFFSET] = (byte) (IP_PROTOCOL_MASK & header.getProtocol());
- }
- if (srcPort != null) {
- // TODO (HONEYCOMB-253): port matching will not work correctly if Options are present
- noMatch = false;
- request.match[baseOffset + SRC_PORT_OFFSET] = (byte) (0xff & srcPort >> 8);
- request.match[baseOffset + SRC_PORT_OFFSET + 1] = (byte) (0xff & srcPort);
- }
- if (header.getDestinationPortRange() != null) {
- // TODO (HONEYCOMB-253): port matching will not work correctly if Options are present
- noMatch = false;
- request.match[baseOffset + DST_PORT_OFFSET] = (byte) (0xff & dstPort >> 8);
- request.match[baseOffset + DST_PORT_OFFSET + 1] = (byte) (0xff & dstPort);
- }
- if (ip4.getSourceIpv4Network() != null) {
- noMatch = false;
- System.arraycopy(Impl.toMatchValue(ip4.getSourceIpv4Network()), 0, request.match,
- baseOffset + SRC_IP_OFFSET, IP4_LEN);
-
- }
- if (ip4.getDestinationIpv4Network() != null) {
- noMatch = false;
- System.arraycopy(Impl.toMatchValue(ip4.getDestinationIpv4Network()), 0, request.match,
- baseOffset + DST_IP_OFFSET, IP4_LEN);
-
- }
- return noMatch;
- }
-
- class Impl {
- private static byte[] toByteMask(final int prefixLength) {
- final long mask = ((1L << prefixLength) - 1) << (IP4_MASK_BIT_LENGTH - prefixLength);
- return Ints.toByteArray((int) mask);
- }
-
- private static byte[] toByteMask(final Ipv4Prefix ipv4Prefix) {
- final int prefixLength = Byte.valueOf(ipv4Prefix.getValue().split("/")[1]);
- return toByteMask(prefixLength);
- }
-
- private static byte[] toMatchValue(final Ipv4Prefix ipv4Prefix) {
- final String[] split = ipv4Prefix.getValue().split("/");
- final byte[] addressBytes = Ipv4Translator.INSTANCE.ipv4AddressNoZoneToArray(split[0]);
- final byte[] mask = Impl.toByteMask(Byte.valueOf(split[1]));
- for (int i = 0; i < addressBytes.length; ++i) {
- addressBytes[i] &= mask[i];
- }
- return addressBytes;
- }
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/Ip6AclTranslator.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/Ip6AclTranslator.java
deleted file mode 100644
index c0da75687..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/Ip6AclTranslator.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.BitSet;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.AclIpHeaderFields;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.AclIpv6HeaderFields;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
-
-interface Ip6AclTranslator {
-
- int ETHER_TYPE_OFFSET = 12; // first 14 bytes represent L2 header (2x6)
- int IP_VERSION_OFFSET = ETHER_TYPE_OFFSET + 2;
- int DSCP_MASK1 = 0x0f;
- int DSCP_MASK2 = 0xc0;
- int IP_PROTOCOL_OFFSET = IP_VERSION_OFFSET + 6;
- int IP_PROTOCOL_MASK = 0xff;
- int IP6_LEN = 16;
- int SRC_IP_OFFSET = IP_VERSION_OFFSET + 8;
- int DST_IP_OFFSET = SRC_IP_OFFSET + IP6_LEN;
- int SRC_PORT_OFFSET = DST_IP_OFFSET + IP6_LEN;
- int DST_PORT_OFFSET = SRC_PORT_OFFSET + 2;
-
- default boolean ip6Mask(final int baseOffset, final InterfaceMode mode, final AclIpHeaderFields header,
- final AclIpv6HeaderFields ip6, final ClassifyAddDelTable request) {
- boolean aceIsEmpty = true;
- if (InterfaceMode.L2.equals(mode)) {
- // in L2 mode we need to match ether type
- request.mask[baseOffset + ETHER_TYPE_OFFSET] = (byte) 0xff;
- request.mask[baseOffset + ETHER_TYPE_OFFSET + 1] = (byte) 0xff;
- }
- if (header.getDscp() != null) {
- aceIsEmpty = false;
- // DCSP (bits 4-9 of IP6 header)
- request.mask[baseOffset + IP_VERSION_OFFSET] |= DSCP_MASK1;
- request.mask[baseOffset + IP_VERSION_OFFSET + 1] |= DSCP_MASK2;
- }
- if (header.getProtocol() != null) { // Internet Protocol number
- aceIsEmpty = false;
- request.mask[baseOffset + IP_PROTOCOL_OFFSET] = (byte) IP_PROTOCOL_MASK;
- }
- if (ip6.getFlowLabel() != null) {
- aceIsEmpty = false;
- // bits 12-31
- request.mask[baseOffset + IP_VERSION_OFFSET + 1] |= (byte) 0x0f;
- request.mask[baseOffset + IP_VERSION_OFFSET + 2] = (byte) 0xff;
- request.mask[baseOffset + IP_VERSION_OFFSET + 3] = (byte) 0xff;
- }
- if (header.getSourcePortRange() != null) {
- // TODO (HONEYCOMB-253): port matching will not work correctly if Options are present
- aceIsEmpty = false;
- request.mask[baseOffset + SRC_PORT_OFFSET] = (byte) 0xff;
- request.mask[baseOffset + SRC_PORT_OFFSET + 1] = (byte) 0xff;
- }
- if (header.getDestinationPortRange() != null) {
- // TODO (HONEYCOMB-253): port matching will not work correctly if Options are present
- aceIsEmpty = false;
- request.mask[baseOffset + DST_PORT_OFFSET] = (byte) 0xff;
- request.mask[baseOffset + DST_PORT_OFFSET + 1] = (byte) 0xff;
- }
- if (ip6.getSourceIpv6Network() != null) {
- aceIsEmpty = false;
- final byte[] mask = Impl.toByteMask(ip6.getSourceIpv6Network());
- System.arraycopy(mask, 0, request.mask, baseOffset + SRC_IP_OFFSET, mask.length);
- }
- if (ip6.getDestinationIpv6Network() != null) {
- aceIsEmpty = false;
- final byte[] mask = Impl.toByteMask(ip6.getDestinationIpv6Network());
- System.arraycopy(mask, 0, request.mask, baseOffset + DST_IP_OFFSET, mask.length);
- }
- return aceIsEmpty;
- }
-
- default boolean ip6Match(final int baseOffset, final InterfaceMode mode, final AclIpHeaderFields header,
- final AclIpv6HeaderFields ip6, final Integer srcPort, final Integer dstPort, final ClassifyAddDelSession request) {
- boolean noMatch = true;
- if (InterfaceMode.L2.equals(mode)) {
- // match IP6 etherType (0x86dd)
- request.match[baseOffset + ETHER_TYPE_OFFSET] = (byte) 0x86;
- request.match[baseOffset + ETHER_TYPE_OFFSET + 1] = (byte) 0xdd;
- }
- if (header.getDscp() != null) {
- noMatch = false;
- final int dcsp = header.getDscp().getValue();
- // set bits 4-9 of IP6 header:
- request.match[baseOffset + IP_VERSION_OFFSET] |= (byte) (DSCP_MASK1 & (dcsp >> 2));
- request.match[baseOffset + IP_VERSION_OFFSET + 1] |= (byte) (DSCP_MASK2 & (dcsp << 6));
- }
- if (header.getProtocol() != null) { // Internet Protocol number
- noMatch = false;
- request.match[baseOffset + IP_PROTOCOL_OFFSET] = (byte) (IP_PROTOCOL_MASK & header.getProtocol());
- }
- if (ip6.getFlowLabel() != null) {
- noMatch = false;
- final int flowLabel = ip6.getFlowLabel().getValue().intValue();
- // bits 12-31
- request.match[baseOffset + IP_VERSION_OFFSET + 1] |= (byte) (0x0f & (flowLabel >> 16));
- request.match[baseOffset + IP_VERSION_OFFSET + 2] = (byte) (0xff & (flowLabel >> 8));
- request.match[baseOffset + IP_VERSION_OFFSET + 3] = (byte) (0xff & flowLabel);
- }
- if (header.getSourcePortRange() != null) {
- // TODO (HONEYCOMB-253): port matching will not work correctly if Options are present
- noMatch = false;
- request.match[baseOffset + SRC_PORT_OFFSET] = (byte) (0xff & srcPort >> 8);
- request.match[baseOffset + SRC_PORT_OFFSET + 1] = (byte) (0xff & srcPort);
- }
- if (header.getDestinationPortRange() != null) {
- // TODO (HONEYCOMB-253): port matching will not work correctly if Options are present
- noMatch = false;
- request.match[baseOffset + DST_PORT_OFFSET] = (byte) (0xff & dstPort >> 8);
- request.match[baseOffset + DST_PORT_OFFSET + 1] = (byte) (0xff & dstPort);
- }
- if (ip6.getSourceIpv6Network() != null) {
- noMatch = false;
- final byte[] match = Impl.toMatchValue(ip6.getSourceIpv6Network());
- System.arraycopy(match, 0, request.match, baseOffset + SRC_IP_OFFSET, IP6_LEN);
- }
- if (ip6.getDestinationIpv6Network() != null) {
- noMatch = false;
- final byte[] match = Impl.toMatchValue(ip6.getDestinationIpv6Network());
- System.arraycopy(match, 0, request.match, baseOffset + DST_IP_OFFSET, IP6_LEN);
- }
- return noMatch;
- }
-
- class Impl {
- private static final int IP6_MASK_BIT_LENGTH = 128;
-
- private static byte[] toByteMask(final int prefixLength) {
- final BitSet mask = new BitSet(IP6_MASK_BIT_LENGTH);
- mask.set(0, prefixLength, true);
- if (prefixLength < IP6_MASK_BIT_LENGTH) {
- mask.set(prefixLength, IP6_MASK_BIT_LENGTH, false);
- }
- return mask.toByteArray();
- }
-
- private static byte[] toByteMask(final Ipv6Prefix ipv6Prefix) {
- final int prefixLength = Short.valueOf(ipv6Prefix.getValue().split("/")[1]);
- return toByteMask(prefixLength);
- }
-
- private static byte[] toMatchValue(final Ipv6Prefix ipv6Prefix) {
- final String[] split = ipv6Prefix.getValue().split("/");
- final byte[] addressBytes;
- try {
- addressBytes = InetAddress.getByName(split[0]).getAddress();
- } catch (UnknownHostException e) {
- throw new IllegalArgumentException("Invalid IP6 address", e);
- }
- final byte[] mask = toByteMask(Short.valueOf(split[1]));
- int pos = 0;
- for (; pos < mask.length; ++pos) {
- addressBytes[pos] &= mask[pos];
- }
- // mask can be shorter that address, so we need to clear rest of the address:
- for (; pos < addressBytes.length; ++pos) {
- addressBytes[pos] = 0;
- }
- return addressBytes;
- }
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/L2AclTranslator.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/L2AclTranslator.java
deleted file mode 100644
index c74db7e2a..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/L2AclTranslator.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import io.fd.honeycomb.translate.vpp.util.MacTranslator;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import java.util.List;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
-
-interface L2AclTranslator extends MacTranslator {
-
- default boolean destinationMacAddressMask(final MacAddress dstMask, final MacAddress dstAddress,
- final ClassifyAddDelTable request) {
- // destination-mac-address or destination-mac-address-mask is present =>
- // ff:ff:ff:ff:ff:ff:00:00:00:00:00:00:00:00:00:00
- if (dstMask != null) {
- final List<String> parts = COLON_SPLITTER.splitToList(dstMask.getValue());
- int i = 0;
- for (String part : parts) {
- request.mask[i++] = parseHexByte(part);
- }
- return false;
- } else if (dstAddress != null) {
- for (int i = 0; i < 6; ++i) {
- request.mask[i] = (byte) 0xff;
- }
- return false;
- }
- return true;
- }
-
- default boolean sourceMacAddressMask(final MacAddress srcMask, final MacAddress srcAddress,
- final ClassifyAddDelTable request) {
- // source-mac-address or source-mac-address-mask =>
- // 00:00:00:00:00:00:ff:ff:ff:ff:ff:ff:00:00:00:00
- if (srcMask != null) {
- final List<String> parts = COLON_SPLITTER.splitToList(srcMask.getValue());
- int i = 6;
- for (String part : parts) {
- request.mask[i++] = parseHexByte(part);
- }
- return false;
- } else if (srcAddress != null) {
- for (int i = 6; i < 12; ++i) {
- request.mask[i] = (byte) 0xff;
- }
- return false;
- }
- return true;
- }
-
- default boolean destinationMacAddressMatch(final MacAddress dstAddress, final ClassifyAddDelSession request) {
- if (dstAddress != null) {
- final List<String> parts = COLON_SPLITTER.splitToList(dstAddress.getValue());
- int i = 0;
- for (String part : parts) {
- request.match[i++] = parseHexByte(part);
- }
- return false;
- }
- return true;
- }
-
- default boolean sourceMacAddressMatch(final MacAddress srcAddress, final ClassifyAddDelSession request) {
- if (srcAddress != null) {
- final List<String> parts = COLON_SPLITTER.splitToList(srcAddress.getValue());
- int i = 6;
- for (String part : parts) {
- request.match[i++] = parseHexByte(part);
- }
- return false;
- }
- return true;
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/PortPair.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/PortPair.java
deleted file mode 100644
index 6d5d506d8..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/PortPair.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.function.BiFunction;
-import javax.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.acl.transport.header.fields.DestinationPortRange;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.acl.transport.header.fields.SourcePortRange;
-
-/**
- * Utility that produces cartesian product out of src and dst port ranges (used to translate ranges into
- * list of classify sessions).
- */
-final class PortPair {
- private final Integer src;
- private final Integer dst;
-
- PortPair(@Nullable final Integer src, @Nullable final Integer dst) {
- this.src = src;
- this.dst = dst;
- }
-
- Integer getSrc() {
- return src;
- }
-
- Integer getDst() {
- return dst;
- }
-
- @Override
- public String toString() {
- return "(" + src + "," + dst + ")";
- }
-
- @Override
- public boolean equals(final Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
-
- final PortPair that = (PortPair) o;
- if (!Objects.equals(src, that.src)) {
- return false;
- }
- if (!Objects.equals(dst, that.dst)) {
- return false;
- }
- return true;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(src, dst);
- }
-
- static List<PortPair> fromRange(final SourcePortRange srcRange,
- final DestinationPortRange dstRange) {
- final List<PortPair> result = new ArrayList<>();
- if (srcRange == null && dstRange == null) {
- result.add(new PortPair(null, null));
- } else if (srcRange != null && dstRange == null) {
- processSingleRange(result, srcRange.getLowerPort(), srcRange.getUpperPort(), PortPair::new);
- } else if (srcRange == null && dstRange != null) {
- processSingleRange(result, dstRange.getLowerPort(), dstRange.getUpperPort(),
- (dst, src) -> new PortPair(src, dst));
- } else {
- processDoubleRange(result, srcRange, dstRange);
- }
- return result;
- }
-
- private static void processSingleRange(final List<PortPair> result,
- final PortNumber lowerPort,
- final PortNumber upperPort,
- final BiFunction<Integer, Integer, PortPair> f) {
- int low = lowerPort.getValue(); // mandatory
- int hi = low;
- if (upperPort != null) {
- hi = upperPort.getValue();
- }
- for (; low <= hi; ++low) {
- result.add(f.apply(low, null));
- }
- }
-
- private static void processDoubleRange(final List<PortPair> result, final SourcePortRange srcRange,
- final DestinationPortRange dstRange) {
- int srcL = srcRange.getLowerPort().getValue();
- int srcH = srcL;
- if (srcRange.getUpperPort() != null) {
- srcH = srcRange.getUpperPort().getValue();
- }
- int dstL = dstRange.getLowerPort().getValue();
- int dstH = dstL;
- if (dstRange.getUpperPort() != null) {
- dstH = dstRange.getUpperPort().getValue();
- }
- for (int i=srcL; i <= srcH; ++i) {
- for (int j=dstL; j <= dstH; ++j) {
- result.add(new PortPair(i, j));
- }
- }
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/EgressIetfAclWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/EgressIetfAclWriter.java
deleted file mode 100644
index bfd58cf4a..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/EgressIetfAclWriter.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.egress;
-
-import static com.google.common.base.Preconditions.checkArgument;
-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.MappingContext;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.common.AbstractIetfAclWriter;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.common.AclTableContextManager;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.vpp.jvpp.core.dto.ClassifySetInterfaceL2Tables;
-import io.fd.vpp.jvpp.core.dto.ClassifySetInterfaceL2TablesReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.List;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnegative;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.Ace;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.Matches;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.AceEth;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.mapping.table.MappingEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.mapping.table.MappingEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessLists;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.access.lists.Acl;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public final class EgressIetfAclWriter extends AbstractIetfAclWriter {
- private final AclTableContextManager aclCtx;
-
- public EgressIetfAclWriter(@Nonnull final FutureJVppCore futureJVppCore, @Nonnull AclTableContextManager aclCtx) {
- super(futureJVppCore);
- this.aclCtx = checkNotNull(aclCtx, "aclCtx should not be null");
- }
-
- @Override
- public void deleteAcl(@Nonnull final InstanceIdentifier<?> id, final int swIfIndex,
- @Nonnull final MappingContext mappingContext)
- throws WriteFailedException {
- Optional<MappingEntry> optional = aclCtx.getEntry(swIfIndex, mappingContext);
- checkState(optional.isPresent(), "Removing ACL id=%s, but acl mapping entry is not present", id);
- final MappingEntry entry = optional.get();
- unassignClassifyTables(id, swIfIndex);
- removeClassifyTables(id, entry);
- aclCtx.removeEntry(swIfIndex, mappingContext);
- }
-
- private void unassignClassifyTables(@Nonnull final InstanceIdentifier<?> id, final int swIfIndex)
- throws WriteFailedException {
- final ClassifySetInterfaceL2Tables request = new ClassifySetInterfaceL2Tables();
- request.swIfIndex = swIfIndex;
- request.ip4TableIndex = NOT_DEFINED;
- request.ip6TableIndex = NOT_DEFINED;
- request.otherTableIndex = NOT_DEFINED;
- request.isInput = 0; // egress
- final CompletionStage<ClassifySetInterfaceL2TablesReply> cs = jvpp.classifySetInterfaceL2Tables(request);
- getReplyForDelete(cs.toCompletableFuture(), id);
- }
-
- @Override
- public void write(@Nonnull final InstanceIdentifier<?> id, int swIfIndex, @Nonnull final List<Acl> acls,
- @Nonnull final AccessLists.DefaultAction defaultAction, @Nullable InterfaceMode mode,
- @Nonnull final WriteContext writeContext, @Nonnegative final int numberOfTags,
- @Nonnull final MappingContext mappingContext)
- throws WriteFailedException {
- checkArgument(numberOfTags >= 0 && numberOfTags <= 2, "Number of vlan tags %s is not in [0,2] range");
- checkArgument(InterfaceMode.L2.equals(mode), "Writing egress Acls is supported only in L2 mode");
-
- final ClassifySetInterfaceL2Tables request = new ClassifySetInterfaceL2Tables();
- request.isInput = 0; // egress
- request.swIfIndex = swIfIndex;
-
- // applied to packets according to their ether type
- final List<Ace> ip4Aces = getACEs(acls, writeContext, (AbstractIetfAclWriter::appliesToIp4Path));
- request.ip4TableIndex = writeAces(id, ip4Aces, defaultAction, mode, numberOfTags);
- final List<Ace> ip6Aces = getACEs(acls, writeContext, (AbstractIetfAclWriter::appliesToIp6Path));
- request.ip6TableIndex = writeAces(id, ip6Aces, defaultAction, mode, numberOfTags);
- final List<Ace> aces = getACEs(acls, writeContext, EgressIetfAclWriter::isNotIpRule);
- request.otherTableIndex = writeAces(id, aces, defaultAction, mode, numberOfTags);
-
- final MappingEntry entry = new MappingEntryBuilder().setIndex(swIfIndex)
- .setIp4TableId(request.ip4TableIndex)
- .setIp6TableId(request.ip6TableIndex)
- .setL2TableId(request.otherTableIndex)
- .build();
- aclCtx.addEntry(entry, mappingContext);
-
- try {
- getReplyForWrite(jvpp.classifySetInterfaceL2Tables(request).toCompletableFuture(), id);
- } catch (WriteFailedException e) {
- removeClassifyTables(id, entry);
- throw e;
- }
- }
-
- private static boolean isNotIpRule(final Ace ace) {
- final Matches matches = ace.getMatches();
- checkArgument(matches != null, "Incomplete ACE: %s", ace);
- return matches.getAceType() instanceof AceEth;
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/IetfAclCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/IetfAclCustomizer.java
deleted file mode 100644
index c0e4c3d14..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/IetfAclCustomizer.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.egress;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.common.IetfAclWriter;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Egress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessLists;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class IetfAclCustomizer implements WriterCustomizer<Egress> {
- private static final Logger LOG = LoggerFactory.getLogger(IetfAclCustomizer.class);
- private final IetfAclWriter aclWriter;
- private final NamingContext interfaceContext;
-
- public IetfAclCustomizer(final IetfAclWriter aclWriter, final NamingContext interfaceContext) {
- this.aclWriter = checkNotNull(aclWriter, "aclWriter should not be null");
- this.interfaceContext = checkNotNull(interfaceContext, "interfaceContext should not be null");
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Egress> id, @Nonnull final Egress dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- final String ifName = id.firstKeyOf(Interface.class).getName();
- final int ifIndex = interfaceContext.getIndex(ifName, writeContext.getMappingContext());
- LOG.debug("Adding egress ACLs for interface={}(id={}): {}", ifName, ifIndex, dataAfter);
-
- final AccessLists accessLists = dataAfter.getAccessLists();
- checkArgument(accessLists != null && accessLists.getAcl() != null,
- "ietf-acl container does not define acl list");
-
- if (!InterfaceMode.L2.equals(accessLists.getMode())) {
- LOG.debug("Writing egress Acls is supported only in L2 mode. Ignoring config: {}", dataAfter);
- return;
- }
-
- aclWriter.write(id, ifIndex, accessLists.getAcl(), accessLists.getDefaultAction(), accessLists.getMode(),
- writeContext, writeContext.getMappingContext());
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Egress> id, @Nonnull final Egress dataBefore,
- @Nonnull final Egress dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("ACLs update: removing previously configured ACLs");
- deleteCurrentAttributes(id, dataBefore, writeContext);
- LOG.debug("ACLs update: adding updated ACLs");
- writeCurrentAttributes(id, dataAfter, writeContext);
- LOG.debug("ACLs update was successful");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Egress> id, @Nonnull final Egress dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- final String ifName = id.firstKeyOf(Interface.class).getName();
- final int ifIndex = interfaceContext.getIndex(ifName, writeContext.getMappingContext());
- LOG.debug("Removing ACLs for interface={}(id={}): {}", ifName, ifIndex, dataBefore);
- aclWriter.deleteAcl(id, ifIndex, writeContext.getMappingContext());
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/SubInterfaceIetfAclCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/SubInterfaceIetfAclCustomizer.java
deleted file mode 100644
index bf7c0eb46..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/SubInterfaceIetfAclCustomizer.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.egress;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils.getNumberOfTags;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.common.IetfAclWriter;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessLists;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.Egress;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SubInterfaceIetfAclCustomizer implements WriterCustomizer<Egress> {
- private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceIetfAclCustomizer.class);
- private final IetfAclWriter aclWriter;
- private final NamingContext interfaceContext;
-
- public SubInterfaceIetfAclCustomizer(final IetfAclWriter aclWriter, final NamingContext interfaceContext) {
- this.aclWriter = checkNotNull(aclWriter, "aclWriter should not be null");
- this.interfaceContext = checkNotNull(interfaceContext, "interfaceContext should not be null");
- }
-
- private String getSubInterfaceName(@Nonnull final InstanceIdentifier<Egress> id) {
- final InterfaceKey parentInterfacekey = id.firstKeyOf(Interface.class);
- final SubInterfaceKey subInterfacekey = id.firstKeyOf(SubInterface.class);
- return SubInterfaceUtils
- .getSubInterfaceName(parentInterfacekey.getName(), subInterfacekey.getIdentifier().intValue());
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Egress> id, @Nonnull final Egress dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- final String subInterfaceName = getSubInterfaceName(id);
- final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, writeContext.getMappingContext());
- LOG.debug("Adding IETF-ACL for sub-interface: {}(id={}): {}", subInterfaceName, subInterfaceIndex, dataAfter);
-
- final AccessLists accessLists = dataAfter.getAccessLists();
- checkArgument(accessLists != null && accessLists.getAcl() != null,
- "ietf-acl container does not define acl list");
-
- final Optional<SubInterface> subInterfaceOptional =
- writeContext.readAfter(id.firstIdentifierOf(SubInterface.class));
- checkState(subInterfaceOptional.isPresent(), "Could not read SubInterface data object for %s", id);
- final SubInterface subInterface = subInterfaceOptional.get();
-
- if (!InterfaceMode.L2.equals(accessLists.getMode())) {
- LOG.debug("Writing egress Acls is supported only in L2 mode. Ignoring config: {}", dataAfter);
- return;
- }
-
- aclWriter
- .write(id, subInterfaceIndex, accessLists.getAcl(), accessLists.getDefaultAction(), accessLists.getMode(),
- writeContext, getNumberOfTags(subInterface.getTags()), writeContext.getMappingContext());
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Egress> id, @Nonnull final Egress dataBefore,
- @Nonnull final Egress dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("Sub-interface ACLs update: removing previously configured ACLs");
- deleteCurrentAttributes(id, dataBefore, writeContext);
- LOG.debug("Sub-interface ACLs update: adding updated ACLs");
- writeCurrentAttributes(id, dataAfter, writeContext);
- LOG.debug("Sub-interface ACLs update was successful");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Egress> id, @Nonnull final Egress dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- final String subInterfaceName = getSubInterfaceName(id);
- final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, writeContext.getMappingContext());
- LOG.debug("Removing ACLs for sub-interface={}(id={}): {}", subInterfaceName, subInterfaceIndex, dataBefore);
- aclWriter.deleteAcl(id, subInterfaceIndex, writeContext.getMappingContext());
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AclCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AclCustomizer.java
deleted file mode 100644
index 550c2cc92..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AclCustomizer.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.ingress;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
-import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
-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.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.acl.Ingress;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Customizer for enabling/disabling ingress ACLs on given interface based on low lever classfier model.
- */
-public class AclCustomizer extends FutureJVppCustomizer implements WriterCustomizer<Ingress>, AclWriter {
-
- private static final Logger LOG = LoggerFactory.getLogger(AclCustomizer.class);
- private final NamingContext interfaceContext;
- private final VppClassifierContextManager classifyTableContext;
-
- public AclCustomizer(@Nonnull final FutureJVppCore vppApi, @Nonnull final NamingContext interfaceContext,
- @Nonnull final VppClassifierContextManager classifyTableContext) {
- super(vppApi);
- this.interfaceContext = checkNotNull(interfaceContext, "interfaceContext should not be null");
- this.classifyTableContext = checkNotNull(classifyTableContext, "classifyTableContext should not be null");
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id, @Nonnull final Ingress dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- setAcl(true, id, dataAfter, writeContext);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id,
- @Nonnull final Ingress dataBefore,
- @Nonnull final Ingress dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- throw new UnsupportedOperationException("Acl update is not supported. Please delete Acl container first.");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id,
- @Nonnull final Ingress dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- setAcl(false, id, dataBefore, writeContext);
- }
-
- private void setAcl(final boolean isAdd, @Nonnull final InstanceIdentifier<Ingress> id, @Nonnull final Ingress acl,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- final String ifName = id.firstKeyOf(Interface.class).getName();
- final int ifIndex = interfaceContext.getIndex(ifName, writeContext.getMappingContext());
-
- LOG.debug("Setting ACL(isAdd={}) on interface={}(id={}): {}", isAdd, ifName, ifIndex, acl);
-
- inputAclSetInterface(getFutureJVpp(), isAdd, id, acl, ifIndex, classifyTableContext,
- writeContext.getMappingContext());
- LOG.debug("Successfully set ACL(isAdd={}) on interface={}(id={}): {}", isAdd, ifName, ifIndex, acl);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AclWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AclWriter.java
deleted file mode 100644
index d299ec88a..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AclWriter.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.ingress;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnegative;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.AclBaseAttributes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip4Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip6Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.L2Acl;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.InputAclSetInterface;
-import io.fd.vpp.jvpp.core.dto.InputAclSetInterfaceReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-interface AclWriter extends ByteDataTranslator, JvppReplyConsumer {
-
- default void inputAclSetInterface(@Nonnull final FutureJVppCore futureJVppCore, final boolean isAdd,
- @Nonnull final InstanceIdentifier<?> id, @Nonnull final AclBaseAttributes acl,
- @Nonnegative final int ifIndex,
- @Nonnull final VppClassifierContextManager classifyTableContext,
- @Nonnull final MappingContext mappingContext) throws WriteFailedException {
- final InputAclSetInterface request = new InputAclSetInterface();
- request.isAdd = booleanToByte(isAdd);
- request.swIfIndex = ifIndex;
- request.l2TableIndex = ~0; // skip
- request.ip4TableIndex = ~0; // skip
- request.ip6TableIndex = ~0; // skip
-
- final L2Acl l2Acl = acl.getL2Acl();
- if (l2Acl != null) {
- final String tableName = checkNotNull(l2Acl.getClassifyTable(), "L2 classify table is null");
- request.l2TableIndex = classifyTableContext.getTableIndex(tableName, mappingContext);
- }
- final Ip4Acl ip4Acl = acl.getIp4Acl();
- if (ip4Acl != null) {
- final String tableName = checkNotNull(ip4Acl.getClassifyTable(), "IPv4 classify table is null");
- request.ip4TableIndex = classifyTableContext.getTableIndex(tableName, mappingContext);
- }
- final Ip6Acl ip6Acl = acl.getIp6Acl();
- if (ip6Acl != null) {
- final String tableName = checkNotNull(ip6Acl.getClassifyTable(), "IPv6 classify table is null");
- request.ip6TableIndex = classifyTableContext.getTableIndex(tableName, mappingContext);
- }
-
- final CompletionStage<InputAclSetInterfaceReply> inputAclSetInterfaceReplyCompletionStage =
- futureJVppCore.inputAclSetInterface(request);
-
- getReplyForWrite(inputAclSetInterfaceReplyCompletionStage.toCompletableFuture(), id);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclCustomizer.java
deleted file mode 100644
index ec051e091..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclCustomizer.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.ingress;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Ingress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessLists;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Customizer for enabling/disabling ingress ACLs for given interface (as defined in ietf-acl model).
- *
- * The customizer assumes it owns classify table management for interfaces where ietf-acl container is present. Using
- * low level classifier model or direct changes to classify tables in combination with ietf-acls are not supported and
- * can result in unpredictable behaviour.
- */
-public class IetfAclCustomizer implements WriterCustomizer<Ingress> {
-
- private static final Logger LOG = LoggerFactory.getLogger(IetfAclCustomizer.class);
- private final IngressIetfAclWriter aclWriter;
- private final NamingContext interfaceContext;
-
- public IetfAclCustomizer(@Nonnull final IngressIetfAclWriter aclWriter,
- @Nonnull final NamingContext interfaceContext) {
- this.aclWriter = checkNotNull(aclWriter, "aclWriter should not be null");
- this.interfaceContext = checkNotNull(interfaceContext, "interfaceContext should not be null");
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id, @Nonnull final Ingress dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- final String ifName = id.firstKeyOf(Interface.class).getName();
- final int ifIndex = interfaceContext.getIndex(ifName, writeContext.getMappingContext());
- LOG.debug("Adding ACLs for interface={}(id={}): {}", ifName, ifIndex, dataAfter);
-
- final AccessLists accessLists = dataAfter.getAccessLists();
- checkArgument(accessLists != null && accessLists.getAcl() != null,
- "ietf-acl container does not define acl list");
-
- aclWriter.write(id, ifIndex, accessLists.getAcl(), accessLists.getDefaultAction(), accessLists.getMode(),
- writeContext, writeContext.getMappingContext());
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id,
- @Nonnull final Ingress dataBefore, @Nonnull final Ingress dataAfter,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("ACLs update: removing previously configured ACLs");
- deleteCurrentAttributes(id, dataBefore, writeContext);
- LOG.debug("ACLs update: adding updated ACLs");
- writeCurrentAttributes(id, dataAfter, writeContext);
- LOG.debug("ACLs update was successful");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id,
- @Nonnull final Ingress dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- final String ifName = id.firstKeyOf(Interface.class).getName();
- final int ifIndex = interfaceContext.getIndex(ifName, writeContext.getMappingContext());
- LOG.debug("Removing ACLs for interface={}(id={}): {}", ifName, ifIndex, dataBefore);
- aclWriter.deleteAcl(id, ifIndex, writeContext.getMappingContext());
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IngressIetfAclWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IngressIetfAclWriter.java
deleted file mode 100644
index b7da14ecf..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IngressIetfAclWriter.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.ingress;
-
-import static com.google.common.base.Preconditions.checkArgument;
-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.MappingContext;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.common.AbstractIetfAclWriter;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.common.AclTableContextManager;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.vpp.jvpp.core.dto.InputAclSetInterface;
-import io.fd.vpp.jvpp.core.dto.InputAclSetInterfaceReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.List;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnegative;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.Ace;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.mapping.table.MappingEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.mapping.table.MappingEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessLists;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.access.lists.Acl;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public final class IngressIetfAclWriter extends AbstractIetfAclWriter {
- private final AclTableContextManager aclCtx;
-
- public IngressIetfAclWriter(@Nonnull final FutureJVppCore futureJVppCore, @Nonnull AclTableContextManager aclCtx) {
- super(futureJVppCore);
- this.aclCtx = checkNotNull(aclCtx, "aclCtx should not be null");
- }
-
- @Override
- public void deleteAcl(@Nonnull final InstanceIdentifier<?> id, final int swIfIndex,
- @Nonnull final MappingContext mappingContext)
- throws WriteFailedException {
- Optional<MappingEntry> optional = aclCtx.getEntry(swIfIndex, mappingContext);
- checkState(optional.isPresent(), "Removing ACL id=%s, but acl mapping entry is not present", id);
- final MappingEntry entry = optional.get();
- unassignClassifyTables(id, entry);
- removeClassifyTables(id, entry);
- aclCtx.removeEntry(swIfIndex, mappingContext);
- }
-
- private void unassignClassifyTables(@Nonnull final InstanceIdentifier<?> id,
- @Nonnull final MappingEntry entry)
- throws WriteFailedException {
- final InputAclSetInterface request = new InputAclSetInterface();
- request.isAdd = 0;
- request.swIfIndex = entry.getIndex();
- request.l2TableIndex = entry.getL2TableId();
- request.ip4TableIndex = entry.getIp4TableId();
- request.ip6TableIndex = entry.getIp6TableId();
- final CompletionStage<InputAclSetInterfaceReply> inputAclSetInterfaceReplyCompletionStage =
- jvpp.inputAclSetInterface(request);
- getReplyForDelete(inputAclSetInterfaceReplyCompletionStage.toCompletableFuture(), id);
- }
-
- @Override
- public void write(@Nonnull final InstanceIdentifier<?> id, int swIfIndex, @Nonnull final List<Acl> acls,
- @Nonnull final AccessLists.DefaultAction defaultAction, @Nullable final InterfaceMode mode,
- @Nonnull final WriteContext writeContext, @Nonnegative final int numberOfTags,
- @Nonnull final MappingContext mappingContext)
- throws WriteFailedException {
- checkArgument(numberOfTags >= 0 && numberOfTags <= 2, "Number of vlan tags %s is not in [0,2] range");
-
- final InputAclSetInterface request = new InputAclSetInterface();
- request.isAdd = 1;
- request.swIfIndex = swIfIndex;
- request.l2TableIndex = NOT_DEFINED;
- request.ip4TableIndex = NOT_DEFINED;
- request.ip6TableIndex = NOT_DEFINED;
-
- if (InterfaceMode.L2.equals(mode)) {
- final List<Ace> aces = getACEs(acls, writeContext, ace -> true);
- request.l2TableIndex = writeAces(id, aces, defaultAction, mode, numberOfTags);
- } else {
- final List<Ace> ip4Aces = getACEs(acls, writeContext, (AbstractIetfAclWriter::appliesToIp4Path));
- request.ip4TableIndex = writeAces(id, ip4Aces, defaultAction, mode, numberOfTags);
- final List<Ace> ip6Aces = getACEs(acls, writeContext, (AbstractIetfAclWriter::appliesToIp6Path));
- request.ip6TableIndex = writeAces(id, ip6Aces, defaultAction, mode, numberOfTags);
- }
-
- final MappingEntry entry = new MappingEntryBuilder().setIndex(swIfIndex)
- .setIp4TableId(request.ip4TableIndex)
- .setIp6TableId(request.ip6TableIndex)
- .setL2TableId(request.l2TableIndex)
- .build();
- aclCtx.addEntry(entry, mappingContext);
-
- try {
- getReplyForWrite(jvpp.inputAclSetInterface(request).toCompletableFuture(), id);
- } catch (WriteFailedException e) {
- removeClassifyTables(id, entry);
- throw e;
- }
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizer.java
deleted file mode 100644
index bda096490..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizer.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.ingress;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
-import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.acl.Ingress;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Customizer for enabling/disabling ingress ACLs on given sub-interface.
- */
-public class SubInterfaceAclCustomizer extends FutureJVppCustomizer
- implements WriterCustomizer<Ingress>, AclWriter {
-
- private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceAclCustomizer.class);
- private final NamingContext interfaceContext;
- private final VppClassifierContextManager classifyTableContext;
-
- public SubInterfaceAclCustomizer(@Nonnull final FutureJVppCore vppApi,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final VppClassifierContextManager classifyTableContext) {
- super(vppApi);
- this.interfaceContext = checkNotNull(interfaceContext, "interfaceContext should not be null");
- this.classifyTableContext = checkNotNull(classifyTableContext, "classifyTableContext should not be null");
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id, @Nonnull final Ingress dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- setAcl(true, id, dataAfter, writeContext);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id,
- @Nonnull final Ingress dataBefore,
- @Nonnull final Ingress dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- throw new UnsupportedOperationException("Acl update is not supported. Please delete Acl container first.");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id,
- @Nonnull final Ingress dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- setAcl(false, id, dataBefore, writeContext);
- }
-
- private void setAcl(final boolean isAdd, @Nonnull final InstanceIdentifier<Ingress> id, @Nonnull final Ingress acl,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- final InterfaceKey parentInterfacekey = id.firstKeyOf(Interface.class);
- final SubInterfaceKey subInterfacekey = id.firstKeyOf(SubInterface.class);
- final String subInterfaceName = SubInterfaceUtils
- .getSubInterfaceName(parentInterfacekey.getName(), subInterfacekey.getIdentifier().intValue());
- final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, writeContext.getMappingContext());
-
- LOG.debug("Setting ACL(isAdd={}) on sub-interface={}(id={}): {}",
- isAdd, subInterfaceName, subInterfaceIndex, acl);
- inputAclSetInterface(getFutureJVpp(), isAdd, id, acl, subInterfaceIndex, classifyTableContext,
- writeContext.getMappingContext());
- LOG.debug("Successfully set ACL(isAdd={}) on sub-interface={}(id={}): {}",
- isAdd, subInterfaceName, subInterfaceIndex, acl);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceIetfAclCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceIetfAclCustomizer.java
deleted file mode 100644
index a9fcc83a3..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceIetfAclCustomizer.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.ingress;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils.getNumberOfTags;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessLists;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.Ingress;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Customizer for enabling/disabling ingress ACLs for given sub-interface (as defined in ietf-acl model).
- *
- * The customizer assumes it owns classify table management for sub-interfaces where ietf-acl container is present.
- * Using low level classifier model or direct changes to classify tables in combination with ietf-acls are not supported
- * and can result in unpredictable behaviour.
- */
-public class SubInterfaceIetfAclCustomizer implements WriterCustomizer<Ingress> {
-
- private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceIetfAclCustomizer.class);
- private final IngressIetfAclWriter aclWriter;
- private final NamingContext interfaceContext;
-
- public SubInterfaceIetfAclCustomizer(@Nonnull final IngressIetfAclWriter aclWriter,
- @Nonnull final NamingContext interfaceContext) {
- this.aclWriter = checkNotNull(aclWriter, "aclWriter should not be null");
- this.interfaceContext = checkNotNull(interfaceContext, "interfaceContext should not be null");
- }
-
- private String getSubInterfaceName(@Nonnull final InstanceIdentifier<Ingress> id) {
- final InterfaceKey parentInterfacekey = id.firstKeyOf(Interface.class);
- final SubInterfaceKey subInterfacekey = id.firstKeyOf(SubInterface.class);
- return SubInterfaceUtils
- .getSubInterfaceName(parentInterfacekey.getName(), subInterfacekey.getIdentifier().intValue());
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id, @Nonnull final Ingress dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- final String subInterfaceName = getSubInterfaceName(id);
- final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, writeContext.getMappingContext());
- LOG.debug("Adding IETF-ACL for sub-interface: {}(id={}): {}", subInterfaceName, subInterfaceIndex, dataAfter);
-
- final AccessLists accessLists = dataAfter.getAccessLists();
- checkArgument(accessLists != null && accessLists.getAcl() != null,
- "ietf-acl container does not define acl list");
-
- final Optional<SubInterface> subInterfaceOptional =
- writeContext.readAfter(id.firstIdentifierOf(SubInterface.class));
- checkState(subInterfaceOptional.isPresent(), "Could not read SubInterface data object for %s", id);
- final SubInterface subInterface = subInterfaceOptional.get();
-
- aclWriter
- .write(id, subInterfaceIndex, accessLists.getAcl(), accessLists.getDefaultAction(), accessLists.getMode(),
- writeContext, getNumberOfTags(subInterface.getTags()), writeContext.getMappingContext());
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id,
- @Nonnull final Ingress dataBefore, @Nonnull final Ingress dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- LOG.debug("Sub-interface ACLs update: removing previously configured ACLs");
- deleteCurrentAttributes(id, dataBefore, writeContext);
- LOG.debug("Sub-interface ACLs update: adding updated ACLs");
- writeCurrentAttributes(id, dataAfter, writeContext);
- LOG.debug("Sub-interface ACLs update was successful");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id,
- @Nonnull final Ingress dataBefore, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- final String subInterfaceName = getSubInterfaceName(id);
- final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, writeContext.getMappingContext());
- LOG.debug("Removing ACLs for sub-interface={}(id={}): {}", subInterfaceName, subInterfaceIndex, dataBefore);
- aclWriter.deleteAcl(id, subInterfaceIndex, writeContext.getMappingContext());
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizer.java
deleted file mode 100644
index 2cec90695..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizer.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.ip;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.v3po.interfaces.ip.subnet.validation.SubnetValidationException;
-import io.fd.honeycomb.translate.v3po.interfaces.ip.subnet.validation.SubnetValidator;
-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.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.AddressKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.Subnet;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.subnet.Netmask;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.subnet.PrefixLength;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DottedQuad;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Customizer for writing {@link Address}
- */
-public class Ipv4AddressCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<Address, AddressKey>, Ipv4Writer {
-
- private static final Logger LOG = LoggerFactory.getLogger(Ipv4AddressCustomizer.class);
- private final NamingContext interfaceContext;
- private final SubnetValidator subnetValidator;
-
- Ipv4AddressCustomizer(@Nonnull final FutureJVppCore futureJVppCore, @Nonnull final NamingContext interfaceContext,
- @Nonnull final SubnetValidator subnetValidator) {
- super(futureJVppCore);
- this.interfaceContext = checkNotNull(interfaceContext, "Interface context cannot be null");
- this.subnetValidator = checkNotNull(subnetValidator, "Subnet validator cannot be null");
- }
-
- public Ipv4AddressCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext) {
- this(futureJVppCore, interfaceContext, new SubnetValidator());
- }
-
- @Override
- public void writeCurrentAttributes(InstanceIdentifier<Address> id, Address dataAfter, WriteContext writeContext)
- throws WriteFailedException {
-
- final String interfaceName = id.firstKeyOf(Interface.class).getName();
- final int interfaceIndex = interfaceContext.getIndex(interfaceName, writeContext.getMappingContext());
-
- // checks whether address is not from same subnet of some address already defined on this interface
- try {
-
- final InstanceIdentifier<Ipv4> parentId = RWUtils.cutId(id, InstanceIdentifier.create(Ipv4.class));
- final Optional<Ipv4> ipv4Optional = writeContext.readAfter(parentId);
-
- //no need to check isPresent() - we are inside of address customizer, therefore there must be Address data
- //that is being processed by infrastructure
-
- subnetValidator.checkNotAddingToSameSubnet(ipv4Optional.get().getAddress());
- } catch (SubnetValidationException e) {
- throw new WriteFailedException(id, e);
- }
-
- setAddress(true, id, interfaceName, interfaceIndex, dataAfter, writeContext);
- }
-
- @Override
- public void updateCurrentAttributes(InstanceIdentifier<Address> id, Address dataBefore, Address dataAfter,
- WriteContext writeContext) throws WriteFailedException {
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter,
- new UnsupportedOperationException("Operation not supported"));
- }
-
- @Override
- public void deleteCurrentAttributes(InstanceIdentifier<Address> id, Address dataBefore, WriteContext writeContext)
- throws WriteFailedException {
-
- final String interfaceName = id.firstKeyOf(Interface.class).getName();
- final int interfaceIndex = interfaceContext.getIndex(interfaceName, writeContext.getMappingContext());
-
- setAddress(false, id, interfaceName, interfaceIndex, dataBefore, writeContext);
- }
-
- private void setAddress(boolean add, final InstanceIdentifier<Address> id, final String interfaceName,
- final int interfaceIndex, final Address address,
- final WriteContext writeContext) throws WriteFailedException {
-
- Subnet subnet = address.getSubnet();
-
- if (subnet instanceof PrefixLength) {
- setPrefixLengthSubnet(add, id, interfaceName, interfaceIndex, address, (PrefixLength) subnet);
- } else if (subnet instanceof Netmask) {
- setNetmaskSubnet(add, id, interfaceName, interfaceIndex, address, (Netmask) subnet);
- } else {
- LOG.error("Unable to handle subnet of type {}", subnet.getClass());
- throw new WriteFailedException(id, "Unable to handle subnet of type " + subnet.getClass());
- }
- }
-
- private void setNetmaskSubnet(final boolean add, @Nonnull final InstanceIdentifier<Address> id,
- @Nonnull final String interfaceName, final int interfaceIndex,
- @Nonnull final Address address, @Nonnull final Netmask subnet)
- throws WriteFailedException {
-
- LOG.debug("Setting Subnet(subnet-mask) for interface: {}(id={}). Subnet: {}, address: {}",
- interfaceName, interfaceIndex, subnet, address);
-
- final DottedQuad netmask = subnet.getNetmask();
- checkNotNull(netmask, "netmask value should not be null");
-
- final byte subnetLength = getSubnetMaskLength(netmask.getValue());
- addDelAddress(getFutureJVpp(), add, id, interfaceIndex, address.getIp(), subnetLength);
- }
-
- private void setPrefixLengthSubnet(final boolean add, @Nonnull final InstanceIdentifier<Address> id,
- @Nonnull final String interfaceName, final int interfaceIndex,
- @Nonnull final Address address, @Nonnull final PrefixLength subnet)
- throws WriteFailedException {
- LOG.debug("Setting Subnet(prefix-length) for interface: {}(id={}). Subnet: {}, address: {}",
- interfaceName, interfaceIndex, subnet, address);
-
- addDelAddress(getFutureJVpp(), add, id, interfaceIndex, address.getIp(),
- subnet.getPrefixLength().byteValue());
-
- LOG.debug("Subnet(prefix-length) set successfully for interface: {}(id={}). Subnet: {}, address: {}",
- interfaceName, interfaceIndex, subnet, address);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4Customizer.java
deleted file mode 100644
index 929e82ea1..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4Customizer.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.ip;
-
-import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.write.WriteContext;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv4;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Ipv4Customizer extends FutureJVppCustomizer implements WriterCustomizer<Ipv4> {
-
- private static final Logger LOG = LoggerFactory.getLogger(Ipv4Customizer.class);
-
- public Ipv4Customizer(final FutureJVppCore vppApi) {
- super(vppApi);
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv4> id,
- @Nonnull final Ipv4 dataAfter, @Nonnull final WriteContext writeContext) {
- LOG.debug("Handling Ipv4 leaves (mtu, forwarding) is not supported by VPP API. Ignoring configuration");
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv4> id,
- @Nonnull final Ipv4 dataBefore, @Nonnull final Ipv4 dataAfter,
- @Nonnull final WriteContext writeContext) {
- LOG.debug("Handling Ipv4 leaves (mtu, forwarding) is not supported by VPP API. Ignoring configuration");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv4> id,
- @Nonnull final Ipv4 dataBefore, @Nonnull final WriteContext writeContext) {
- LOG.debug("Handling Ipv4 leaves (mtu, forwarding) is not supported by VPP API. Ignoring configuration");
- }
-
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4NeighbourCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4NeighbourCustomizer.java
deleted file mode 100644
index be4ef28cf..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4NeighbourCustomizer.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.ip;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-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.honeycomb.translate.vpp.util.JvppReplyConsumer;
-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.core.dto.IpNeighborAddDel;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Neighbor;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.NeighborKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * Customizer for writing {@link Neighbor} for {@link Ipv4}.
- */
-public class Ipv4NeighbourCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<Neighbor, NeighborKey>, ByteDataTranslator, AddressTranslator,
- JvppReplyConsumer {
-
-
- private static final Logger LOG = LoggerFactory.getLogger(Ipv4NeighbourCustomizer.class);
- final NamingContext interfaceContext;
-
- public Ipv4NeighbourCustomizer(final FutureJVppCore futureJVppCore, final NamingContext interfaceContext) {
- super(futureJVppCore);
- this.interfaceContext = interfaceContext;
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull InstanceIdentifier<Neighbor> id, @Nonnull Neighbor dataAfter,
- @Nonnull WriteContext writeContext)
- throws WriteFailedException {
-
- checkNotNull(dataAfter, "Cannot write null neighbour");
- checkArgument(id.firstKeyOf(Interface.class) != null, "No parent interface key found");
-
- LOG.debug("Processing request for Neigbour write");
- String interfaceName = id.firstKeyOf(Interface.class).getName();
- MappingContext mappingContext = writeContext.getMappingContext();
-
- checkState(interfaceContext.containsIndex(interfaceName, mappingContext),
- "Mapping does not contains mapping for provider interface name ".concat(interfaceName));
-
- LOG.debug("Parent interface index found");
- addDelNeighbourAndReply(id, true,
- interfaceContext.getIndex(interfaceName, mappingContext), dataAfter);
- LOG.info("Neighbour successfully written");
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull InstanceIdentifier<Neighbor> id, @Nonnull Neighbor dataBefore,
- @Nonnull Neighbor dataAfter,
- @Nonnull WriteContext writeContext) throws WriteFailedException {
- throw new UnsupportedOperationException("Operation not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull InstanceIdentifier<Neighbor> id, @Nonnull Neighbor dataBefore,
- @Nonnull WriteContext writeContext)
- throws WriteFailedException {
-
- checkNotNull(dataBefore, "Cannot delete null neighbour");
- checkArgument(id.firstKeyOf(Interface.class) != null, "No parent interface key found");
-
- LOG.debug("Processing request for Neigbour delete");
- String interfaceName = id.firstKeyOf(Interface.class).getName();
- MappingContext mappingContext = writeContext.getMappingContext();
-
- checkState(interfaceContext.containsIndex(interfaceName, mappingContext),
- "Mapping does not contains mapping for provider interface name %s", interfaceName);
-
- LOG.debug("Parent interface[{}] index found", interfaceName);
-
- addDelNeighbourAndReply(id, false,
- interfaceContext.getIndex(interfaceName, mappingContext), dataBefore);
- LOG.info("Neighbour {} successfully deleted", id);
- }
-
- private void addDelNeighbourAndReply(InstanceIdentifier<Neighbor> id, boolean add, int parentInterfaceIndex,
- Neighbor data) throws WriteFailedException {
-
- IpNeighborAddDel request = new IpNeighborAddDel();
-
- request.isAdd = booleanToByte(add);
- request.isIpv6 = 0;
- request.isStatic = 1;
- request.dstAddress = ipv4AddressNoZoneToArray(data.getIp());
- request.macAddress = parseMac(data.getLinkLayerAddress().getValue());
- request.swIfIndex = parentInterfaceIndex;
-
- //TODO HONEYCOMB-182 if it is necessary for future use ,make adjustments to be able to set vrfid
- //request.vrfId
- getReplyForWrite(getFutureJVpp().ipNeighborAddDel(request).toCompletableFuture(), id);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4Writer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4Writer.java
deleted file mode 100644
index 788deab3b..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4Writer.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.ip;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceAddDelAddress;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceAddDelAddressReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnegative;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * Utility class providing Ipv4 CUD support.
- */
-public interface Ipv4Writer extends ByteDataTranslator, Ipv4Translator, JvppReplyConsumer {
-
- int DOTTED_QUAD_MASK_LENGTH = 4;
- int IPV4_ADDRESS_PART_BITS_COUNT = 8;
- int NETMASK_PART_LIMIT = 256; // 2 power to 8
-
- default void addDelAddress(@Nonnull final FutureJVppCore futureJVppCore, final boolean add,
- final InstanceIdentifier<?> id,
- @Nonnegative final int ifaceId,
- @Nonnull final Ipv4AddressNoZone address, @Nonnegative final byte prefixLength)
- throws WriteFailedException {
- checkArgument(prefixLength > 0, "Invalid prefix length");
- checkNotNull(address, "address should not be null");
-
- final byte[] addressBytes = ipv4AddressNoZoneToArray(address);
-
- final CompletionStage<SwInterfaceAddDelAddressReply> swInterfaceAddDelAddressReplyCompletionStage =
- futureJVppCore.swInterfaceAddDelAddress(
- getSwInterfaceAddDelAddressRequest(ifaceId, booleanToByte(add) /* isAdd */,
- (byte) 0 /* isIpv6 */, (byte) 0 /* delAll */, prefixLength, addressBytes));
-
- getReplyForWrite(swInterfaceAddDelAddressReplyCompletionStage.toCompletableFuture(), id);
- }
-
- default SwInterfaceAddDelAddress getSwInterfaceAddDelAddressRequest(final int swIfc, final byte isAdd,
- final byte ipv6, final byte deleteAll,
- final byte length, final byte[] addr) {
- final SwInterfaceAddDelAddress swInterfaceAddDelAddress = new SwInterfaceAddDelAddress();
- swInterfaceAddDelAddress.swIfIndex = swIfc;
- swInterfaceAddDelAddress.isAdd = isAdd;
- swInterfaceAddDelAddress.isIpv6 = ipv6;
- swInterfaceAddDelAddress.delAll = deleteAll;
- swInterfaceAddDelAddress.address = addr;
- swInterfaceAddDelAddress.addressLength = length;
- return swInterfaceAddDelAddress;
- }
-
- /**
- * Returns the prefix size in bits of the specified subnet mask. Example: For the subnet mask 255.255.255.128 it
- * returns 25 while for 255.0.0.0 it returns 8. If the passed subnetMask array is not complete or contains not only
- * leading ones, IllegalArgumentExpression is thrown
- *
- * @param mask the subnet mask in dot notation 255.255.255.255
- * @return the prefix length as number of bits
- */
- default byte getSubnetMaskLength(final String mask) {
- String[] maskParts = mask.split("\\.");
-
- checkArgument(maskParts.length == DOTTED_QUAD_MASK_LENGTH,
- "Network mask %s is not in Quad Dotted Decimal notation!", mask);
-
- long maskAsNumber = 0;
- for (int i = 0; i < DOTTED_QUAD_MASK_LENGTH; i++) {
- maskAsNumber <<= IPV4_ADDRESS_PART_BITS_COUNT;
- int value = Integer.parseInt(maskParts[i]);
- checkArgument(value < NETMASK_PART_LIMIT, "Network mask %s contains invalid number(s) over 255!", mask);
- checkArgument(value >= 0, "Network mask %s contains invalid negative number(s)!", mask);
- maskAsNumber += value;
- }
-
- String bits = Long.toBinaryString(maskAsNumber);
- checkArgument(bits.length() == IPV4_ADDRESS_PART_BITS_COUNT * DOTTED_QUAD_MASK_LENGTH,
- "Incorrect network mask %s", mask);
- final int leadingOnes = bits.indexOf('0');
- checkArgument(leadingOnes != -1, "Broadcast address %s is not allowed!", mask);
- checkArgument(bits.substring(leadingOnes).indexOf('1') == -1,
- "Non-contiguous network mask %s is not allowed!", mask);
- return (byte) leadingOnes;
- }
-
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv6Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv6Customizer.java
deleted file mode 100644
index 094957a91..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv6Customizer.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.ip;
-
-import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.write.WriteContext;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv6;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Ipv6Customizer extends FutureJVppCustomizer implements WriterCustomizer<Ipv6> {
-
- private static final Logger LOG = LoggerFactory.getLogger(Ipv6Customizer.class);
-
- public Ipv6Customizer(final FutureJVppCore vppApi) {
- super(vppApi);
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv6> id,
- @Nonnull final Ipv6 dataAfter, @Nonnull final WriteContext writeContext) {
- LOG.warn("Unsupported, ignoring configuration {}", dataAfter);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv6> id,
- @Nonnull final Ipv6 dataBefore, @Nonnull final Ipv6 dataAfter,
- @Nonnull final WriteContext writeContext) {
- LOG.warn("Unsupported, ignoring configuration {}", dataAfter);
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv6> id,
- @Nonnull final Ipv6 dataBefore, @Nonnull final WriteContext writeContext) {
- LOG.warn("Unsupported, ignoring configuration delete {}", id);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java
deleted file mode 100644
index 52c541198..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.ip;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DottedQuad;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.AddressKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.address.Subnet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.address.subnet.Netmask;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.address.subnet.PrefixLength;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Write customizer for sub-interface {@link Address}
- */
-public class SubInterfaceIpv4AddressCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<Address, AddressKey>, Ipv4Writer {
-
- private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceIpv4AddressCustomizer.class);
- private final NamingContext interfaceContext;
-
- public SubInterfaceIpv4AddressCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext) {
- super(futureJVppCore);
- this.interfaceContext = checkNotNull(interfaceContext, "interface context should not be null");
- }
-
- @Override
- public void writeCurrentAttributes(InstanceIdentifier<Address> id, Address dataAfter, WriteContext writeContext)
- throws WriteFailedException {
- setAddress(true, id, dataAfter, writeContext);
- }
-
- @Override
- public void updateCurrentAttributes(InstanceIdentifier<Address> id, Address dataBefore, Address dataAfter,
- WriteContext writeContext) throws WriteFailedException {
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter,
- new UnsupportedOperationException("Operation not supported"));
- }
-
- @Override
- public void deleteCurrentAttributes(InstanceIdentifier<Address> id, Address dataBefore, WriteContext writeContext)
- throws WriteFailedException {
- setAddress(false, id, dataBefore, writeContext);
- }
-
- private void setAddress(boolean add, final InstanceIdentifier<Address> id, final Address address,
- final WriteContext writeContext) throws WriteFailedException {
-
- final String interfaceName = id.firstKeyOf(Interface.class).getName();
- final String subInterfaceName = getSubInterfaceName(id);
- final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, writeContext.getMappingContext());
-
- Subnet subnet = address.getSubnet();
-
- if (subnet instanceof PrefixLength) {
- setPrefixLengthSubnet(add, id, interfaceName, subInterfaceIndex, address, (PrefixLength) subnet);
- } else if (subnet instanceof Netmask) {
- setNetmaskSubnet(add, id, interfaceName, subInterfaceIndex, address, (Netmask) subnet);
- } else {
- LOG.error("Unable to handle subnet of type {}", subnet.getClass());
- throw new WriteFailedException(id, "Unable to handle subnet of type " + subnet.getClass());
- }
- }
-
- private String getSubInterfaceName(@Nonnull final InstanceIdentifier<Address> id) {
- final InterfaceKey parentInterfacekey = id.firstKeyOf(Interface.class);
- final SubInterfaceKey subInterfacekey = id.firstKeyOf(SubInterface.class);
- return SubInterfaceUtils
- .getSubInterfaceName(parentInterfacekey.getName(), subInterfacekey.getIdentifier().intValue());
- }
-
- private void setNetmaskSubnet(final boolean add, @Nonnull final InstanceIdentifier<Address> id,
- @Nonnull final String subInterfaceName, final int subInterfaceIndex,
- @Nonnull final Address address, @Nonnull final Netmask subnet)
- throws WriteFailedException {
-
- LOG.debug("Setting Subnet(subnet-mask) for sub-interface: {}(id={}). Subnet: {}, address: {}",
- subInterfaceName, subInterfaceIndex, subnet, address);
-
- final DottedQuad netmask = subnet.getNetmask();
- checkNotNull(netmask, "netmask value should not be null");
-
- final byte subnetLength = getSubnetMaskLength(netmask.getValue());
- addDelAddress(getFutureJVpp(), add, id, subInterfaceIndex, address.getIp(), subnetLength);
- }
-
- private void setPrefixLengthSubnet(final boolean add, @Nonnull final InstanceIdentifier<Address> id,
- @Nonnull final String subInterfaceName, final int subInterfaceIndex,
- @Nonnull final Address address, @Nonnull final PrefixLength subnet)
- throws WriteFailedException {
- LOG.debug("Setting Subnet(prefix-length) for sub-interface: {}(id={}). Subnet: {}, address: {}",
- subInterfaceName, subInterfaceIndex, subnet, address);
-
- addDelAddress(getFutureJVpp(), add, id, subInterfaceIndex, address.getIp(),
- subnet.getPrefixLength().byteValue());
-
- LOG.debug("Subnet(prefix-length) set successfully for sub-interface: {}(id={}). Subnet: {}, address: {}",
- subInterfaceName, subInterfaceIndex, subnet, address);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/subnet/validation/SubnetValidationException.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/subnet/validation/SubnetValidationException.java
deleted file mode 100644
index ae8291027..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/subnet/validation/SubnetValidationException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.ip.subnet.validation;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Collection;
-import javax.annotation.Nonnull;
-import org.apache.commons.lang3.StringUtils;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address;
-
-/**
- * Thrown as negative result of subnet validation
- */
-public class SubnetValidationException extends Exception {
-
- private SubnetValidationException(@Nonnull final String message) {
- super(message);
- }
-
- public static SubnetValidationException forConflictingData(@Nonnull final Short prefix, @Nonnull Collection<Address> addresses) {
- return new SubnetValidationException(
- "Attempt to define multiple addresses for same subnet[prefixLen = " + prefixToString(prefix) + "], "
- + "addresses : " + addressesToString(addresses));
- }
-
- private static String prefixToString(final Short prefix) {
- return checkNotNull(prefix, "Cannot create " + SubnetValidationException.class.getName() + " for null prefix")
- .toString();
- }
-
- private static String addressesToString(final Collection<Address> addresses) {
- return StringUtils.join(checkNotNull(addresses,
- "Cannot create " + SubnetValidationException.class.getName() + " for null address list"), " | ");
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/subnet/validation/SubnetValidator.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/subnet/validation/SubnetValidator.java
deleted file mode 100644
index a314eaf14..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/subnet/validation/SubnetValidator.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.ip.subnet.validation;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Multimaps;
-import io.fd.honeycomb.translate.v3po.interfaces.ip.Ipv4Writer;
-import java.util.List;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.Subnet;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.subnet.Netmask;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.subnet.PrefixLength;
-
-/**
- * Validator for detecting if there is an attempt to assign multiple addresses from same subnet
- */
-public class SubnetValidator implements Ipv4Writer {
-
- /**
- * Checks whether data provided for writing are not in collision with already existing data
- */
- public void checkNotAddingToSameSubnet(@Nonnull final List<Address> addresses)
- throws SubnetValidationException {
-
- final Multimap<Short, Address> prefixLengthRegister = Multimaps.index(addresses, toPrefixLength());
- final int keySetSize = prefixLengthRegister.keySet().size();
-
- if (keySetSize == 0 || keySetSize == addresses.size()) {
- //this means that every key is unique(has only one value) or no addresses were prefix-length based ,so there is no conflict
- return;
- }
-
- //finds conflicting prefix
- final Short conflictingPrefix = prefixLengthRegister.keySet()
- .stream()
- .filter(a -> prefixLengthRegister.get(a).size() > 1)
- .findFirst()
- .get();
-
- //and reports it with affected addresses
- throw SubnetValidationException
- .forConflictingData(conflictingPrefix, prefixLengthRegister.get(conflictingPrefix));
- }
-
- private Function<Address, Short> toPrefixLength() {
- return (final Address address) -> {
- final Subnet subnet = address.getSubnet();
-
- if (subnet instanceof PrefixLength) {
- return ((PrefixLength) subnet).getPrefixLength();
- }
-
- if (address.getSubnet() instanceof Netmask) {
- return (short) getSubnetMaskLength(
- checkNotNull(((Netmask) subnet).getNetmask(), "No netmask defined for %s", subnet)
- .getValue());
- }
-
- throw new IllegalArgumentException("Unsupported subnet : " + subnet);
- };
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/pbb/PbbRewriteCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/pbb/PbbRewriteCustomizer.java
deleted file mode 100644
index 8b6ccb128..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/pbb/PbbRewriteCustomizer.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.pbb;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.vpp.util.MacTranslator;
-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.dto.L2InterfacePbbTagRewrite;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.interfaces._interface.PbbRewrite;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class PbbRewriteCustomizer extends FutureJVppCustomizer
- implements WriterCustomizer<PbbRewrite>, MacTranslator, JvppReplyConsumer {
-
- private static final int OPERATION_DISABLE = 0;
-
- private final NamingContext interfaceNamingContext;
-
- public PbbRewriteCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceNamingContext) {
- super(futureJVppCore);
- this.interfaceNamingContext = checkNotNull(interfaceNamingContext, "Interface naming context cannot be null");
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<PbbRewrite> id,
- @Nonnull final PbbRewrite dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- try {
- setPbbRewrite(id, dataAfter, writeContext, false);
- } catch (TimeoutException | VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<PbbRewrite> id,
- @Nonnull final PbbRewrite dataBefore, @Nonnull final PbbRewrite dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- try {
- setPbbRewrite(id, dataAfter, writeContext, false);
- } catch (TimeoutException | VppBaseCallException e) {
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, e);
- }
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<PbbRewrite> id,
- @Nonnull final PbbRewrite dataBefore, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
-
- try {
- setPbbRewrite(id, dataBefore, writeContext, true);
- } catch (TimeoutException | VppBaseCallException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
- }
-
- private void setPbbRewrite(final InstanceIdentifier<PbbRewrite> id, final PbbRewrite data,
- final WriteContext writeContext, final boolean disable)
- throws TimeoutException, VppBaseCallException {
- final String interfaceName = checkNotNull(id.firstKeyOf(Interface.class), "Interface key not found").getName();
-
- final L2InterfacePbbTagRewrite request = new L2InterfacePbbTagRewrite();
-
- //checking all attributes in preconditions(pbb-rewrite is subcontainer, so there can't be mandatory statements)
- request.swIfIndex = interfaceNamingContext.getIndex(interfaceName, writeContext.getMappingContext());
- request.bDmac = parseMac(verifiedDestinationAddress(data));
- request.bSmac = parseMac(verifiedSourceAddress(data));
- request.bVlanid = verifiedBVlanId(data);
- request.iSid = verifiedISid(data);
- request.vtrOp = verifiedOperation(data, disable);
-
- //not sure whats gonna happen to this attribute, so its left optional for now
- if (data.getOuterTag() != null) {
- request.outerTag = data.getOuterTag().shortValue();
- }
-
- getReply(getFutureJVpp().l2InterfacePbbTagRewrite(request).toCompletableFuture());
- }
-
- private String verifiedDestinationAddress(final PbbRewrite data) {
- return checkNotNull(data.getDestinationAddress(), "Destination address cannot be null").getValue();
- }
-
- private String verifiedSourceAddress(final PbbRewrite data) {
- return checkNotNull(data.getSourceAddress(), "Destination address cannot be null").getValue();
- }
-
- private byte verifiedBVlanId(final PbbRewrite data) {
- return (byte) checkNotNull(data.getBVlanTagVlanId(), "BVlan id cannot be null").shortValue();
- }
-
- private int verifiedISid(final PbbRewrite data) {
- return checkNotNull(data.getITagIsid(), "ISid cannot be null").intValue();
- }
-
- // if disabled ,then uses non-public allowed value 0, which is equal to operation disable
- private int verifiedOperation(final PbbRewrite data, final boolean disable) {
-
- return disable
- ? OPERATION_DISABLE
- : checkNotNull(data.getInterfaceOperation(), "Operation cannot be null").getIntValue();
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/EthernetCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/EthernetCustomizer.java
deleted file mode 100644
index b2533a230..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/EthernetCustomizer.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Ethernet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.EthernetBuilder;
-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 EthernetCustomizer extends FutureJVppCustomizer
- implements InitializingReaderCustomizer<Ethernet, EthernetBuilder>, InterfaceDataTranslator {
-
- private static final Logger LOG = LoggerFactory.getLogger(EthernetCustomizer.class);
- private NamingContext interfaceContext;
-
- public EthernetCustomizer(@Nonnull final FutureJVppCore jvpp,
- @Nonnull final NamingContext interfaceContext) {
- super(jvpp);
- this.interfaceContext = interfaceContext;
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder,
- @Nonnull final Ethernet readValue) {
- ((VppInterfaceStateAugmentationBuilder) parentBuilder).setEthernet(readValue);
- }
-
- @Nonnull
- @Override
- public EthernetBuilder getBuilder(@Nonnull InstanceIdentifier<Ethernet> id) {
- return new EthernetBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Ethernet> id,
- @Nonnull final EthernetBuilder builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
-
- final InterfaceKey key = id.firstKeyOf(Interface.class);
- final SwInterfaceDetails iface = getVppInterfaceDetails(getFutureJVpp(), id, key.getName(),
- interfaceContext.getIndex(key.getName(), ctx.getMappingContext()), ctx.getModificationCache(), LOG);
-
- if (iface.linkMtu != 0) {
- builder.setMtu((int) iface.linkMtu);
- }
-
- switch (iface.linkDuplex) {
- case 1:
- builder.setDuplex(Ethernet.Duplex.Half);
- break;
- case 2:
- builder.setDuplex(Ethernet.Duplex.Full);
- break;
- default:
- break;
- }
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Ethernet> init(
- @Nonnull final InstanceIdentifier<Ethernet> id,
- @Nonnull final Ethernet readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id),
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.EthernetBuilder()
- .setMtu(readValue.getMtu())
- .build());
- }
-
- private InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Ethernet> getCfgId(
- final InstanceIdentifier<Ethernet> id) {
- return InterfaceCustomizer.getCfgId(RWUtils.cutId(id, Interface.class))
- .augmentation(VppInterfaceAugmentation.class)
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Ethernet.class);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/GreCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/GreCustomizer.java
deleted file mode 100644
index 2fb94c1e1..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/GreCustomizer.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2016 Intel 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.translate.v3po.interfacesstate;
-
-import static com.google.common.base.Preconditions.checkState;
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.core.dto.GreTunnelDetails;
-import io.fd.vpp.jvpp.core.dto.GreTunnelDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.GreTunnelDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Arrays;
-import java.util.concurrent.CompletionStage;
-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.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.GreTunnel;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Gre;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.GreBuilder;
-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 GreCustomizer extends FutureJVppCustomizer
- implements InitializingReaderCustomizer<Gre, GreBuilder>, InterfaceDataTranslator {
-
- private static final Logger LOG = LoggerFactory.getLogger(GreCustomizer.class);
- private NamingContext interfaceContext;
-
- public GreCustomizer(@Nonnull final FutureJVppCore jvpp, @Nonnull final NamingContext interfaceContext) {
- super(jvpp);
- this.interfaceContext = interfaceContext;
- }
-
- @Override
- public void merge(@Nonnull Builder<? extends DataObject> parentBuilder,
- @Nonnull Gre readValue) {
- ((VppInterfaceStateAugmentationBuilder) parentBuilder).setGre(readValue);
- }
-
- @Nonnull
- @Override
- public GreBuilder getBuilder(@Nonnull InstanceIdentifier<Gre> id) {
- return new GreBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Gre> id,
- @Nonnull final GreBuilder builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- final InterfaceKey key = id.firstKeyOf(Interface.class);
- final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext());
- if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index, GreTunnel.class, LOG)) {
- return;
- }
-
- LOG.debug("Reading attributes for gre tunnel: {}", key.getName());
- // Dump just a single
- final GreTunnelDump request = new GreTunnelDump();
- request.swIfIndex = index;
-
- final CompletionStage<GreTunnelDetailsReplyDump> swInterfaceGreDetailsReplyDumpCompletionStage =
- getFutureJVpp().greTunnelDump(request);
- final GreTunnelDetailsReplyDump reply =
- getReplyForRead(swInterfaceGreDetailsReplyDumpCompletionStage.toCompletableFuture(), id);
-
- // VPP keeps gre tunnel interfaces even after they were deleted (optimization)
- // However there ar no longer any gre tunnel specific fields assigned to it and this call
- // returns nothing
- if (reply == null || reply.greTunnelDetails == null || reply.greTunnelDetails.isEmpty()) {
- LOG.debug(
- "Gre tunnel {}, id {} has no attributes assigned in VPP. Probably is a leftover interface placeholder" +
- "after delete", key.getName(), index);
- return;
- }
-
- checkState(reply.greTunnelDetails.size() == 1,
- "Unexpected number of returned gre tunnels: {} for tunnel: {}", reply.greTunnelDetails,
- key.getName());
- LOG.trace("Gre tunnel: {} attributes returned from VPP: {}", key.getName(), reply);
-
- final GreTunnelDetails swInterfaceGreDetails = reply.greTunnelDetails.get(0);
- if (swInterfaceGreDetails.isIpv6 == 1) {
- final Ipv6Address dstIpv6 =
- new Ipv6Address(parseAddress(swInterfaceGreDetails.dstAddress).getHostAddress());
- builder.setDst(new IpAddress(dstIpv6));
- final Ipv6Address srcIpv6 =
- new Ipv6Address(parseAddress(swInterfaceGreDetails.srcAddress).getHostAddress());
- builder.setSrc(new IpAddress(srcIpv6));
- } else {
- final byte[] dstBytes = Arrays.copyOfRange(swInterfaceGreDetails.dstAddress, 0, 4);
- final Ipv4Address dstIpv4 = new Ipv4Address(parseAddress(dstBytes).getHostAddress());
- builder.setDst(new IpAddress(dstIpv4));
- final byte[] srcBytes = Arrays.copyOfRange(swInterfaceGreDetails.srcAddress, 0, 4);
- final Ipv4Address srcIpv4 = new Ipv4Address(parseAddress(srcBytes).getHostAddress());
- builder.setSrc(new IpAddress(srcIpv4));
- }
- builder.setOuterFibId((long) swInterfaceGreDetails.outerFibId);
- LOG.debug("Gre tunnel: {}, id: {} attributes read as: {}", key.getName(), index, builder);
- }
-
- @Nonnull
- private static InetAddress parseAddress(@Nonnull final byte[] addr) {
- try {
- return InetAddress.getByAddress(addr);
- } catch (UnknownHostException e) {
- throw new IllegalArgumentException("Cannot create InetAddress from " + Arrays.toString(addr), e);
- }
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Gre> init(
- @Nonnull final InstanceIdentifier<Gre> id, @Nonnull final Gre readValue, @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id),
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.GreBuilder()
- .setDst(readValue.getDst())
- .setSrc(readValue.getSrc())
- .setOuterFibId(readValue.getOuterFibId())
- .build());
- }
-
- private InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Gre> getCfgId(
- final InstanceIdentifier<Gre> id) {
- return InterfaceCustomizer.getCfgId(RWUtils.cutId(id, Interface.class))
- .augmentation(VppInterfaceAugmentation.class)
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Gre.class);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterconnectionReadUtils.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterconnectionReadUtils.java
deleted file mode 100644
index be4eca66f..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterconnectionReadUtils.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static com.google.common.base.Preconditions.checkState;
-import static java.util.Objects.requireNonNull;
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainDetails;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainDump;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainSwIfDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.Optional;
-import java.util.concurrent.CompletableFuture;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.Interconnection;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.interconnection.BridgeBasedBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Utility class providing Interconnection read support.
- */
-final class InterconnectionReadUtils implements InterfaceDataTranslator {
-
- private static final Logger LOG = LoggerFactory.getLogger(InterconnectionReadUtils.class);
-
- private final FutureJVppCore futureJVppCore;
- private final NamingContext interfaceContext;
- private final NamingContext bridgeDomainContext;
-
- InterconnectionReadUtils(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext bridgeDomainContext) {
- this.futureJVppCore = requireNonNull(futureJVppCore, "futureJVppCore should not be null");
- this.interfaceContext = requireNonNull(interfaceContext, "interfaceContext should not be null");
- this.bridgeDomainContext = requireNonNull(bridgeDomainContext, "bridgeDomainContext should not be null");
- }
-
- @Nullable
- Interconnection readInterconnection(@Nonnull final InstanceIdentifier<?> id, @Nonnull final String ifaceName,
- @Nonnull final ReadContext ctx)
- throws ReadFailedException {
- final int ifaceId = interfaceContext.getIndex(ifaceName, ctx.getMappingContext());
-
- final SwInterfaceDetails iface = getVppInterfaceDetails(futureJVppCore, id, ifaceName,
- ifaceId, ctx.getModificationCache(), LOG);
- LOG.debug("Interface details for interface: {}, details: {}", ifaceName, iface);
-
- final BridgeDomainDetailsReplyDump dumpReply = getDumpReply(id);
- final Optional<BridgeDomainSwIfDetails> bdForInterface = getBridgeDomainForInterface(ifaceId, dumpReply);
- if (bdForInterface.isPresent()) {
- final BridgeDomainSwIfDetails bdSwIfDetails = bdForInterface.get();
- final BridgeBasedBuilder bbBuilder = new BridgeBasedBuilder();
- bbBuilder.setBridgeDomain(bridgeDomainContext.getName(bdSwIfDetails.bdId, ctx.getMappingContext()));
-
- // Set BVI if the bridgeDomainDetails.bviSwIfIndex == current sw if index
- final Optional<BridgeDomainDetails> bridgeDomainForInterface =
- getBridgeDomainForInterface(dumpReply, bdForInterface.get().bdId);
- // Since we already found an interface assigned to a bridge domain, the details for BD must be present
- checkState(bridgeDomainForInterface.isPresent());
- if (bridgeDomainForInterface.get().bviSwIfIndex == ifaceId) {
- bbBuilder.setBridgedVirtualInterface(true);
- } else {
- bbBuilder.setBridgedVirtualInterface(false);
- }
-
- if (bdSwIfDetails.shg != 0) {
- bbBuilder.setSplitHorizonGroup((short) bdSwIfDetails.shg);
- }
- return bbBuilder.build();
- }
- // TODO HONEYCOMB-190 is there a way to check if interconnection is XconnectBased?
-
- return null;
- }
-
- private Optional<BridgeDomainSwIfDetails> getBridgeDomainForInterface(final int ifaceId,
- final BridgeDomainDetailsReplyDump reply) {
- if (null == reply || null == reply.bridgeDomainSwIfDetails || reply.bridgeDomainSwIfDetails.isEmpty()) {
- return Optional.empty();
- }
- // interface can be added to only one BD only
- return reply.bridgeDomainSwIfDetails.stream().filter(a -> a.swIfIndex == ifaceId).findFirst();
- }
-
- private Optional<BridgeDomainDetails> getBridgeDomainForInterface(final BridgeDomainDetailsReplyDump reply,
- int bdId) {
- return reply.bridgeDomainDetails.stream().filter(a -> a.bdId == bdId).findFirst();
- }
-
- private BridgeDomainDetailsReplyDump getDumpReply(@Nonnull final InstanceIdentifier<?> id)
- throws ReadFailedException {
- // We need to perform full bd dump, because there is no way
- // to ask VPP for BD details given interface id/name (TODO HONEYCOMB-190 add it to vpp.api?)
- // TODO HONEYCOMB-190 cache dump result
- final BridgeDomainDump request = new BridgeDomainDump();
- request.bdId = -1;
-
- final CompletableFuture<BridgeDomainDetailsReplyDump> bdCompletableFuture =
- futureJVppCore.bridgeDomainSwIfDump(request).toCompletableFuture();
- return getReplyForRead(bdCompletableFuture, id);
-
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizer.java
deleted file mode 100644
index 4308f34a0..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizer.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import io.fd.honeycomb.translate.MappingContext;
-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.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
-import io.fd.honeycomb.translate.v3po.DisabledInterfacesManager;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.CompletableFuture;
-import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.AdminStatus;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Customizer for reading ietf-interfaces:interfaces-state/interface.
- */
-public class InterfaceCustomizer extends FutureJVppCustomizer
- implements InitializingListReaderCustomizer<Interface, InterfaceKey, InterfaceBuilder>, ByteDataTranslator,
- InterfaceDataTranslator {
-
- public static final String DUMPED_IFCS_CONTEXT_KEY =
- InterfaceCustomizer.class.getName() + "dumpedInterfacesDuringGetAllIds";
- private static final Logger LOG = LoggerFactory.getLogger(InterfaceCustomizer.class);
- private final NamingContext interfaceNamingContext;
- private final DisabledInterfacesManager interfaceDisableContext;
-
- public InterfaceCustomizer(@Nonnull final FutureJVppCore jvpp,
- @Nonnull final NamingContext interfaceNamingContext,
- @Nonnull final DisabledInterfacesManager interfaceDisableContext) {
- super(jvpp);
- this.interfaceNamingContext = interfaceNamingContext;
- this.interfaceDisableContext = interfaceDisableContext;
- }
-
- public static void cacheInterfaceDump(final @Nonnull ReadContext context, final SwInterfaceDetailsReplyDump ifaces) {
- context.getModificationCache().put(DUMPED_IFCS_CONTEXT_KEY, ifaces.swInterfaceDetails.stream()
- .collect(Collectors.toMap(t -> t.swIfIndex, swInterfaceDetails -> swInterfaceDetails)));
- }
-
- @Nonnull
- @SuppressWarnings("unchecked")
- public static Map<Integer, SwInterfaceDetails> getCachedInterfaceDump(@Nonnull final ModificationCache ctx) {
- return ctx.get(DUMPED_IFCS_CONTEXT_KEY) == null
- ? new HashMap<>()
- // allow customizers to update the cache
- : (Map<Integer, SwInterfaceDetails>) ctx.get(DUMPED_IFCS_CONTEXT_KEY);
- }
-
- private static boolean isRegularInterface(final SwInterfaceDetails iface) {
- return iface.subId == 0;
- }
-
- @Nonnull
- @Override
- public InterfaceBuilder getBuilder(@Nonnull InstanceIdentifier<Interface> id) {
- return new InterfaceBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull InstanceIdentifier<Interface> id, @Nonnull InterfaceBuilder builder,
- @Nonnull ReadContext ctx) throws ReadFailedException {
- LOG.debug("Reading attributes for interface: {}", id);
- final String ifaceName = id.firstKeyOf(id.getTargetType()).getName();
-
- final int index = interfaceNamingContext.getIndex(ifaceName, ctx.getMappingContext());
-
- // Ignore disabled interface (such as deleted VXLAN tunnels)
- if (interfaceDisableContext.isInterfaceDisabled(index, ctx.getMappingContext())) {
- LOG.debug("Skipping disabled interface: {}", id);
- return;
- }
-
- // Pass cached details from getAllIds to getDetails to avoid additional dumps
- final SwInterfaceDetails iface = getVppInterfaceDetails(getFutureJVpp(), id, ifaceName,
- index, ctx.getModificationCache(), LOG);
- LOG.debug("Interface details for interface: {}, details: {}", ifaceName, iface);
-
- if (!isRegularInterface(iface)) {
- LOG.debug("Interface: {} is a sub-interface. Ignoring read request.", ifaceName);
- return;
- }
-
- builder.setName(ifaceName);
- builder.setType(getInterfaceType(new String(iface.interfaceName).intern()));
- builder.setIfIndex(vppIfIndexToYang(iface.swIfIndex));
- builder.setAdminStatus(1 == iface.adminUpDown
- ? AdminStatus.Up
- : AdminStatus.Down);
- builder.setOperStatus(1 == iface.linkUpDown
- ? OperStatus.Up
- : OperStatus.Down);
- if (0 != iface.linkSpeed) {
- builder.setSpeed(vppInterfaceSpeedToYang(iface.linkSpeed));
- }
- if (iface.l2AddressLength == 6) {
- builder.setPhysAddress(new PhysAddress(vppPhysAddrToYang(iface.l2Address)));
- }
- LOG.trace("Base attributes read for interface: {} as: {}", ifaceName, builder);
- }
-
- @Nonnull
- @Override
- public List<InterfaceKey> getAllIds(@Nonnull final InstanceIdentifier<Interface> id,
- @Nonnull final ReadContext context) throws ReadFailedException {
- final List<InterfaceKey> interfacesKeys;
- LOG.trace("Dumping all interfaces to get all IDs");
-
- final SwInterfaceDump request = new SwInterfaceDump();
- request.nameFilter = "".getBytes();
- request.nameFilterValid = 0;
-
- final CompletableFuture<SwInterfaceDetailsReplyDump> swInterfaceDetailsReplyDumpCompletableFuture =
- getFutureJVpp().swInterfaceDump(request).toCompletableFuture();
- final SwInterfaceDetailsReplyDump ifaces =
- getReplyForRead(swInterfaceDetailsReplyDumpCompletableFuture, id);
-
- if (null == ifaces || null == ifaces.swInterfaceDetails) {
- LOG.debug("No interfaces for :{} found in VPP", id);
- return Collections.emptyList();
- }
-
- // Cache interfaces dump in per-tx context to later be used in readCurrentAttributes
- cacheInterfaceDump(context, ifaces);
-
- final MappingContext mappingCtx = context.getMappingContext();
- final Set<Integer> interfacesIdxs = ifaces.swInterfaceDetails.stream()
- .filter(elt -> elt != null)
- // Filter out disabled interfaces, dont read them
- // This also prevents child readers in being invoked such as vxlan (which relies on disabling interfaces)
- .filter(elt -> !interfaceDisableContext
- .isInterfaceDisabled(elt.swIfIndex, mappingCtx))
- .map((elt) -> {
- // Store interface name from VPP in context if not yet present
- if (!interfaceNamingContext.containsName(elt.swIfIndex, mappingCtx)) {
- interfaceNamingContext.addName(elt.swIfIndex, toString(elt.interfaceName),
- mappingCtx);
- }
- LOG.trace("Interface with name: {}, VPP name: {} and index: {} found in VPP",
- interfaceNamingContext.getName(elt.swIfIndex, mappingCtx),
- elt.interfaceName,
- elt.swIfIndex);
-
- return elt;
- })
- // filter out sub-interfaces
- .filter(InterfaceCustomizer::isRegularInterface)
- .map(elt -> elt.swIfIndex)
- .collect(Collectors.toSet());
-
- // Clean disabled interfaces list
- interfaceDisableContext.getDisabledInterfaces(mappingCtx).stream()
- // Find indices not currently in VPP
- .filter(interfacesIdxs::contains)
- // Remove from disabled list ... not disabled if not existing
- .forEach(idx -> interfaceDisableContext.removeDisabledInterface(idx, mappingCtx));
-
- // Transform indices to keys
- interfacesKeys = interfacesIdxs.stream()
- .map(index -> new InterfaceKey(interfaceNamingContext.getName(index, context.getMappingContext())))
- .collect(Collectors.toList());
-
- LOG.debug("Interfaces found in VPP: {}", interfacesKeys);
- return interfacesKeys;
- }
-
- @Override
- public void merge(@Nonnull final org.opendaylight.yangtools.concepts.Builder<? extends DataObject> builder,
- @Nonnull final List<Interface> readData) {
- ((InterfacesStateBuilder) builder).setInterface(readData);
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface> init(
- @Nonnull final InstanceIdentifier<Interface> id, @Nonnull final Interface readValue, @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id),
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder()
- .setName(readValue.getName())
- .setType(readValue.getType())
- .setEnabled(AdminStatus.Up.equals(readValue.getAdminStatus()))
- // Not present in interfaces-state
- // .setLinkUpDownTrapEnable()
- .build());
- }
-
- public static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface> getCfgId(
- final InstanceIdentifier<Interface> id) {
- return InstanceIdentifier.create(Interfaces.class).child(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface.class,
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey(
- id.firstKeyOf(Interface.class).getName()));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceDataTranslator.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceDataTranslator.java
deleted file mode 100644
index 2864c6e6a..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceDataTranslator.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static java.util.Objects.requireNonNull;
-
-import io.fd.honeycomb.translate.ModificationCache;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.math.BigInteger;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.CompletionStage;
-import java.util.stream.Collector;
-import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.EthernetCsmacd;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Gauge64;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.GreTunnel;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.Loopback;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.Tap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VhostUser;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VxlanGpeTunnel;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VxlanTunnel;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-
-public interface InterfaceDataTranslator extends ByteDataTranslator, JvppReplyConsumer {
-
- Gauge64 vppLinkSpeed0 = new Gauge64(BigInteger.ZERO);
- Gauge64 vppLinkSpeed1 = new Gauge64(BigInteger.valueOf(10L * 1000000));
- Gauge64 vppLinkSpeed2 = new Gauge64(BigInteger.valueOf(100L * 1000000));
- Gauge64 vppLinkSpeed4 = new Gauge64(BigInteger.valueOf(1000L * 1000000));
- Gauge64 vppLinkSpeed8 = new Gauge64(BigInteger.valueOf(10000L * 1000000));
- Gauge64 vppLinkSpeed16 = new Gauge64(BigInteger.valueOf(40000L * 1000000));
- Gauge64 vppLinkSpeed32 = new Gauge64(BigInteger.valueOf(100000L * 1000000));
-
- char[] HEX_CHARS = "0123456789abcdef".toCharArray();
-
- int PHYSICAL_ADDRESS_LENGTH = 6;
-
- Collector<SwInterfaceDetails, ?, SwInterfaceDetails> SINGLE_ITEM_COLLECTOR =
- RWUtils.singleItemCollector();
-
- /**
- * Convert VPP's link speed bitmask to Yang type. 1 = 10M, 2 = 100M, 4 = 1G, 8 = 10G, 16 = 40G, 32 = 100G
- *
- * @param vppLinkSpeed Link speed in bitmask format from VPP.
- * @return Converted value from VPP link speed
- */
- default Gauge64 vppInterfaceSpeedToYang(byte vppLinkSpeed) {
- switch (vppLinkSpeed) {
- case 1:
- return vppLinkSpeed1;
- case 2:
- return vppLinkSpeed2;
- case 4:
- return vppLinkSpeed4;
- case 8:
- return vppLinkSpeed8;
- case 16:
- return vppLinkSpeed16;
- case 32:
- return vppLinkSpeed32;
- default:
- return vppLinkSpeed0;
- }
- }
-
- default void appendHexByte(final StringBuilder sb, final byte b) {
- final int v = b & 0xFF;
- sb.append(HEX_CHARS[v >>> 4]);
- sb.append(HEX_CHARS[v & 15]);
- }
-
- /**
- * Reads first 6 bytes of supplied byte array and converts to string as Yang dictates <p> Replace later with
- * https://git.opendaylight.org/gerrit/#/c/34869/10/model/ietf/ietf-type- util/src/main/
- * java/org/opendaylight/mdsal/model/ietf/util/AbstractIetfYangUtil.java
- *
- * @param vppPhysAddress byte array of bytes in big endian order, constructing the network IF physical address.
- * @return String like "aa:bb:cc:dd:ee:ff"
- * @throws NullPointerException if vppPhysAddress is null
- * @throws IllegalArgumentException if vppPhysAddress.length < 6
- */
- default String vppPhysAddrToYang(@Nonnull final byte[] vppPhysAddress) {
- return vppPhysAddrToYang(vppPhysAddress, 0);
- }
-
- default String vppPhysAddrToYang(@Nonnull final byte[] vppPhysAddress, final int startIndex) {
- Objects.requireNonNull(vppPhysAddress, "Empty physical address bytes");
- final int endIndex = startIndex + PHYSICAL_ADDRESS_LENGTH;
- checkArgument(endIndex <= vppPhysAddress.length,
- "Invalid physical address size (%s) for given startIndex (%s), expected >= %s", vppPhysAddress.length,
- startIndex, endIndex);
- return printHexBinary(vppPhysAddress, startIndex, endIndex);
- }
-
- default String printHexBinary(@Nonnull final byte[] bytes) {
- Objects.requireNonNull(bytes, "bytes array should not be null");
- return printHexBinary(bytes, 0, bytes.length);
- }
-
- default String printHexBinary(@Nonnull final byte[] bytes, final int startIndex, final int endIndex) {
- StringBuilder str = new StringBuilder();
-
- appendHexByte(str, bytes[startIndex]);
- for (int i = startIndex + 1; i < endIndex; i++) {
- str.append(":");
- appendHexByte(str, bytes[i]);
- }
-
- return str.toString();
- }
-
- /**
- * VPP's interface index is counted from 0, whereas ietf-interface's if-index is from 1. This function converts from
- * VPP's interface index to YANG's interface index.
- *
- * @param vppIfIndex the sw interface index VPP reported.
- * @return VPP's interface index incremented by one
- */
- default int vppIfIndexToYang(int vppIfIndex) {
- return vppIfIndex + 1;
- }
-
- /**
- * This function does the opposite of what {@link #vppIfIndexToYang(int)} does.
- *
- * @param yangIfIndex if-index from ietf-interfaces.
- * @return VPP's representation of the if-index
- */
- default int yangIfIndexToVpp(int yangIfIndex) {
- checkArgument(yangIfIndex >= 1, "YANG if-index has invalid value %s", yangIfIndex);
- return yangIfIndex - 1;
- }
-
-
- /**
- * Queries VPP for interface description given interface key.
- *
- * @param futureJVppCore VPP Java Future API
- * @param id InstanceIdentifier, which is passed in ReadFailedException
- * @param name interface name
- * @param index VPP index of the interface
- * @param ctx per-tx scope context containing cached dump with all the interfaces. If the cache is not
- * available or outdated, another dump will be performed.
- * @return SwInterfaceDetails DTO or null if interface was not found
- * @throws IllegalArgumentException If interface cannot be found
- * @throws ReadFailedException If read operation had failed
- */
- @Nonnull
- default SwInterfaceDetails getVppInterfaceDetails(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final InstanceIdentifier<?> id,
- @Nonnull final String name, final int index,
- @Nonnull final ModificationCache ctx,
- @Nonnull final Logger callerLogger)
- throws ReadFailedException {
- requireNonNull(futureJVppCore, "futureJVppCore should not be null");
- requireNonNull(name, "name should not be null");
- requireNonNull(ctx, "ctx should not be null");
-
- final SwInterfaceDump request = new SwInterfaceDump();
- request.nameFilter = name.getBytes();
- request.nameFilterValid = 1;
-
- final Map<Integer, SwInterfaceDetails> allInterfaces = InterfaceCustomizer.getCachedInterfaceDump(ctx);
-
- // Returned cached if available
- if (allInterfaces.containsKey(index)) {
- return allInterfaces.get(index);
- }
-
- SwInterfaceDetailsReplyDump ifaces;
-
- CompletionStage<SwInterfaceDetailsReplyDump> requestFuture = futureJVppCore.swInterfaceDump(request);
- ifaces = getReplyForRead(requestFuture.toCompletableFuture(), id);
- if (null == ifaces || null == ifaces.swInterfaceDetails || ifaces.swInterfaceDetails.isEmpty()) {
- request.nameFilterValid = 0;
-
- callerLogger.warn("VPP returned null instead of interface by key {} and its not cached", name);
- callerLogger.warn("Iterating through all the interfaces to find interface: {}", name);
-
- // Or else just perform full dump and do inefficient filtering
- requestFuture = futureJVppCore.swInterfaceDump(request);
- ifaces = getReplyForRead(requestFuture.toCompletableFuture(), id);
-
- // Update the cache
- allInterfaces.clear();
- allInterfaces
- .putAll(ifaces.swInterfaceDetails.stream().collect(Collectors.toMap(d -> d.swIfIndex, d -> d)));
-
- if (allInterfaces.containsKey(index)) {
- return allInterfaces.get(index);
- }
- throw new IllegalArgumentException("Unable to find interface " + name);
- }
-
- // SwInterfaceDump's name filter does prefix match, so we need additional filtering:
- final SwInterfaceDetails iface =
- ifaces.swInterfaceDetails.stream().filter(d -> d.swIfIndex == index).collect(SINGLE_ITEM_COLLECTOR);
- allInterfaces.put(index, iface); // update the cache
- return iface;
- }
-
- /**
- * Determine interface type based on its VPP name (relying on VPP's interface naming conventions)
- *
- * @param interfaceName VPP generated interface name
- * @return Interface type
- */
- @Nonnull
- default Class<? extends InterfaceType> getInterfaceType(@Nonnull final String interfaceName) {
- if (interfaceName.startsWith("tap")) {
- return Tap.class;
- }
-
- if (interfaceName.startsWith("vxlan_gpe")) {
- return VxlanGpeTunnel.class;
- }
-
- if (interfaceName.startsWith("vxlan")) {
- return VxlanTunnel.class;
- }
-
- if (interfaceName.startsWith("gre")) {
- return GreTunnel.class;
- }
-
- if (interfaceName.startsWith("VirtualEthernet")) {
- return VhostUser.class;
- }
-
- if (interfaceName.startsWith("loop")) {
- return Loopback.class;
- }
-
- return EthernetCsmacd.class;
- }
-
- /**
- * Check interface type. Uses interface details from VPP to determine. Uses {@link
- * #getVppInterfaceDetails(FutureJVppCore, InstanceIdentifier, String, int, ModificationCache, Logger)} internally
- * so tries to utilize cache before asking VPP.
- */
- default boolean isInterfaceOfType(@Nonnull final FutureJVppCore jvpp,
- @Nonnull final ModificationCache cache,
- @Nonnull final InstanceIdentifier<?> id,
- final int index,
- @Nonnull final Class<? extends InterfaceType> ifcType,
- @Nonnull final Logger callerLogger)
- throws ReadFailedException {
- final String name = id.firstKeyOf(Interface.class).getName();
- final SwInterfaceDetails vppInterfaceDetails =
- getVppInterfaceDetails(jvpp, id, name, index, cache, callerLogger);
-
- return isInterfaceOfType(ifcType, vppInterfaceDetails);
- }
-
- default boolean isInterfaceOfType(final Class<? extends InterfaceType> ifcType,
- final SwInterfaceDetails cachedDetails) {
- return ifcType.equals(getInterfaceType(toString(cachedDetails.interfaceName)));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/L2Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/L2Customizer.java
deleted file mode 100644
index 2a29fddeb..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/L2Customizer.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-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.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.L2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.L2Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.Interconnection;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.interconnection.BridgeBased;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.interconnection.BridgeBasedBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.interconnection.XconnectBased;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.interconnection.XconnectBasedBuilder;
-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;
-
-/**
- * Customizer for reading ietf-interfaces:interfaces-state/interface/iface_name/v3po:l2
- */
-public class L2Customizer extends FutureJVppCustomizer implements InitializingReaderCustomizer<L2, L2Builder> {
-
- private static final Logger LOG = LoggerFactory.getLogger(L2Customizer.class);
- private final InterconnectionReadUtils icReadUtils;
-
- public L2Customizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext bridgeDomainContext) {
- super(futureJVppCore);
- this.icReadUtils = new InterconnectionReadUtils(futureJVppCore, interfaceContext, bridgeDomainContext);
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final L2 readValue) {
- ((VppInterfaceStateAugmentationBuilder) parentBuilder).setL2(readValue);
- }
-
- @Nonnull
- @Override
- public L2Builder getBuilder(@Nonnull final InstanceIdentifier<L2> id) {
- return new L2Builder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<L2> id, @Nonnull final L2Builder builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
-
- LOG.debug("Reading attributes for L2: {}", id);
- final InterfaceKey key = id.firstKeyOf(Interface.class);
- final String ifaceName = key.getName();
- builder.setInterconnection(icReadUtils.readInterconnection(id, ifaceName, ctx));
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.L2> init(
- @Nonnull final InstanceIdentifier<L2> id,
- @Nonnull final L2 readValue,
- @Nonnull final ReadContext ctx) {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.L2Builder
- l2Builder =
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.L2Builder();
-
- final Interconnection interconnection = readValue.getInterconnection();
- if (interconnection != null) {
- if (interconnection instanceof XconnectBased) {
- final XconnectBasedBuilder xconnectBasedBuilder = new XconnectBasedBuilder();
- xconnectBasedBuilder.setXconnectOutgoingInterface(
- ((XconnectBased) interconnection).getXconnectOutgoingInterface());
- l2Builder.setInterconnection(xconnectBasedBuilder.build());
- } else if (interconnection instanceof BridgeBased) {
- final BridgeBasedBuilder bridgeBasedBuilder = new BridgeBasedBuilder();
- bridgeBasedBuilder.setBridgeDomain(((BridgeBased) interconnection).getBridgeDomain());
- bridgeBasedBuilder
- .setBridgedVirtualInterface(((BridgeBased) interconnection).isBridgedVirtualInterface());
- bridgeBasedBuilder.setSplitHorizonGroup(((BridgeBased) interconnection).getSplitHorizonGroup());
- l2Builder.setInterconnection(bridgeBasedBuilder.build());
- }
- }
-
- return Initialized.create(getCfgId(id), l2Builder.build());
- }
-
- private InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.L2> getCfgId(
- final InstanceIdentifier<L2> id) {
- return InterfaceCustomizer.getCfgId(RWUtils.cutId(id, Interface.class))
- .augmentation(VppInterfaceAugmentation.class)
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.L2.class);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ProxyArpCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ProxyArpCustomizer.java
deleted file mode 100644
index e3d6ed0eb..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ProxyArpCustomizer.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-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.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.ProxyArp;
-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.future.FutureJVppCore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ProxyArpCustomizer extends FutureJVppCustomizer
- implements ReaderCustomizer<ProxyArp,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.ProxyArpBuilder> {
-
- private static final Logger LOG = LoggerFactory.getLogger(ProxyArpCustomizer.class);
- private final NamingContext interfaceContext;
-
- public ProxyArpCustomizer(final FutureJVppCore vppApi, final NamingContext interfaceContext) {
- super(vppApi);
- this.interfaceContext = interfaceContext;
- }
-
- @Override
- public void merge(@Nonnull Builder<? extends DataObject> parentBuilder,
- @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214
- .interfaces.state._interface.ProxyArp readValue) {
-
- ((VppInterfaceStateAugmentationBuilder) parentBuilder).setProxyArp(readValue);
- }
-
- @Nonnull
- @Override
- public org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state
- ._interface.ProxyArpBuilder getBuilder(
- @Nonnull InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight
- .params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.ProxyArp> id) {
-
- return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces
- .state._interface.ProxyArpBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight
- .params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.ProxyArp> id,
- @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po
- .rev161214.interfaces.state._interface.ProxyArpBuilder builder,
- @Nonnull ReadContext ctx) throws ReadFailedException {
-
- //TODO: VPP-225 Implement fully when VPP Proxy ARP read API is available + add initializing
- final InterfaceKey key = id.firstKeyOf(Interface.class);
- final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext());
- LOG.warn("Reading of ARP data not (yet) supported by VPP API");
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/RewriteCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/RewriteCustomizer.java
deleted file mode 100644
index da6bf7a10..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/RewriteCustomizer.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static com.google.common.base.Preconditions.checkState;
-
-import com.google.common.base.Preconditions;
-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.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils;
-import io.fd.honeycomb.translate.vpp.util.TagRewriteOperation;
-import java.util.ArrayList;
-import java.util.List;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.CVlan;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.Dot1qTagVlanType;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.Dot1qVlanId;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.SVlan;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.Dot1qTagBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214._802dot1ad;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214._802dot1q;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.L2Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.l2.Rewrite;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.l2.RewriteBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.tag.rewrite.PushTags;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.tag.rewrite.PushTagsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.tag.rewrite.PushTagsKey;
-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.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Customizer for reading vlan tag-rewrite configuration state form the VPP.
- */
-public class RewriteCustomizer extends FutureJVppCustomizer
- implements ReaderCustomizer<Rewrite, RewriteBuilder>, InterfaceDataTranslator {
-
- // No initialization necessary since its parent Subinterface L2 customzier sets the entire subtree during
- // initialization
-
- private static final Logger LOG = LoggerFactory.getLogger(RewriteCustomizer.class);
- private final NamingContext interfaceContext;
-
- public RewriteCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext) {
- super(futureJVppCore);
- this.interfaceContext = Preconditions.checkNotNull(interfaceContext, "interfaceContext should not be null");
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder,
- @Nonnull final Rewrite readValue) {
- ((L2Builder) parentBuilder).setRewrite(readValue);
- }
-
- @Nonnull
- @Override
- public RewriteBuilder getBuilder(@Nonnull final InstanceIdentifier<Rewrite> id) {
- return new RewriteBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Rewrite> id,
- @Nonnull final RewriteBuilder builder, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
- final String subInterfaceName = getSubInterfaceName(id);
- LOG.debug("Reading attributes for sub interface: {}", subInterfaceName);
-
- final SwInterfaceDetails iface = getVppInterfaceDetails(getFutureJVpp(), id, subInterfaceName,
- interfaceContext.getIndex(subInterfaceName, ctx.getMappingContext()), ctx.getModificationCache(), LOG);
- LOG.debug("VPP sub-interface details: {}", iface);
-
- checkState(iface.subId != 0, "Interface returned by the VPP is not a sub-interface");
-
- final TagRewriteOperation operation = TagRewriteOperation.get(iface.vtrOp);
- if (TagRewriteOperation.disabled == operation) {
- LOG.debug("Tag rewrite operation is disabled for ");
- return;
- }
-
- builder.setVlanType(iface.vtrPushDot1Q == 1
- ? _802dot1q.class
- : _802dot1ad.class);
-
- setPushTags(builder, iface);
- setPopTags(builder, operation);
- }
-
- private static String getSubInterfaceName(final InstanceIdentifier<Rewrite> id) {
- return SubInterfaceUtils.getSubInterfaceName(id.firstKeyOf(Interface.class).getName(),
- Math.toIntExact(id.firstKeyOf(SubInterface.class).getIdentifier()));
- }
-
- private void setPopTags(final RewriteBuilder builder, final TagRewriteOperation operation) {
- final byte numberOfTagsToPop = operation.getPopTags();
- if (numberOfTagsToPop != 0) {
- builder.setPopTags(Short.valueOf(numberOfTagsToPop));
- }
- }
-
- private void setPushTags(final RewriteBuilder builder, final SwInterfaceDetails iface) {
- final List<PushTags> tags = new ArrayList<>();
- if (iface.vtrTag1 != 0) {
- tags.add(buildTag((short) 0, SVlan.class, iface.vtrTag1));
- }
- if (iface.vtrTag2 != 0) {
- tags.add(buildTag((short) 1, CVlan.class, iface.vtrTag2));
- }
- if (tags.size() > 0) {
- builder.setPushTags(tags);
- }
- }
-
- private PushTags buildTag(final short index, final Class<? extends Dot1qTagVlanType> tagType, final int vlanId) {
- final PushTagsBuilder tag = new PushTagsBuilder();
- tag.setIndex(index);
- tag.setKey(new PushTagsKey(index));
- final Dot1qTagBuilder dtag = new Dot1qTagBuilder();
- dtag.setTagType(tagType);
- dtag.setVlanId(new Dot1qVlanId(vlanId));
- tag.setDot1qTag(dtag.build());
- return tag.build();
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizer.java
deleted file mode 100644
index a2efa8c9f..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizer.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static com.google.common.base.Preconditions.checkState;
-
-import com.google.common.base.Preconditions;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.CompletableFuture;
-import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.CVlan;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.Dot1qTagVlanType;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.Dot1qVlanId;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.SVlan;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.or.any.Dot1qTag;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.or.any.Dot1qTagBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubInterfaceStatus;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.SubInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.SubInterfacesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterfaceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.match.attributes.match.type.DefaultBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.match.attributes.match.type.UntaggedBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.match.attributes.match.type.vlan.tagged.VlanTaggedBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Match;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Tags;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.TagsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.tags.Tag;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.tags.TagBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.tags.TagKey;
-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;
-
-/**
- * Customizer for reading sub interfaces form the VPP.
- */
-public class SubInterfaceCustomizer extends FutureJVppCustomizer
- implements InitializingListReaderCustomizer<SubInterface, SubInterfaceKey, SubInterfaceBuilder>, ByteDataTranslator,
- InterfaceDataTranslator {
-
- private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceCustomizer.class);
- private static final Dot1qTag.VlanId ANY_VLAN_ID = new Dot1qTag.VlanId(Dot1qTag.VlanId.Enumeration.Any);
- private NamingContext interfaceContext;
-
- public SubInterfaceCustomizer(@Nonnull final FutureJVppCore jvpp,
- @Nonnull final NamingContext interfaceContext) {
- super(jvpp);
- this.interfaceContext = Preconditions.checkNotNull(interfaceContext, "interfaceContext should not be null");
- }
-
- private static String getSubInterfaceName(final InstanceIdentifier<SubInterface> id) {
- return SubInterfaceUtils.getSubInterfaceName(id.firstKeyOf(Interface.class).getName(),
- Math.toIntExact(id.firstKeyOf(id.getTargetType()).getIdentifier()));
- }
-
- private static Tag buildTag(final short index, final Class<? extends Dot1qTagVlanType> tagType,
- final Dot1qTag.VlanId vlanId) {
- TagBuilder tag = new TagBuilder();
- tag.setIndex(index);
- tag.setKey(new TagKey(index));
- final Dot1qTagBuilder dtag = new Dot1qTagBuilder();
- dtag.setTagType(tagType);
- dtag.setVlanId(vlanId);
- tag.setDot1qTag(dtag.build());
- return tag.build();
- }
-
- private static Dot1qTag.VlanId buildVlanId(final short vlanId) {
- // treat vlanId as unsigned value:
- return new Dot1qTag.VlanId(new Dot1qVlanId(0xffff & vlanId));
- }
-
- @Nonnull
- @Override
- public List<SubInterfaceKey> getAllIds(@Nonnull final InstanceIdentifier<SubInterface> id,
- @Nonnull final ReadContext context) throws ReadFailedException {
- // Relying here that parent InterfaceCustomizer was invoked first (PREORDER)
- // to fill in the context with initial ifc mapping
- final InterfaceKey key = id.firstKeyOf(Interface.class);
- final String ifaceName = key.getName();
- final int ifaceId = interfaceContext.getIndex(ifaceName, context.getMappingContext());
-
- // TODO HONEYCOMB-189 if we know that full dump was already performed we could use cache
- // (checking if getCachedInterfaceDump() returns non empty map is not enough, because
- // we could be part of particular iface state read
- final SwInterfaceDump request = new SwInterfaceDump();
- request.nameFilter = "".getBytes();
- request.nameFilterValid = 0;
-
- final CompletableFuture<SwInterfaceDetailsReplyDump> swInterfaceDetailsReplyDumpCompletableFuture =
- getFutureJVpp().swInterfaceDump(request).toCompletableFuture();
- final SwInterfaceDetailsReplyDump ifaces =
- getReplyForRead(swInterfaceDetailsReplyDumpCompletableFuture, id);
-
- if (null == ifaces || null == ifaces.swInterfaceDetails) {
- LOG.warn("Looking for sub-interfaces, but no interfaces found in VPP");
- return Collections.emptyList();
- }
-
- // Cache interfaces dump in per-tx context to later be used in readCurrentAttributes
- context.getModificationCache()
- .put(InterfaceCustomizer.DUMPED_IFCS_CONTEXT_KEY, ifaces.swInterfaceDetails.stream()
- .collect(Collectors.toMap(t -> t.swIfIndex, swInterfaceDetails -> swInterfaceDetails)));
-
- final List<SubInterfaceKey> interfacesKeys = ifaces.swInterfaceDetails.stream()
- .filter(elt -> elt != null)
- // accept only sub-interfaces for current iface:
- .filter(elt -> elt.subId != 0 && elt.supSwIfIndex == ifaceId)
- .map(details -> new SubInterfaceKey(new Long(details.subId)))
- .collect(Collectors.toList());
-
- LOG.debug("Sub-interfaces of {} found in VPP: {}", ifaceName, interfacesKeys);
- return interfacesKeys;
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder,
- @Nonnull final List<SubInterface> readData) {
- ((SubInterfacesBuilder) builder).setSubInterface(readData);
- }
-
- @Nonnull
- @Override
- public SubInterfaceBuilder getBuilder(@Nonnull final InstanceIdentifier<SubInterface> id) {
- return new SubInterfaceBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<SubInterface> id,
- @Nonnull final SubInterfaceBuilder builder, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
- final String subInterfaceName = getSubInterfaceName(id);
- LOG.debug("Reading attributes for sub interface: {}", subInterfaceName);
-
- final SwInterfaceDetails iface = getVppInterfaceDetails(getFutureJVpp(), id, subInterfaceName,
- interfaceContext.getIndex(subInterfaceName, ctx.getMappingContext()), ctx.getModificationCache(), LOG);
- LOG.debug("VPP sub-interface details: {}", iface);
-
- checkState(iface.subId != 0, "Interface returned by the VPP is not a sub-interface");
-
- builder.setIdentifier(Long.valueOf(iface.subId));
- builder.setKey(new SubInterfaceKey(builder.getIdentifier()));
-
- // sub-interface-base-attributes:
- builder.setTags(readTags(iface));
- builder.setMatch(readMatch(iface));
-
- // sub-interface-operational-attributes:
- builder.setAdminStatus(1 == iface.adminUpDown
- ? SubInterfaceStatus.Up
- : SubInterfaceStatus.Down);
- builder.setOperStatus(1 == iface.linkUpDown
- ? SubInterfaceStatus.Up
- : SubInterfaceStatus.Down);
- builder.setIfIndex(vppIfIndexToYang(iface.swIfIndex));
- if (iface.l2AddressLength == 6) {
- builder.setPhysAddress(new PhysAddress(vppPhysAddrToYang(iface.l2Address)));
- }
- if (0 != iface.linkSpeed) {
- builder.setSpeed(vppInterfaceSpeedToYang(iface.linkSpeed));
- }
- }
-
- private Tags readTags(final SwInterfaceDetails iface) {
- final TagsBuilder tags = new TagsBuilder();
- final List<Tag> list = new ArrayList<>();
- if (iface.subNumberOfTags > 0) {
- if (iface.subOuterVlanIdAny == 1) {
- list.add(buildTag((short) 0, SVlan.class, ANY_VLAN_ID));
- } else {
- list.add(buildTag((short) 0, SVlan.class, buildVlanId(iface.subOuterVlanId)));
- }
- // inner tag (customer tag):
- if (iface.subNumberOfTags == 2) {
- if (iface.subInnerVlanIdAny == 1) {
- list.add(buildTag((short) 1, CVlan.class, ANY_VLAN_ID));
- } else {
- list.add(buildTag((short) 1, CVlan.class, buildVlanId(iface.subInnerVlanId)));
- }
- }
- }
- tags.setTag(list);
- return tags.build();
- }
-
- private Match readMatch(final SwInterfaceDetails iface) {
- final MatchBuilder match = new MatchBuilder();
- if (iface.subDefault == 1) {
- match.setMatchType(new DefaultBuilder().build());
- } else if (iface.subNumberOfTags == 0) {
- match.setMatchType(new UntaggedBuilder().build());
- } else {
- final VlanTaggedBuilder tagged = new VlanTaggedBuilder();
- tagged.setMatchExactTags(byteToBoolean(iface.subExactMatch));
- match.setMatchType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.match.attributes.match.type.VlanTaggedBuilder()
- .setVlanTagged(tagged.build()).build());
- }
- return match.build();
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface> init(
- @Nonnull final InstanceIdentifier<SubInterface> id, @Nonnull final SubInterface readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id),
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterfaceBuilder()
- .setEnabled(SubInterfaceStatus.Up.equals(readValue.getAdminStatus()))
- .setIdentifier(readValue.getIdentifier())
- .setMatch(readValue.getMatch())
- .setTags(readValue.getTags())
- .setVlanType(readValue.getVlanType())
- .build());
- }
-
- public static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface> getCfgId(
- final InstanceIdentifier<SubInterface> id) {
- return InterfaceCustomizer.getCfgId(RWUtils.cutId(id, Interface.class))
- .augmentation(SubinterfaceAugmentation.class)
- .child(SubInterfaces.class)
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface.class,
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterfaceKey(
- id.firstKeyOf(SubInterface.class).getIdentifier()));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceL2Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceL2Customizer.java
deleted file mode 100644
index c686d1880..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceL2Customizer.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils.getSubInterfaceName;
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-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.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterfaceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.L2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.L2Builder;
-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;
-
-/**
- * Customizer for reading vlan sub interface L2 operational state
- */
-public class SubInterfaceL2Customizer extends FutureJVppCustomizer
- implements InitializingReaderCustomizer<L2, L2Builder> {
-
- private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceL2Customizer.class);
- private final InterconnectionReadUtils icReadUtils;
-
- public SubInterfaceL2Customizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext bridgeDomainContext) {
- super(futureJVppCore);
- this.icReadUtils = new InterconnectionReadUtils(futureJVppCore, interfaceContext, bridgeDomainContext);
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final L2 readValue) {
- ((SubInterfaceBuilder) parentBuilder).setL2(readValue);
- }
-
- @Nonnull
- @Override
- public L2Builder getBuilder(@Nonnull final InstanceIdentifier<L2> id) {
- return new L2Builder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<L2> id, @Nonnull final L2Builder builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- LOG.debug("Reading attributes for sub-interface L2: {}", id);
- final InterfaceKey parentInterfacekey = id.firstKeyOf(Interface.class);
- final SubInterfaceKey subInterfacekey = id.firstKeyOf(SubInterface.class);
- final String subInterfaceName = getSubInterfaceName(parentInterfacekey.getName(), subInterfacekey.getIdentifier().intValue());
-
- builder.setInterconnection(icReadUtils.readInterconnection(id, subInterfaceName, ctx));
- }
-
- @Override
- public Initialized<L2> init(
- @Nonnull final InstanceIdentifier<L2> id,
- @Nonnull final L2 readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id), readValue);
- }
-
- static InstanceIdentifier<L2> getCfgId(final InstanceIdentifier<L2> id) {
- return SubInterfaceCustomizer.getCfgId(RWUtils.cutId(id, SubInterface.class))
- .child(L2.class);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/TapCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/TapCustomizer.java
deleted file mode 100644
index 2c1bdcd43..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/TapCustomizer.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer;
-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.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceTapDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceTapDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceTapDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CompletionStage;
-import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Tap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.TapBuilder;
-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 TapCustomizer extends FutureJVppCustomizer
- implements InitializingReaderCustomizer<Tap, TapBuilder>, InterfaceDataTranslator, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(TapCustomizer.class);
- public static final String DUMPED_TAPS_CONTEXT_KEY = TapCustomizer.class.getName() + "dumpedTapsDuringGetAllIds";
- private NamingContext interfaceContext;
-
- public TapCustomizer(@Nonnull final FutureJVppCore jvpp, @Nonnull final NamingContext interfaceContext) {
- super(jvpp);
- this.interfaceContext = interfaceContext;
- }
-
- @Override
- public void merge(@Nonnull Builder<? extends DataObject> parentBuilder, @Nonnull Tap readValue) {
- ((VppInterfaceStateAugmentationBuilder) parentBuilder).setTap(readValue);
- }
-
- @Nonnull
- @Override
- public TapBuilder getBuilder(@Nonnull InstanceIdentifier<Tap> id) {
- return new TapBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Tap> id,
- @Nonnull final TapBuilder builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
-
- final InterfaceKey key = id.firstKeyOf(Interface.class);
- final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext());
- if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.Tap.class, LOG)) {
- return;
- }
-
- LOG.debug("Reading attributes for tap interface: {}", key.getName());
-
- @SuppressWarnings("unchecked")
- Map<Integer, SwInterfaceTapDetails> mappedTaps =
- (Map<Integer, SwInterfaceTapDetails>) ctx.getModificationCache().get(DUMPED_TAPS_CONTEXT_KEY);
-
- if (mappedTaps == null) {
- // Full Tap dump has to be performed here, no filter or anything is here to help so at least we cache it
- final SwInterfaceTapDump request = new SwInterfaceTapDump();
- final CompletionStage<SwInterfaceTapDetailsReplyDump> swInterfaceTapDetailsReplyDumpCompletionStage =
- getFutureJVpp().swInterfaceTapDump(request);
- final SwInterfaceTapDetailsReplyDump reply =
- getReplyForRead(swInterfaceTapDetailsReplyDumpCompletionStage.toCompletableFuture(), id);
-
- if (null == reply || null == reply.swInterfaceTapDetails) {
- mappedTaps = Collections.emptyMap();
- } else {
- final List<SwInterfaceTapDetails> swInterfaceTapDetails = reply.swInterfaceTapDetails;
- // Cache interfaces dump in per-tx context to later be used in readCurrentAttributes
- mappedTaps = swInterfaceTapDetails.stream()
- .collect(Collectors.toMap(t -> t.swIfIndex, swInterfaceDetails -> swInterfaceDetails));
- }
-
- ctx.getModificationCache().put(DUMPED_TAPS_CONTEXT_KEY, mappedTaps);
- }
-
- final SwInterfaceTapDetails swInterfaceTapDetails = mappedTaps.get(index);
- LOG.trace("Tap interface: {} attributes returned from VPP: {}", key.getName(), swInterfaceTapDetails);
-
- builder.setTapName(toString(swInterfaceTapDetails.devName));
- LOG.debug("Tap interface: {}, id: {} attributes read as: {}", key.getName(), index, builder);
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Tap> init(
- @Nonnull final InstanceIdentifier<Tap> id, @Nonnull final Tap readValue, @Nonnull final ReadContext ctx) {
- // The MAC address is set from interface details, those details are retrieved from cache
- final InterfaceKey key = id.firstKeyOf(Interface.class);
- final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext());
- final SwInterfaceDetails ifcDetails =
- InterfaceCustomizer.getCachedInterfaceDump(ctx.getModificationCache()).get(index);
-
- return Initialized.create(getCfgId(id),
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.TapBuilder()
- .setMac(new PhysAddress(vppPhysAddrToYang(ifcDetails.l2Address)))
- .setTapName(readValue.getTapName())
-// tapBuilder.setDeviceInstance();
- .build());
- }
-
- private InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Tap> getCfgId(
- final InstanceIdentifier<Tap> id) {
- return InterfaceCustomizer.getCfgId(RWUtils.cutId(id, Interface.class))
- .augmentation(VppInterfaceAugmentation.class)
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Tap.class);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VhostUserCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VhostUserCustomizer.java
deleted file mode 100644
index a6d17cf2e..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VhostUserCustomizer.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer;
-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.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceVhostUserDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceVhostUserDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceVhostUserDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.math.BigInteger;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CompletionStage;
-import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VhostUserRole;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.VhostUser;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.VhostUserBuilder;
-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 VhostUserCustomizer extends FutureJVppCustomizer
- implements InitializingReaderCustomizer<VhostUser, VhostUserBuilder>, InterfaceDataTranslator, JvppReplyConsumer {
-
- public static final String DUMPED_VHOST_USERS_CONTEXT_KEY =
- VhostUserCustomizer.class.getName() + "dumpedVhostUsersDuringGetAllIds";
- private static final Logger LOG = LoggerFactory.getLogger(VhostUserCustomizer.class);
- private NamingContext interfaceContext;
-
- public VhostUserCustomizer(@Nonnull final FutureJVppCore jvpp, @Nonnull final NamingContext interfaceContext) {
- super(jvpp);
- this.interfaceContext = interfaceContext;
- }
-
- @Override
- public void merge(@Nonnull Builder<? extends DataObject> parentBuilder, @Nonnull VhostUser readValue) {
- ((VppInterfaceStateAugmentationBuilder) parentBuilder).setVhostUser(readValue);
- }
-
- @Nonnull
- @Override
- public VhostUserBuilder getBuilder(@Nonnull InstanceIdentifier<VhostUser> id) {
- return new VhostUserBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<VhostUser> id,
- @Nonnull final VhostUserBuilder builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
-
- final InterfaceKey key = id.firstKeyOf(Interface.class);
- final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext());
- if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VhostUser.class,
- LOG)) {
- return;
- }
-
- LOG.debug("Reading attributes for vhpost user interface: {}", key.getName());
-
- @SuppressWarnings("unchecked")
- Map<Integer, SwInterfaceVhostUserDetails> mappedVhostUsers =
- (Map<Integer, SwInterfaceVhostUserDetails>) ctx.getModificationCache()
- .get(DUMPED_VHOST_USERS_CONTEXT_KEY);
-
- if (mappedVhostUsers == null) {
- // Full VhostUser dump has to be performed here, no filter or anything is here to help so at least we cache it
- final SwInterfaceVhostUserDump request = new SwInterfaceVhostUserDump();
- final CompletionStage<SwInterfaceVhostUserDetailsReplyDump>
- swInterfaceVhostUserDetailsReplyDumpCompletionStage =
- getFutureJVpp().swInterfaceVhostUserDump(request);
- final SwInterfaceVhostUserDetailsReplyDump reply =
- getReplyForRead(swInterfaceVhostUserDetailsReplyDumpCompletionStage.toCompletableFuture(), id);
-
- if (null == reply || null == reply.swInterfaceVhostUserDetails) {
- mappedVhostUsers = Collections.emptyMap();
- } else {
- final List<SwInterfaceVhostUserDetails> swInterfaceVhostUserDetails =
- reply.swInterfaceVhostUserDetails;
- // Cache interfaces dump in per-tx context to later be used in readCurrentAttributes
- mappedVhostUsers = swInterfaceVhostUserDetails.stream()
- .collect(Collectors.toMap(t -> t.swIfIndex, swInterfaceDetails -> swInterfaceDetails));
- }
-
- ctx.getModificationCache().put(DUMPED_VHOST_USERS_CONTEXT_KEY, mappedVhostUsers);
- }
-
- // Relying here that parent InterfaceCustomizer was invoked first to fill in the context with initial ifc mapping
- final SwInterfaceVhostUserDetails swInterfaceVhostUserDetails = mappedVhostUsers.get(index);
- LOG.trace("Vhost user interface: {} attributes returned from VPP: {}", key.getName(),
- swInterfaceVhostUserDetails);
-
- builder.setRole(swInterfaceVhostUserDetails.isServer == 1
- ? VhostUserRole.Server
- : VhostUserRole.Client);
- builder.setFeatures(BigInteger.valueOf(swInterfaceVhostUserDetails.features));
- builder.setNumMemoryRegions((long) swInterfaceVhostUserDetails.numRegions);
- builder.setSocket(toString(swInterfaceVhostUserDetails.sockFilename));
- builder.setVirtioNetHdrSize((long) swInterfaceVhostUserDetails.virtioNetHdrSz);
- // TODO: map error code to meaningful message after VPP-436 is done
- builder.setConnectError(Integer.toString(swInterfaceVhostUserDetails.sockErrno));
-
- LOG.debug("Vhost user interface: {}, id: {} attributes read as: {}", key.getName(), index, builder);
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VhostUser> init(
- @Nonnull final InstanceIdentifier<VhostUser> id,
- @Nonnull final VhostUser readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id),
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VhostUserBuilder()
- .setRole(readValue.getRole())
- .setSocket(readValue.getSocket())
- .build());
- }
-
- private InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VhostUser> getCfgId(
- final InstanceIdentifier<VhostUser> id) {
- return InterfaceCustomizer.getCfgId(RWUtils.cutId(id, Interface.class))
- .augmentation(VppInterfaceAugmentation.class)
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VhostUser.class);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanCustomizer.java
deleted file mode 100644
index 1a1220435..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanCustomizer.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static com.google.common.base.Preconditions.checkState;
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer;
-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.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.core.dto.VxlanTunnelDetails;
-import io.fd.vpp.jvpp.core.dto.VxlanTunnelDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.VxlanTunnelDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Arrays;
-import java.util.concurrent.CompletionStage;
-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.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VxlanTunnel;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VxlanVni;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Vxlan;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.VxlanBuilder;
-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 VxlanCustomizer extends FutureJVppCustomizer
- implements InitializingReaderCustomizer<Vxlan, VxlanBuilder>, InterfaceDataTranslator, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(VxlanCustomizer.class);
- private final NamingContext interfaceContext;
-
- public VxlanCustomizer(@Nonnull final FutureJVppCore jvpp, @Nonnull final NamingContext interfaceContext) {
- super(jvpp);
- this.interfaceContext = interfaceContext;
- }
-
- @Override
- public void merge(@Nonnull Builder<? extends DataObject> parentBuilder,
- @Nonnull Vxlan readValue) {
- ((VppInterfaceStateAugmentationBuilder) parentBuilder).setVxlan(readValue);
- }
-
- @Nonnull
- @Override
- public VxlanBuilder getBuilder(@Nonnull InstanceIdentifier<Vxlan> id) {
- return new VxlanBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Vxlan> id,
- @Nonnull final VxlanBuilder builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
-
- final InterfaceKey key = id.firstKeyOf(Interface.class);
- final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext());
- if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index, VxlanTunnel.class, LOG)) {
- return;
- }
-
- LOG.debug("Reading attributes for vxlan tunnel: {}", key.getName());
- // Dump just a single
- final VxlanTunnelDump request = new VxlanTunnelDump();
- request.swIfIndex = index;
-
- final CompletionStage<VxlanTunnelDetailsReplyDump> swInterfaceVxlanDetailsReplyDumpCompletionStage =
- getFutureJVpp().vxlanTunnelDump(request);
- final VxlanTunnelDetailsReplyDump reply =
- getReplyForRead(swInterfaceVxlanDetailsReplyDumpCompletionStage.toCompletableFuture(), id);
-
- // VPP keeps vxlan tunnel interfaces even after they were deleted (optimization)
- // However there ar no longer any vxlan tunnel specific fields assigned to it and this call
- // returns nothing
- if (reply == null || reply.vxlanTunnelDetails == null || reply.vxlanTunnelDetails.isEmpty()) {
- LOG.debug(
- "Vxlan tunnel {}, id {} has no attributes assigned in VPP. Probably is a leftover interface placeholder" +
- "after delete", key.getName(), index);
- return;
- }
-
- checkState(reply.vxlanTunnelDetails.size() == 1,
- "Unexpected number of returned vxlan tunnels: {} for tunnel: {}", reply.vxlanTunnelDetails,
- key.getName());
- LOG.trace("Vxlan tunnel: {} attributes returned from VPP: {}", key.getName(), reply);
-
- final VxlanTunnelDetails swInterfaceVxlanDetails = reply.vxlanTunnelDetails.get(0);
- if (swInterfaceVxlanDetails.isIpv6 == 1) {
- final Ipv6Address dstIpv6 =
- new Ipv6Address(parseAddress(swInterfaceVxlanDetails.dstAddress).getHostAddress());
- builder.setDst(new IpAddress(dstIpv6));
- final Ipv6Address srcIpv6 =
- new Ipv6Address(parseAddress(swInterfaceVxlanDetails.srcAddress).getHostAddress());
- builder.setSrc(new IpAddress(srcIpv6));
- } else {
- final byte[] dstBytes = Arrays.copyOfRange(swInterfaceVxlanDetails.dstAddress, 0, 4);
- final Ipv4Address dstIpv4 = new Ipv4Address(parseAddress(dstBytes).getHostAddress());
- builder.setDst(new IpAddress(dstIpv4));
- final byte[] srcBytes = Arrays.copyOfRange(swInterfaceVxlanDetails.srcAddress, 0, 4);
- final Ipv4Address srcIpv4 = new Ipv4Address(parseAddress(srcBytes).getHostAddress());
- builder.setSrc(new IpAddress(srcIpv4));
- }
- builder.setEncapVrfId((long) swInterfaceVxlanDetails.encapVrfId);
- builder.setVni(new VxlanVni((long) swInterfaceVxlanDetails.vni));
- LOG.debug("Vxlan tunnel: {}, id: {} attributes read as: {}", key.getName(), index, builder);
- }
-
- @Nonnull
- private static InetAddress parseAddress(@Nonnull final byte[] addr) {
- try {
- return InetAddress.getByAddress(addr);
- } catch (UnknownHostException e) {
- throw new IllegalArgumentException("Cannot create InetAddress from " + Arrays.toString(addr), e);
- }
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Vxlan> init(
- @Nonnull final InstanceIdentifier<Vxlan> id, @Nonnull final Vxlan readValue, @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id),
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VxlanBuilder()
- .setDst(readValue.getDst())
- .setSrc(readValue.getSrc())
- .setEncapVrfId(readValue.getEncapVrfId())
- .setVni(new VxlanVni(readValue.getVni()))
- .build());
- }
-
- private InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Vxlan> getCfgId(
- final InstanceIdentifier<Vxlan> id) {
- return InterfaceCustomizer.getCfgId(RWUtils.cutId(id, Interface.class))
- .augmentation(VppInterfaceAugmentation.class)
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Vxlan.class);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanGpeCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanGpeCustomizer.java
deleted file mode 100644
index 278e23912..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanGpeCustomizer.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static com.google.common.base.Preconditions.checkState;
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer;
-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.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.core.dto.VxlanGpeTunnelDetails;
-import io.fd.vpp.jvpp.core.dto.VxlanGpeTunnelDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.VxlanGpeTunnelDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Arrays;
-import java.util.concurrent.CompletionStage;
-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.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VxlanGpeNextProtocol;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VxlanGpeTunnel;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VxlanGpeVni;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.VxlanGpe;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.VxlanGpeBuilder;
-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 VxlanGpeCustomizer extends FutureJVppCustomizer
- implements InitializingReaderCustomizer<VxlanGpe, VxlanGpeBuilder>, InterfaceDataTranslator, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(VxlanGpeCustomizer.class);
- private NamingContext interfaceContext;
-
- public VxlanGpeCustomizer(@Nonnull final FutureJVppCore jvpp, @Nonnull final NamingContext interfaceContext) {
- super(jvpp);
- this.interfaceContext = interfaceContext;
- }
-
- @Override
- public void merge(@Nonnull Builder<? extends DataObject> parentBuilder,
- @Nonnull VxlanGpe readValue) {
- ((VppInterfaceStateAugmentationBuilder) parentBuilder).setVxlanGpe(readValue);
- }
-
- @Nonnull
- @Override
- public VxlanGpeBuilder getBuilder(@Nonnull InstanceIdentifier<VxlanGpe> id) {
- return new VxlanGpeBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<VxlanGpe> id,
- @Nonnull final VxlanGpeBuilder builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
-
- final InterfaceKey key = id.firstKeyOf(Interface.class);
- final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext());
- if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index, VxlanGpeTunnel.class, LOG)) {
- return;
- }
-
- LOG.debug("Reading attributes for VxlanGpe tunnel: {}", key.getName());
- // Dump just a single
- final VxlanGpeTunnelDump request = new VxlanGpeTunnelDump();
- request.swIfIndex = index;
-
- final CompletionStage<VxlanGpeTunnelDetailsReplyDump> swInterfaceVxlanGpeDetailsReplyDumpCompletionStage =
- getFutureJVpp().vxlanGpeTunnelDump(request);
- final VxlanGpeTunnelDetailsReplyDump reply =
- getReplyForRead(swInterfaceVxlanGpeDetailsReplyDumpCompletionStage.toCompletableFuture(),
- id);
-
- // VPP keeps VxlanGpe tunnel interfaces even after they were deleted (optimization)
- // However there are no longer any VxlanGpe tunnel specific fields assigned to it and this call
- // returns nothing
- if (reply == null || reply.vxlanGpeTunnelDetails == null || reply.vxlanGpeTunnelDetails.isEmpty()) {
- LOG.debug(
- "VxlanGpe tunnel {}, id {} has no attributes assigned in VPP. Probably is a leftover interface placeholder" +
- "after delete", key.getName(), index);
- return;
- }
-
- checkState(reply.vxlanGpeTunnelDetails.size() == 1,
- "Unexpected number of returned VxlanGpe tunnels: {} for tunnel: {}", reply.vxlanGpeTunnelDetails,
- key.getName());
- LOG.trace("VxlanGpe tunnel: {} attributes returned from VPP: {}", key.getName(), reply);
-
- final VxlanGpeTunnelDetails swInterfaceVxlanGpeDetails = reply.vxlanGpeTunnelDetails.get(0);
- if (swInterfaceVxlanGpeDetails.isIpv6 == 1) {
- final Ipv6Address remote6 =
- new Ipv6Address(parseAddress(swInterfaceVxlanGpeDetails.remote).getHostAddress());
- builder.setRemote(new IpAddress(remote6));
- final Ipv6Address local6 =
- new Ipv6Address(parseAddress(swInterfaceVxlanGpeDetails.local).getHostAddress());
- builder.setLocal(new IpAddress(local6));
- } else {
- final byte[] dstBytes = Arrays.copyOfRange(swInterfaceVxlanGpeDetails.remote, 0, 4);
- final Ipv4Address remote4 = new Ipv4Address(parseAddress(dstBytes).getHostAddress());
- builder.setRemote(new IpAddress(remote4));
- final byte[] srcBytes = Arrays.copyOfRange(swInterfaceVxlanGpeDetails.local, 0, 4);
- final Ipv4Address local4 = new Ipv4Address(parseAddress(srcBytes).getHostAddress());
- builder.setLocal(new IpAddress(local4));
- }
- builder.setVni(new VxlanGpeVni((long) swInterfaceVxlanGpeDetails.vni));
- builder.setNextProtocol(VxlanGpeNextProtocol.forValue(swInterfaceVxlanGpeDetails.protocol));
- builder.setEncapVrfId((long) swInterfaceVxlanGpeDetails.encapVrfId);
- builder.setDecapVrfId((long) swInterfaceVxlanGpeDetails.decapVrfId);
- LOG.debug("VxlanGpe tunnel: {}, id: {} attributes read as: {}", key.getName(), index, builder);
- }
-
- @Nonnull
- private static InetAddress parseAddress(@Nonnull final byte[] addr) {
- try {
- return InetAddress.getByAddress(addr);
- } catch (UnknownHostException e) {
- throw new IllegalArgumentException("Cannot create InetAddress from " + Arrays.toString(addr), e);
- }
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VxlanGpe> init(
- @Nonnull final InstanceIdentifier<VxlanGpe> id, @Nonnull final VxlanGpe readValue, @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id),
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VxlanGpeBuilder()
- .setLocal(readValue.getLocal())
- .setRemote(readValue.getRemote())
- .setVni(new VxlanGpeVni(readValue.getVni()))
- .setNextProtocol(readValue.getNextProtocol())
- .setEncapVrfId(readValue.getEncapVrfId())
- .setDecapVrfId(readValue.getDecapVrfId())
- .build());
- }
-
- private InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VxlanGpe> getCfgId(
- final InstanceIdentifier<VxlanGpe> id) {
- return InterfaceCustomizer.getCfgId(RWUtils.cutId(id, Interface.class))
- .augmentation(VppInterfaceAugmentation.class)
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VxlanGpe.class);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/AclCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/AclCustomizer.java
deleted file mode 100644
index 6212f724a..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/AclCustomizer.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate.acl.ingress;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.v3po.interfacesstate.InterfaceCustomizer;
-import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableByInterface;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableByInterfaceReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.AclBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.acl.Ingress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.acl.IngressBuilder;
-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;
-
-/**
- * Customizer for reading ingress ACLs enabled on given interface.
- */
-public class AclCustomizer extends FutureJVppCustomizer
- implements InitializingReaderCustomizer<Ingress, IngressBuilder>, AclReader, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(AclCustomizer.class);
- private final NamingContext interfaceContext;
- private final VppClassifierContextManager classifyTableContext;
-
- public AclCustomizer(@Nonnull final FutureJVppCore jvpp, @Nonnull final NamingContext interfaceContext,
- @Nonnull final VppClassifierContextManager classifyTableContext) {
- super(jvpp);
- this.interfaceContext = checkNotNull(interfaceContext, "interfaceContext should not be null");
- this.classifyTableContext = checkNotNull(classifyTableContext, "classifyTableContext should not be null");
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final Ingress readValue) {
- ((AclBuilder) parentBuilder).setIngress(readValue);
- }
-
- @Nonnull
- @Override
- public IngressBuilder getBuilder(@Nonnull final InstanceIdentifier<Ingress> id) {
- return new IngressBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id,
- @Nonnull final IngressBuilder builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- LOG.debug("Reading attributes for interface ACL: {}", id);
- final InterfaceKey interfaceKey = id.firstKeyOf(Interface.class);
- checkArgument(interfaceKey != null, "No parent interface key found");
-
- final ClassifyTableByInterface request = new ClassifyTableByInterface();
- request.swIfIndex = interfaceContext.getIndex(interfaceKey.getName(), ctx.getMappingContext());
-
- final ClassifyTableByInterfaceReply reply =
- getReplyForRead(getFutureJVpp().classifyTableByInterface(request).toCompletableFuture(), id);
-
- builder.setL2Acl(readL2Acl(reply.l2TableId, classifyTableContext, ctx.getMappingContext()));
- builder.setIp4Acl(readIp4Acl(reply.ip4TableId, classifyTableContext, ctx.getMappingContext()));
- builder.setIp6Acl(readIp6Acl(reply.ip6TableId, classifyTableContext, ctx.getMappingContext()));
-
- if (LOG.isTraceEnabled()) {
- LOG.trace("Attributes for ACL {} successfully read: {}", id, builder.build());
- }
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.acl.Ingress> init(
- @Nonnull final InstanceIdentifier<Ingress> id, @Nonnull final Ingress readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id),
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.acl.IngressBuilder()
- .setL2Acl(readValue.getL2Acl())
- .setIp4Acl(readValue.getIp4Acl())
- .setIp6Acl(readValue.getIp6Acl())
- .build());
- }
-
- private InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.acl.Ingress> getCfgId(
- final InstanceIdentifier<Ingress> id) {
- return InterfaceCustomizer.getCfgId(RWUtils.cutId(id, Interface.class))
- .augmentation(VppInterfaceAugmentation.class)
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Acl.class)
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.acl.Ingress.class);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/AclReader.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/AclReader.java
deleted file mode 100644
index a905674e0..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/AclReader.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate.acl.ingress;
-
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip4Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip4AclBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip6Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip6AclBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.L2Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.L2AclBuilder;
-
-interface AclReader {
-
- @Nonnull
- default L2Acl readL2Acl(final int l2TableId, @Nonnull final VppClassifierContextManager classifyTableContext,
- @Nonnull final MappingContext mappingContext) {
- if (l2TableId == ~0) {
- return null;
- }
- return new L2AclBuilder()
- .setClassifyTable(classifyTableContext.getTableName(l2TableId, mappingContext)).build();
- }
-
- @Nonnull
- default Ip4Acl readIp4Acl(final int ip4TableId, @Nonnull final VppClassifierContextManager classifyTableContext,
- @Nonnull final MappingContext mappingContext) {
- if (ip4TableId == ~0) {
- return null;
- }
- return new Ip4AclBuilder()
- .setClassifyTable(classifyTableContext.getTableName(ip4TableId, mappingContext)).build();
- }
-
- @Nonnull
- default Ip6Acl readIp6Acl(final int ip6TableId, @Nonnull final VppClassifierContextManager classifyTableContext,
- @Nonnull final MappingContext mappingContext) {
- if (ip6TableId == ~0) {
- return null;
- }
- return new Ip6AclBuilder()
- .setClassifyTable(classifyTableContext.getTableName(ip6TableId, mappingContext)).build();
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/SubInterfaceAclCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/SubInterfaceAclCustomizer.java
deleted file mode 100644
index ad6303531..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/SubInterfaceAclCustomizer.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate.acl.ingress;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils.getSubInterfaceName;
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.v3po.interfacesstate.SubInterfaceCustomizer;
-import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableByInterface;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableByInterfaceReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.AclBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.acl.Ingress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.acl.IngressBuilder;
-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;
-
-/**
- * Customizer for reading ingress ACLs enabled on given sub-interface.
- */
-public class SubInterfaceAclCustomizer extends FutureJVppCustomizer
- implements InitializingReaderCustomizer<Ingress, IngressBuilder>, AclReader, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceAclCustomizer.class);
- private final NamingContext interfaceContext;
- private final VppClassifierContextManager classifyTableContext;
-
- public SubInterfaceAclCustomizer(@Nonnull final FutureJVppCore jvpp, @Nonnull final NamingContext interfaceContext,
- @Nonnull final VppClassifierContextManager classifyTableContext) {
- super(jvpp);
- this.interfaceContext = checkNotNull(interfaceContext, "interfaceContext should not be null");
- this.classifyTableContext = checkNotNull(classifyTableContext, "classifyTableContext should not be null");
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final Ingress readValue) {
- ((AclBuilder) parentBuilder).setIngress(readValue);
- }
-
- @Nonnull
- @Override
- public IngressBuilder getBuilder(@Nonnull final InstanceIdentifier<Ingress> id) {
- return new IngressBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id,
- @Nonnull final IngressBuilder builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- LOG.debug("Reading attributes for sub-interface ACL: {}", id);
- final InterfaceKey parentInterfacekey = id.firstKeyOf(Interface.class);
- checkArgument(parentInterfacekey != null, "No parent interface key found");
- final SubInterfaceKey subInterfacekey = id.firstKeyOf(SubInterface.class);
- checkArgument(subInterfacekey != null, "No sub-interface key found");
- final String subInterfaceName =
- getSubInterfaceName(parentInterfacekey.getName(), subInterfacekey.getIdentifier().intValue());
-
- final ClassifyTableByInterface request = new ClassifyTableByInterface();
- request.swIfIndex = interfaceContext.getIndex(subInterfaceName, ctx.getMappingContext());
-
- final ClassifyTableByInterfaceReply reply =
- getReplyForRead(getFutureJVpp().classifyTableByInterface(request).toCompletableFuture(), id);
-
- builder.setL2Acl(readL2Acl(reply.l2TableId, classifyTableContext, ctx.getMappingContext()));
- builder.setIp4Acl(readIp4Acl(reply.ip4TableId, classifyTableContext, ctx.getMappingContext()));
- builder.setIp6Acl(readIp6Acl(reply.ip6TableId, classifyTableContext, ctx.getMappingContext()));
-
- if (LOG.isTraceEnabled()) {
- LOG.trace("Attributes for ACL {} successfully read: {}", id, builder.build());
- }
- }
-
- @Override
- public Initialized<Ingress> init(
- @Nonnull final InstanceIdentifier<Ingress> id,
- @Nonnull final Ingress readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id), readValue);
- }
-
- static InstanceIdentifier<Ingress> getCfgId(
- final InstanceIdentifier<Ingress> id) {
- return SubInterfaceCustomizer.getCfgId(RWUtils.cutId(id, SubInterface.class))
- .child(Acl.class)
- .child(Ingress.class);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4AddressCustomizer.java
deleted file mode 100644
index fb09e3a2e..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4AddressCustomizer.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate.ip;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.base.Preconditions;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.util.read.cache.IdentifierCacheKeyFactory;
-import io.fd.honeycomb.translate.v3po.interfacesstate.InterfaceCustomizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.ip.dump.params.AddressDumpParams;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetails;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.List;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface1;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.Subnet;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.AddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.AddressKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.address.subnet.PrefixLengthBuilder;
-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;
-
-/**
- * Read customizer for interface Ipv4 addresses.
- */
-public class Ipv4AddressCustomizer extends FutureJVppCustomizer
- implements InitializingListReaderCustomizer<Address, AddressKey, AddressBuilder>, Ipv4Reader {
-
- private static final Logger LOG = LoggerFactory.getLogger(Ipv4AddressCustomizer.class);
- private static final String CACHE_KEY = Ipv4AddressCustomizer.class.getName();
-
- private final NamingContext interfaceContext;
- private final DumpCacheManager<IpAddressDetailsReplyDump, AddressDumpParams> dumpManager;
-
- public Ipv4AddressCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext) {
- super(futureJVppCore);
- this.interfaceContext = checkNotNull(interfaceContext, "interfaceContext should not be null");
- this.dumpManager =
- new DumpCacheManager.DumpCacheManagerBuilder<IpAddressDetailsReplyDump, AddressDumpParams>()
- .withExecutor(createExecutor(futureJVppCore))
- // Key needs to contain interface ID to distinguish dumps between interfaces
- .withCacheKeyFactory(new IdentifierCacheKeyFactory(ImmutableSet.of(Interface.class)))
- .build();
- }
-
- @Override
- @Nonnull
- public AddressBuilder getBuilder(@Nonnull InstanceIdentifier<Address> id) {
- return new AddressBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull InstanceIdentifier<Address> id, @Nonnull AddressBuilder builder,
- @Nonnull ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading attributes for interface address: {}", id);
-
- final String interfaceName = id.firstKeyOf(Interface.class).getName();
- final int interfaceIndex = interfaceContext.getIndex(interfaceName, ctx.getMappingContext());
- final Optional<IpAddressDetailsReplyDump> dumpOptional =
- dumpManager.getDump(id, ctx.getModificationCache(), new AddressDumpParams(interfaceIndex, false));
-
- if (!dumpOptional.isPresent() || dumpOptional.get().ipAddressDetails.isEmpty()) {
- return;
- }
- final Optional<IpAddressDetails> ipAddressDetails =
- findIpAddressDetailsByIp(dumpOptional, id.firstKeyOf(Address.class).getIp());
-
- if (ipAddressDetails.isPresent()) {
- final IpAddressDetails detail = ipAddressDetails.get();
- builder.setIp(arrayToIpv4AddressNoZone(detail.ip))
- .setSubnet(
- new PrefixLengthBuilder().setPrefixLength(Short.valueOf(detail.prefixLength)).build());
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Attributes for {} interface (id={}) address {} successfully read: {}",
- interfaceName, interfaceIndex, id, builder.build());
- }
- }
- }
-
- @Override
- public List<AddressKey> getAllIds(@Nonnull InstanceIdentifier<Address> id, @Nonnull ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading list of keys for interface addresses: {}", id);
-
- final String interfaceName = id.firstKeyOf(Interface.class).getName();
- final int interfaceIndex = interfaceContext.getIndex(interfaceName, ctx.getMappingContext());
- final Optional<IpAddressDetailsReplyDump> dumpOptional =
- dumpManager.getDump(id, ctx.getModificationCache(), new AddressDumpParams(interfaceIndex, false));
-
- return getAllIpv4AddressIds(dumpOptional, AddressKey::new);
- }
-
- @Override
- public void merge(@Nonnull Builder<? extends DataObject> builder, @Nonnull List<Address> readData) {
- ((Ipv4Builder) builder).setAddress(readData);
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address> init(
- @Nonnull final InstanceIdentifier<Address> id, @Nonnull final Address readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id),
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.AddressBuilder()
- .setIp(readValue.getIp())
- .setSubnet(getSubnet(readValue))
- .build());
- }
-
- private static Subnet getSubnet(final Address address) {
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.address.Subnet
- subnet = address.getSubnet();
-
- // Only prefix length supported
- Preconditions.checkArgument(
- subnet instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.address.subnet.PrefixLength);
-
- return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.subnet.PrefixLengthBuilder()
- .setPrefixLength(
- ((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.address.subnet.PrefixLength) subnet)
- .getPrefixLength()).build();
- }
-
- static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address> getCfgId(
- final InstanceIdentifier<Address> id) {
- return InterfaceCustomizer.getCfgId(RWUtils.cutId(id, Interface.class))
- .augmentation(Interface1.class)
- .child(Ipv4.class)
- .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address.class,
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.AddressKey(id.firstKeyOf(Address.class).getIp()));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4Customizer.java
deleted file mode 100644
index 4c4803fd9..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4Customizer.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate.ip;
-
-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.vpp.util.FutureJVppCustomizer;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4Builder;
-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.future.FutureJVppCore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Ipv4Customizer extends FutureJVppCustomizer implements ReaderCustomizer<Ipv4, Ipv4Builder> {
-
- private static final Logger LOG = LoggerFactory.getLogger(Ipv4Customizer.class);
-
- public Ipv4Customizer(@Nonnull final FutureJVppCore futureJVppCore) {
- super(futureJVppCore);
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final Ipv4 readValue) {
- ((Interface2Builder) parentBuilder).setIpv4(readValue);
- }
-
- @Nonnull
- @Override
- public Ipv4Builder getBuilder(@Nonnull final InstanceIdentifier<Ipv4> id) {
- return new Ipv4Builder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv4> id, @Nonnull final Ipv4Builder builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- LOG.debug("Reading Ipv4 leaves (mtu, forwarding) is not supported by VPP API");
- }
-
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4NeighbourCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4NeighbourCustomizer.java
deleted file mode 100644
index afc22591d..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4NeighbourCustomizer.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate.ip;
-
-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.vpp.util.FutureJVppCustomizer;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.Collections;
-import java.util.List;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Neighbor;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.NeighborBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.NeighborKey;
-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;
-
-/**
- * Operational data read operation customizer for {@link Neighbor}<br>
- * Currently not supported in jvpp, so this is only dummy implementation<br>
- */
-public class Ipv4NeighbourCustomizer extends FutureJVppCustomizer
- implements ListReaderCustomizer<Neighbor, NeighborKey, NeighborBuilder> {
-
- private static final Logger LOG = LoggerFactory.getLogger(Ipv4NeighbourCustomizer.class);
-
- public Ipv4NeighbourCustomizer(FutureJVppCore futureJVppCore) {
- super(futureJVppCore);
- }
-
- @Override
- public NeighborBuilder getBuilder(InstanceIdentifier<Neighbor> id) {
- return new NeighborBuilder();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<Neighbor> id, NeighborBuilder builder, ReadContext ctx)
- throws ReadFailedException {
- //TODO - not supported, implement https://jira.fd.io/browse/VPP-164 first + implement init
- LOG.warn("Operation not supported");
- }
-
- @Override
- public List<NeighborKey> getAllIds(InstanceIdentifier<Neighbor> id, ReadContext context)
- throws ReadFailedException {
- //TODO - not supported, implement https://jira.fd.io/browse/VPP-164 first
- LOG.warn("Operation not supported,returning empty List");
- return Collections.emptyList();
- }
-
- @Override
- public void merge(Builder<? extends DataObject> builder, List<Neighbor> readData) {
- ((Ipv4Builder) builder).setNeighbor(readData);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4Reader.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4Reader.java
deleted file mode 100644
index a5d13bb98..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4Reader.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate.ip;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.v3po.interfacesstate.ip.dump.params.AddressDumpParams;
-import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.IpAddressDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.Collections;
-import java.util.List;
-import java.util.function.Function;
-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.Ipv4AddressNoZone;
-import org.opendaylight.yangtools.yang.binding.Identifier;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetails;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetailsReplyDump;
-
-/**
- * Utility class providing Ipv4 read support.
- */
-interface Ipv4Reader extends Ipv4Translator, JvppReplyConsumer {
-
- @Nonnull
- default <T extends Identifier> List<T> getAllIpv4AddressIds(
- final Optional<IpAddressDetailsReplyDump> dumpOptional,
- @Nonnull final Function<Ipv4AddressNoZone, T> keyConstructor) {
- if (dumpOptional.isPresent() && dumpOptional.get().ipAddressDetails != null) {
- return dumpOptional.get().ipAddressDetails.stream()
- .map(detail -> keyConstructor.apply(arrayToIpv4AddressNoZone(detail.ip)))
- .collect(Collectors.toList());
- } else {
- return Collections.emptyList();
- }
- }
-
- default Optional<IpAddressDetails> findIpAddressDetailsByIp(
- final Optional<IpAddressDetailsReplyDump> dump,
- @Nonnull final Ipv4AddressNoZone ip) {
- checkNotNull(ip, "ip address should not be null");
-
- if (dump.isPresent() && dump.get().ipAddressDetails != null) {
- final List<IpAddressDetails> details = dump.get().ipAddressDetails;
-
- return Optional.of(details.stream()
- .filter(singleDetail -> ip.equals(arrayToIpv4AddressNoZone(singleDetail.ip)))
- .collect(RWUtils.singleItemCollector()));
- }
- return Optional.absent();
- }
-
- default EntityDumpExecutor<IpAddressDetailsReplyDump, AddressDumpParams> createExecutor(
- @Nonnull final FutureJVppCore vppApi) {
- return (identifier, params) -> {
- checkNotNull(params, "Address dump params cannot be null");
-
- final IpAddressDump dumpRequest = new IpAddressDump();
- dumpRequest.isIpv6 = booleanToByte(params.isIpv6());
- dumpRequest.swIfIndex = params.getInterfaceIndex();
-
- return getReplyForRead(vppApi.ipAddressDump(dumpRequest).toCompletableFuture(), identifier);
- };
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv6Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv6Customizer.java
deleted file mode 100644
index a2e7bcc10..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv6Customizer.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate.ip;
-
-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.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv6;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv6Builder;
-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.future.FutureJVppCore;
-
-public class Ipv6Customizer extends FutureJVppCustomizer implements ReaderCustomizer<Ipv6, Ipv6Builder> {
-
- private final NamingContext interfaceContext;
-
- public Ipv6Customizer(@Nonnull final FutureJVppCore futureJVppCore, final NamingContext interfaceContext) {
- super(futureJVppCore);
- this.interfaceContext = interfaceContext;
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final Ipv6 readValue) {
- ((Interface2Builder) parentBuilder).setIpv6(readValue);
- }
-
- @Nonnull
- @Override
- public Ipv6Builder getBuilder(@Nonnull final InstanceIdentifier<Ipv6> id) {
- return new Ipv6Builder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv6> id, @Nonnull final Ipv6Builder builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- // TODO HONEYCOMB-102 implement + init
-// final IpAddressDump dumpRequest = new IpAddressDump();
-// dumpRequest.isIpv6 = 1;
-// dumpRequest.swIfIndex = interfaceContext.getIndex(id.firstKeyOf(Interface.class).getName(),
-// ctx.getMappingContext());
-// final CompletionStage<IpAddressDetailsReplyDump> addressDumpFuture = getFutureJVpp().
-// ipAddressDump(dumpRequest);
-// final IpAddressDetailsReplyDump reply = TranslateUtils.getReply(addressDumpFuture.toCompletableFuture());
- }
-
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizer.java
deleted file mode 100644
index e18de5581..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizer.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate.ip;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableSet;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.util.read.cache.IdentifierCacheKeyFactory;
-import io.fd.honeycomb.translate.v3po.interfacesstate.SubInterfaceCustomizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.ip.dump.params.AddressDumpParams;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetails;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.List;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.AddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.AddressKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.address.subnet.PrefixLengthBuilder;
-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;
-
-/**
- * Read customizer for sub-interface Ipv4 addresses.
- */
-public class SubInterfaceIpv4AddressCustomizer extends FutureJVppCustomizer
- implements InitializingListReaderCustomizer<Address, AddressKey, AddressBuilder>, Ipv4Reader {
-
- private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceIpv4AddressCustomizer.class);
-
- private final NamingContext interfaceContext;
- private final DumpCacheManager<IpAddressDetailsReplyDump, AddressDumpParams> dumpManager;
-
- public SubInterfaceIpv4AddressCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext) {
- super(futureJVppCore);
- this.interfaceContext = checkNotNull(interfaceContext, "interfaceContext should not be null");
- this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder<IpAddressDetailsReplyDump, AddressDumpParams>()
- .withExecutor(createExecutor(futureJVppCore))
- //same as with ipv4 addresses for interfaces, these must have cache scope of their parent sub-interface
- .withCacheKeyFactory(new IdentifierCacheKeyFactory(ImmutableSet.of(SubInterface.class)))
- .build();
- }
-
- @Override
- @Nonnull
- public AddressBuilder getBuilder(@Nonnull InstanceIdentifier<Address> id) {
- return new AddressBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull InstanceIdentifier<Address> id, @Nonnull AddressBuilder builder,
- @Nonnull ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading attributes for sub-interface address: {}", id);
-
- final String subInterfaceName = getSubInterfaceName(id);
- final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, ctx.getMappingContext());
- final Optional<IpAddressDetailsReplyDump> dumpOptional = dumpManager
- .getDump(id, ctx.getModificationCache(), new AddressDumpParams(subInterfaceIndex, false));
-
- final Optional<IpAddressDetails> ipAddressDetails =
- findIpAddressDetailsByIp(dumpOptional, id.firstKeyOf(Address.class).getIp());
-
- if (ipAddressDetails.isPresent()) {
- final IpAddressDetails detail = ipAddressDetails.get();
- builder.setIp(arrayToIpv4AddressNoZone(detail.ip));
- builder.setSubnet(new PrefixLengthBuilder().setPrefixLength(Short.valueOf(detail.prefixLength)).build());
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Attributes for {} sub-interface (id={}) address {} successfully read: {}",
- subInterfaceName, subInterfaceIndex, id, builder.build());
- }
- }
- }
-
- @Override
- public List<AddressKey> getAllIds(@Nonnull InstanceIdentifier<Address> id, @Nonnull ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading list of keys for sub-interface addresses: {}", id);
-
- final String subInterfaceName = getSubInterfaceName(id);
- final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, ctx.getMappingContext());
- final Optional<IpAddressDetailsReplyDump> dumpOptional = dumpManager
- .getDump(id, ctx.getModificationCache(), new AddressDumpParams(subInterfaceIndex, false));
-
- return getAllIpv4AddressIds(dumpOptional, AddressKey::new);
- }
-
- @Override
- public void merge(@Nonnull Builder<? extends DataObject> builder, @Nonnull List<Address> readData) {
- ((Ipv4Builder) builder).setAddress(readData);
- }
-
- private static String getSubInterfaceName(@Nonnull final InstanceIdentifier<Address> id) {
- return SubInterfaceUtils.getSubInterfaceName(id.firstKeyOf(Interface.class).getName(),
- Math.toIntExact(id.firstKeyOf(SubInterface.class).getIdentifier()));
- }
-
- @Override
- public Initialized<Address> init(
- @Nonnull final InstanceIdentifier<Address> id, @Nonnull final Address readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id), readValue);
- }
-
- private InstanceIdentifier<Address> getCfgId(final InstanceIdentifier<Address> id) {
- return SubInterfaceCustomizer.getCfgId(RWUtils.cutId(id, SubInterface.class))
- .child(Ipv4.class)
- .child(Address.class, new AddressKey(id.firstKeyOf(Address.class)));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/dump/params/AddressDumpParams.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/dump/params/AddressDumpParams.java
deleted file mode 100644
index c5ada2d38..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/dump/params/AddressDumpParams.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate.ip.dump.params;
-
-public class AddressDumpParams {
-
- private final int interfaceIndex;
- private final boolean isIpv6;
-
- public AddressDumpParams(final int interfaceIndex, final boolean isIpv6) {
- this.interfaceIndex = interfaceIndex;
- this.isIpv6 = isIpv6;
- }
-
- public int getInterfaceIndex() {
- return interfaceIndex;
- }
-
- public boolean isIpv6() {
- return isIpv6;
- }
-
- @Override
- public String toString() {
- return "AddressDumpParams{" +
- "interfaceIndex=" + interfaceIndex +
- ", isIpv6=" + isIpv6 +
- '}';
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/pbb/PbbRewriteStateCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/pbb/PbbRewriteStateCustomizer.java
deleted file mode 100644
index 69b8c95bf..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/pbb/PbbRewriteStateCustomizer.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate.pbb;
-
-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.vpp.util.FutureJVppCustomizer;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.PbbRewriteStateInterfaceAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.interfaces.state._interface.PbbRewriteState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.interfaces.state._interface.PbbRewriteStateBuilder;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class PbbRewriteStateCustomizer extends FutureJVppCustomizer
- implements ReaderCustomizer<PbbRewriteState, PbbRewriteStateBuilder> {
-
- public PbbRewriteStateCustomizer(@Nonnull final FutureJVppCore futureJVppCore) {
- super(futureJVppCore);
- }
-
- @Nonnull
- @Override
- public PbbRewriteStateBuilder getBuilder(@Nonnull final InstanceIdentifier<PbbRewriteState> id) {
- return new PbbRewriteStateBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<PbbRewriteState> id,
- @Nonnull final PbbRewriteStateBuilder builder, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
- //TODO implement read after https://jira.fd.io/browse/VPP-468 + init
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder,
- @Nonnull final PbbRewriteState readValue) {
- ((PbbRewriteStateInterfaceAugmentationBuilder) parentBuilder).setPbbRewriteState(readValue);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducer.java
deleted file mode 100644
index 115727ad0..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducer.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * 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.translate.v3po.notification;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.Lists;
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import io.fd.honeycomb.notification.ManagedNotificationProducer;
-import io.fd.honeycomb.notification.NotificationCollector;
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.concurrent.CompletionStage;
-import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.NotThreadSafe;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.InterfaceDeleted;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.InterfaceDeletedBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.InterfaceNameOrIndex;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.InterfaceStateChange;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.InterfaceStateChangeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.InterfaceStatus;
-import org.opendaylight.yangtools.yang.binding.Notification;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsNotification;
-import io.fd.vpp.jvpp.core.dto.WantInterfaceEvents;
-import io.fd.vpp.jvpp.core.dto.WantInterfaceEventsReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Notification producer for interface events. It starts interface notification stream and for every
- * received notification, it transforms it into its BA equivalent and pushes into HC's notification collector.
- */
-@NotThreadSafe
-public final class InterfaceChangeNotificationProducer implements ManagedNotificationProducer, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(InterfaceChangeNotificationProducer.class);
-
- private final FutureJVppCore jvpp;
- private final NamingContext interfaceContext;
- private final MappingContext mappingContext;
- @Nullable
- private AutoCloseable notificationListenerReg;
-
- @Inject
- public InterfaceChangeNotificationProducer(@Nonnull final FutureJVppCore jvpp,
- @Named("interface-context") @Nonnull final NamingContext interfaceContext,
- @Named("honeycomb-context") @Nonnull final MappingContext mappingContext) {
- this.jvpp = jvpp;
- this.interfaceContext = interfaceContext;
- this.mappingContext = mappingContext;
- }
-
- @Override
- public void start(final NotificationCollector collector) {
- LOG.trace("Starting interface notifications");
- enableDisableIfcNotifications(1);
- LOG.debug("Interface notifications started successfully");
- notificationListenerReg = jvpp.getNotificationRegistry().registerSwInterfaceSetFlagsNotificationCallback(
- swInterfaceSetFlagsNotification -> {
- LOG.trace("Interface notification received: {}", swInterfaceSetFlagsNotification);
- // TODO HONEYCOMB-166 this should be lazy
- collector.onNotification(transformNotification(swInterfaceSetFlagsNotification));
- }
- );
- }
-
- private Notification transformNotification(final SwInterfaceSetFlagsNotification swInterfaceSetFlagsNotification) {
- if (swInterfaceSetFlagsNotification.deleted == 1) {
- return new InterfaceDeletedBuilder().setName(getIfcName(swInterfaceSetFlagsNotification)).build();
- } else {
- return new InterfaceStateChangeBuilder()
- .setName(getIfcName(swInterfaceSetFlagsNotification))
- .setAdminStatus(swInterfaceSetFlagsNotification.adminUpDown == 1
- ? InterfaceStatus.Up
- : InterfaceStatus.Down)
- .setOperStatus(swInterfaceSetFlagsNotification.linkUpDown == 1
- ? InterfaceStatus.Up
- : InterfaceStatus.Down)
- .build();
- }
- }
-
- /**
- * Get mapped name for the interface. Best effort only! The mapping might not yet be stored in context
- * data tree (write transaction is still in progress and context changes have not been committed yet, or
- * VPP sends the notification before it returns create request(that would store mapping)).
- * <p/>
- * In case mapping is not available, index is used as name.
- */
- private InterfaceNameOrIndex getIfcName(final SwInterfaceSetFlagsNotification swInterfaceSetFlagsNotification) {
- final Optional<String> optionalName =
- interfaceContext.getNameIfPresent(swInterfaceSetFlagsNotification.swIfIndex, mappingContext);
- return optionalName.isPresent()
- ? new InterfaceNameOrIndex(optionalName.get())
- : new InterfaceNameOrIndex((long) swInterfaceSetFlagsNotification.swIfIndex);
- }
-
- @Override
- public void stop() {
- LOG.trace("Stopping interface notifications");
- enableDisableIfcNotifications(0);
- LOG.debug("Interface notifications stopped successfully");
- try {
- if (notificationListenerReg != null) {
- notificationListenerReg.close();
- }
- } catch (Exception e) {
- LOG.warn("Unable to properly close notification registration: {}", notificationListenerReg, e);
- }
- }
-
- private void enableDisableIfcNotifications(int enableDisable) {
- final WantInterfaceEvents wantInterfaceEvents = new WantInterfaceEvents();
- wantInterfaceEvents.pid = 1;
- wantInterfaceEvents.enableDisable = enableDisable;
- final CompletionStage<WantInterfaceEventsReply> wantInterfaceEventsReplyCompletionStage;
- try {
- wantInterfaceEventsReplyCompletionStage = jvpp.wantInterfaceEvents(wantInterfaceEvents);
- getReply(wantInterfaceEventsReplyCompletionStage.toCompletableFuture());
- } catch (VppBaseCallException | TimeoutException e) {
- LOG.warn("Unable to {} interface notifications", enableDisable == 1
- ? "enable"
- : "disable", e);
- throw new IllegalStateException("Unable to control interface notifications", e);
- }
- }
-
- @Nonnull
- @Override
- public Collection<Class<? extends Notification>> getNotificationTypes() {
- final ArrayList<Class<? extends Notification>> classes = Lists.newArrayList();
- classes.add(InterfaceStateChange.class);
- classes.add(InterfaceDeleted.class);
- return classes;
- }
-
- @Override
- public void close() throws Exception {
- LOG.trace("Closing interface notifications producer");
- stop();
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizer.java
deleted file mode 100644
index bd9466628..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizer.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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.translate.v3po.vpp;
-
-import com.google.common.base.Preconditions;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-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.honeycomb.translate.vpp.util.JvppReplyConsumer;
-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.core.dto.BdIpMacAddDel;
-import io.fd.vpp.jvpp.core.dto.BdIpMacAddDelReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.concurrent.CompletionStage;
-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.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domain.attributes.arp.termination.table.ArpTerminationTableEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domain.attributes.arp.termination.table.ArpTerminationTableEntryKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Writer Customizer responsible for ARP termination table management.<br> Sends {@code bd_ip_mac_add_del} message to
- * VPP.<br> Equivalent of invoking {@code vppctl set bridge-domain arp term} command.
- */
-public class ArpTerminationTableEntryCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<ArpTerminationTableEntry, ArpTerminationTableEntryKey>, ByteDataTranslator,
- AddressTranslator, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(ArpTerminationTableEntryCustomizer.class);
-
- private final NamingContext bdContext;
-
- public ArpTerminationTableEntryCustomizer(@Nonnull final FutureJVppCore futureJvpp,
- @Nonnull final NamingContext bdContext) {
- super(futureJvpp);
- this.bdContext = Preconditions.checkNotNull(bdContext, "bdContext should not be null");
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<ArpTerminationTableEntry> id,
- @Nonnull final ArpTerminationTableEntry dataAfter,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("Creating ARP termination table entry: {} {}", id, dataAfter);
- bdIpMacAddDel(id, dataAfter, writeContext, true);
- LOG.debug("L2 ARP termination table entry created successfully: {} {}", id, dataAfter);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<ArpTerminationTableEntry> id,
- @Nonnull final ArpTerminationTableEntry dataBefore,
- @Nonnull final ArpTerminationTableEntry dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- throw new UnsupportedOperationException(
- "ARP termination table entry update is not supported. It has to be deleted and then created.");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<ArpTerminationTableEntry> id,
- @Nonnull final ArpTerminationTableEntry dataBefore,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("Deleting ARP termination table entry entry: {} {}", id, dataBefore);
- bdIpMacAddDel(id, dataBefore, writeContext, false);
- LOG.debug("ARP termination table entry deleted successfully: {} {}", id, dataBefore);
- }
-
- private void bdIpMacAddDel(@Nonnull final InstanceIdentifier<ArpTerminationTableEntry> id,
- @Nonnull final ArpTerminationTableEntry entry,
- final WriteContext writeContext, boolean isAdd) throws WriteFailedException {
- final String bdName = id.firstKeyOf(BridgeDomain.class).getName();
- final int bdId = bdContext.getIndex(bdName, writeContext.getMappingContext());
-
- final BdIpMacAddDel request = createRequest(entry, bdId, isAdd);
- LOG.debug("Sending l2FibAddDel request: {}", request);
- final CompletionStage<BdIpMacAddDelReply> replyCompletionStage =
- getFutureJVpp().bdIpMacAddDel(request);
-
- getReplyForWrite(replyCompletionStage.toCompletableFuture(), id);
- }
-
- private BdIpMacAddDel createRequest(final ArpTerminationTableEntry entry, final int bdId, boolean isAdd) {
- final BdIpMacAddDel request = new BdIpMacAddDel();
- request.bdId = bdId;
- request.isAdd = booleanToByte(isAdd);
- request.macAddress = parseMac(entry.getPhysAddress().getValue());
-
- final IpAddress ipAddress = entry.getIpAddress();
- if (ipAddress.getIpv6Address() != null) {
- // FIXME: HONEYCOMB-187 vpp does not support ipv6 in arp-termination table (based on analysis of l2_bd.c)
- throw new UnsupportedOperationException("IPv6 address for ARP termination table is not supported yet");
- }
-
- request.ipAddress = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(ipAddress.getIpv4Address()));
- return request;
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizer.java
deleted file mode 100644
index a95c18e5e..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizer.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * 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.translate.v3po.vpp;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.base.Preconditions;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-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.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDel;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDelReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import javax.annotation.concurrent.GuardedBy;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomainKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class BridgeDomainCustomizer
- extends FutureJVppCustomizer
- implements ListWriterCustomizer<BridgeDomain, BridgeDomainKey>, ByteDataTranslator, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(BridgeDomainCustomizer.class);
-
- private static final byte ADD_OR_UPDATE_BD = (byte) 1;
- private final NamingContext bdContext;
- @GuardedBy("this")
- private int bridgeDomainIndexCounter = 1;
-
- public BridgeDomainCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext bdContext) {
- super(futureJVppCore);
- this.bdContext = Preconditions.checkNotNull(bdContext, "bdContext should not be null");
- }
-
- private BridgeDomainAddDelReply addOrUpdateBridgeDomain(@Nonnull final InstanceIdentifier<BridgeDomain> id,
- final int bdId, @Nonnull final BridgeDomain bd)
- throws WriteFailedException {
- final BridgeDomainAddDelReply reply;
- final BridgeDomainAddDel request = new BridgeDomainAddDel();
- request.bdId = bdId;
- request.flood = booleanToByte(bd.isFlood());
- request.forward = booleanToByte(bd.isForward());
- request.learn = booleanToByte(bd.isLearn());
- request.uuFlood = booleanToByte(bd.isUnknownUnicastFlood());
- request.arpTerm = booleanToByte(bd.isArpTermination());
- request.isAdd = ADD_OR_UPDATE_BD;
-
- reply = getReplyForWrite(getFutureJVpp().bridgeDomainAddDel(request).toCompletableFuture(), id);
- LOG.debug("Bridge domain {} (id={}) add/update successful", bd.getName(), bdId);
- return reply;
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<BridgeDomain> id,
- @Nonnull final BridgeDomain dataBefore,
- @Nonnull final WriteContext ctx)
- throws WriteFailedException {
- LOG.debug("writeCurrentAttributes: id={}, current={}, ctx={}", id, dataBefore, ctx);
- final String bdName = dataBefore.getName();
-
- // Invoke 1. check index, 2. increase index 3. create ND 4. store mapping in a synchronized block to prevent
- // race conditions in case of concurrent invocation
- synchronized (this) {
- int index;
- if (bdContext.containsIndex(bdName, ctx.getMappingContext())) {
- index = bdContext.getIndex(bdName, ctx.getMappingContext());
- } else {
- // Critical section due to bridgeDomainIndexCounter read and write access
- // TODO HONEYCOMB-199 move this "get next available index" into naming context or an adapter
- // or a dedicated object
-
- // Use counter to assign bridge domain index, but still check naming context if it's not taken there
- while (bdContext.containsName(bridgeDomainIndexCounter, ctx.getMappingContext())) {
- bridgeDomainIndexCounter++;
- }
- index = bridgeDomainIndexCounter;
- }
- addOrUpdateBridgeDomain(id, index, dataBefore);
- bdContext.addName(index, bdName, ctx.getMappingContext());
- }
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<BridgeDomain> id,
- @Nonnull final BridgeDomain dataBefore,
- @Nonnull final WriteContext ctx)
- throws WriteFailedException {
- LOG.debug("deleteCurrentAttributes: id={}, dataBefore={}, ctx={}", id, dataBefore, ctx);
- final String bdName = id.firstKeyOf(BridgeDomain.class).getName();
- int bdId = bdContext.getIndex(bdName, ctx.getMappingContext());
-
- final BridgeDomainAddDel request = new BridgeDomainAddDel();
- request.bdId = bdId;
-
- getReplyForWrite(getFutureJVpp().bridgeDomainAddDel(request).toCompletableFuture(), id);
- LOG.debug("Bridge domain {} (id={}) deleted successfully", bdName, bdId);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<BridgeDomain> id,
- @Nonnull final BridgeDomain dataBefore, @Nonnull final BridgeDomain dataAfter,
- @Nonnull final WriteContext ctx)
- throws WriteFailedException {
- LOG.debug("updateCurrentAttributes: id={}, dataBefore={}, dataAfter={}, ctx={}", id, dataBefore, dataAfter,
- ctx);
-
- final String bdName = checkNotNull(dataAfter.getName());
- checkArgument(bdName.equals(dataBefore.getName()),
- "BridgeDomain name changed. It should be deleted and then created.");
-
- addOrUpdateBridgeDomain(id, bdContext.getIndex(bdName, ctx.getMappingContext()), dataAfter);
- }
-
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizer.java
deleted file mode 100644
index f37d5dd45..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizer.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.translate.v3po.vpp;
-
-import com.google.common.base.Preconditions;
-import com.google.common.primitives.Longs;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-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.vpp.util.MacTranslator;
-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.core.dto.L2FibAddDel;
-import io.fd.vpp.jvpp.core.dto.L2FibAddDelReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.L2FibFilter;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntryKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Writer Customizer responsible for L2 FIB create/delete operations.<br> Sends {@code l2_fib_add_del} message to
- * VPP.<br> Equivalent of invoking {@code vppctl l2fib add/del} command.
- */
-public class L2FibEntryCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<L2FibEntry, L2FibEntryKey>, ByteDataTranslator, MacTranslator,
- JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(L2FibEntryCustomizer.class);
-
- private final NamingContext bdContext;
- private final NamingContext interfaceContext;
-
- public L2FibEntryCustomizer(@Nonnull final FutureJVppCore futureJVppCore, @Nonnull final NamingContext bdContext,
- @Nonnull final NamingContext interfaceContext) {
- super(futureJVppCore);
- this.bdContext = Preconditions.checkNotNull(bdContext, "bdContext should not be null");
- this.interfaceContext = Preconditions.checkNotNull(interfaceContext, "interfaceContext should not be null");
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<L2FibEntry> id,
- @Nonnull final L2FibEntry dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
-
- LOG.debug("Creating L2 FIB entry: {} {}", id, dataAfter);
- l2FibAddDel(id, dataAfter, writeContext, true);
- LOG.debug("L2 FIB entry created successfully: {} {}", id, dataAfter);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<L2FibEntry> id,
- @Nonnull final L2FibEntry dataBefore, @Nonnull final L2FibEntry dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- throw new UnsupportedOperationException(
- "L2 FIB entry update is not supported. It has to be deleted and then created.");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<L2FibEntry> id,
- @Nonnull final L2FibEntry dataBefore, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
-
- LOG.debug("Deleting L2 FIB entry: {} {}", id, dataBefore);
- l2FibAddDel(id, dataBefore, writeContext, false);
- LOG.debug("L2 FIB entry deleted successfully: {} {}", id, dataBefore);
- }
-
- private void l2FibAddDel(@Nonnull final InstanceIdentifier<L2FibEntry> id, @Nonnull final L2FibEntry entry,
- final WriteContext writeContext, boolean isAdd) throws WriteFailedException {
- final String bdName = id.firstKeyOf(BridgeDomain.class).getName();
- final int bdId = bdContext.getIndex(bdName, writeContext.getMappingContext());
-
- int swIfIndex = -1;
- final String swIfName = entry.getOutgoingInterface();
- if (swIfName != null) {
- swIfIndex = interfaceContext.getIndex(swIfName, writeContext.getMappingContext());
- }
-
- final L2FibAddDel l2FibRequest = createL2FibRequest(entry, bdId, swIfIndex, isAdd);
- LOG.debug("Sending l2FibAddDel request: {}", l2FibRequest);
- final CompletionStage<L2FibAddDelReply> l2FibAddDelReplyCompletionStage =
- getFutureJVpp().l2FibAddDel(l2FibRequest);
-
- getReplyForWrite(l2FibAddDelReplyCompletionStage.toCompletableFuture(), id);
- }
-
- private L2FibAddDel createL2FibRequest(final L2FibEntry entry, final int bdId, final int swIfIndex, boolean isAdd) {
- final L2FibAddDel request = new L2FibAddDel();
- request.mac = macToLong(entry.getPhysAddress().getValue());
- request.bdId = bdId;
- request.swIfIndex = swIfIndex;
- request.isAdd = booleanToByte(isAdd);
- if (isAdd) {
- request.staticMac = booleanToByte(entry.isStaticConfig());
- request.filterMac = booleanToByte(L2FibFilter.class == entry.getAction());
- }
- return request;
- }
-
- // mac address is string of the form: 11:22:33:44:55:66
- // but VPP expects long value in the format 11:22:33:44:55:66:XX:XX
- private long macToLong(final String macAddress) {
- final byte[] mac = parseMac(macAddress);
- return Longs.fromBytes(mac[0], mac[1], mac[2], mac[3],
- mac[4], mac[5], (byte) 0, (byte) 0);
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionReader.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionReader.java
deleted file mode 100644
index 9f4cd7e77..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionReader.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * 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.translate.v3po.vppclassifier;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import com.google.common.base.Optional;
-import com.google.common.primitives.UnsignedInts;
-import io.fd.honeycomb.translate.MappingContext;
-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.v3po.interfacesstate.InterfaceDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.ClassifySessionDetails;
-import io.fd.vpp.jvpp.core.dto.ClassifySessionDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.ClassifySessionDump;
-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;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import javax.xml.bind.DatatypeConverter;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.HexString;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.OpaqueIndex;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.classify.table.base.attributes.ClassifySession;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.classify.table.base.attributes.ClassifySessionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.classify.table.base.attributes.ClassifySessionKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.state.ClassifyTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.state.ClassifyTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.state.ClassifyTableKey;
-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;
-
-/**
- * Reader customizer responsible for classify session read.<br> to VPP.<br> Equivalent to invoking {@code vppctl show
- * class table verbose} command.
- */
-public class ClassifySessionReader extends FutureJVppCustomizer
- implements ListReaderCustomizer<ClassifySession, ClassifySessionKey, ClassifySessionBuilder>,
- InterfaceDataTranslator, VppNodeReader, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(ClassifySessionReader.class);
- static final String CACHE_KEY = ClassifySessionReader.class.getName();
-
- private final VppClassifierContextManager classifyTableContext;
-
- public ClassifySessionReader(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final VppClassifierContextManager classifyTableContext) {
- super(futureJVppCore);
- this.classifyTableContext = checkNotNull(classifyTableContext, "classifyTableContext should not be null");
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder,
- @Nonnull final List<ClassifySession> readData) {
- ((ClassifyTableBuilder) builder).setClassifySession(readData);
- }
-
- @Nonnull
- @Override
- public ClassifySessionBuilder getBuilder(@Nonnull final InstanceIdentifier<ClassifySession> id) {
- return new ClassifySessionBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<ClassifySession> id,
- @Nonnull final ClassifySessionBuilder builder, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading attributes for classify session: {}", id);
-
- final ClassifySessionKey key = id.firstKeyOf(ClassifySession.class);
- checkArgument(key != null, "could not find ClassifySession key in {}", id);
-
- final ClassifySessionDetailsReplyDump classifySessionDump = dumpClassifySessions(id, ctx);
- final byte[] match = DatatypeConverter.parseHexBinary(key.getMatch().getValue().replace(":", ""));
- final Optional<ClassifySessionDetails> classifySession =
- findClassifySessionDetailsByMatch(classifySessionDump, match);
-
- if (classifySession.isPresent()) {
- final ClassifySessionDetails detail = classifySession.get();
- builder.setHitNext(
- readVppNode(detail.tableId, detail.hitNextIndex, classifyTableContext, ctx.getMappingContext(), LOG)
- .get());
- if (detail.opaqueIndex != ~0) {
- // value is specified:
- builder.setOpaqueIndex(readOpaqueIndex(detail.tableId, detail.opaqueIndex, ctx.getMappingContext()));
- }
- builder.setAdvance(detail.advance);
- builder.setMatch(key.getMatch());
-
- if (LOG.isTraceEnabled()) {
- LOG.trace("Attributes for classify session {} successfully read: {}", id, builder.build());
- }
- }
- }
-
- private OpaqueIndex readOpaqueIndex(final int tableIndex, final int opaqueIndex, final MappingContext ctx) {
- // We first try to map the value to a vpp node, if that fails, simply wrap the u32 value
- // TODO: HONEYCOMB-118 the approach might fail if the opaqueIndex contains small value that collides
- // with some of the adjacent nodes
-
- final Optional<VppNode> node = readVppNode(tableIndex, opaqueIndex, classifyTableContext, ctx, LOG);
- if (node.isPresent()) {
- return new OpaqueIndex(node.get());
- } else {
- return new OpaqueIndex(UnsignedInts.toLong(opaqueIndex));
- }
- }
-
- @Nullable
- private ClassifySessionDetailsReplyDump dumpClassifySessions(@Nonnull final InstanceIdentifier<?> id,
- @Nonnull final ReadContext ctx)
- throws ReadFailedException {
- final ClassifyTableKey tableKey = id.firstKeyOf(ClassifyTable.class);
- checkArgument(tableKey != null, "could not find ClassifyTable key in {}", id);
-
- final String cacheKey = CACHE_KEY + tableKey;
-
- ClassifySessionDetailsReplyDump classifySessionDump =
- (ClassifySessionDetailsReplyDump) ctx.getModificationCache().get(cacheKey);
- if (classifySessionDump != null) {
- LOG.debug("Classify sessions is present in cache: {}", cacheKey);
- return classifySessionDump;
- }
-
- final String tableName = tableKey.getName();
- checkState(classifyTableContext.containsTable(tableName, ctx.getMappingContext()),
- "Reading classify sessions for table {}, but table index could not be found in the classify table context",
- tableName);
- final int tableId = classifyTableContext.getTableIndex(tableName, ctx.getMappingContext());
- LOG.debug("Dumping classify sessions for classify table id={}", tableId);
-
-
- final ClassifySessionDump dumpRequest = new ClassifySessionDump();
- dumpRequest.tableId = tableId;
- final int timeOut = 30; // there can be many session with current ietf-acl implementation (could be probably
- // removed after fixing HONEYCOMB-247)
- classifySessionDump =
- getReplyForRead(getFutureJVpp().classifySessionDump(dumpRequest).toCompletableFuture(), id, timeOut);
-
- if (classifySessionDump != null) {
- // update the cache:
- ctx.getModificationCache().put(cacheKey, classifySessionDump);
- }
-
- return classifySessionDump;
- }
-
- private static Optional<ClassifySessionDetails> findClassifySessionDetailsByMatch(
- @Nullable final ClassifySessionDetailsReplyDump classifySessionDump, @Nonnull final byte[] match) {
- if (classifySessionDump != null && classifySessionDump.classifySessionDetails != null) {
- final List<ClassifySessionDetails> details = classifySessionDump.classifySessionDetails;
- final List<ClassifySessionDetails> filteredSessions = details.stream()
- .filter(singleDetail -> Arrays.equals(singleDetail.match, match)).collect(Collectors.toList());
- if (filteredSessions.isEmpty()) {
- return Optional.absent();
- } else if (filteredSessions.size() == 1) {
- return Optional.of(filteredSessions.get(0));
- } else {
- throw new IllegalStateException(String.format(
- "Found %d classify sessions witch given match. Single session expected.",
- filteredSessions.size()));
- }
- }
- return Optional.absent();
- }
-
- @Nonnull
- @Override
- public List<ClassifySessionKey> getAllIds(@Nonnull final InstanceIdentifier<ClassifySession> id,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- LOG.debug("Reading list of keys for classify sessions: {}", id);
-
- final ClassifySessionDetailsReplyDump classifySessionDump = dumpClassifySessions(id, ctx);
- if (classifySessionDump != null && classifySessionDump.classifySessionDetails != null) {
- return classifySessionDump.classifySessionDetails.stream()
- .map(detail -> new ClassifySessionKey(new HexString(printHexBinary(detail.match))))
- .collect(Collectors.toList());
- } else {
- return Collections.emptyList();
- }
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriter.java
deleted file mode 100644
index 996e76eca..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriter.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * 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.translate.v3po.vppclassifier;
-
-import static com.google.common.base.Preconditions.checkArgument;
-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.MappingContext;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-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.CompletionStage;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import javax.xml.bind.DatatypeConverter;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.OpaqueIndex;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.classify.table.base.attributes.ClassifySession;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.classify.table.base.attributes.ClassifySessionKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.ClassifyTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.ClassifyTableKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSessionReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Writer customizer responsible for classify session create/delete.<br> Sends {@code classify_add_del_session} message
- * to VPP.<br> Equivalent to invoking {@code vppctl classify table} command.
- */
-public class ClassifySessionWriter extends VppNodeWriter
- implements ListWriterCustomizer<ClassifySession, ClassifySessionKey>, ByteDataTranslator, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(ClassifySessionWriter.class);
- private final VppClassifierContextManager classifyTableContext;
-
- public ClassifySessionWriter(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final VppClassifierContextManager classifyTableContext) {
- super(futureJVppCore);
- this.classifyTableContext = checkNotNull(classifyTableContext, "classifyTableContext should not be null");
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<ClassifySession> id,
- @Nonnull final ClassifySession dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- LOG.debug("Creating classify session: iid={} dataAfter={}", id, dataAfter);
- try {
- classifyAddDelSession(true, id, dataAfter, writeContext);
- LOG.debug("Successfully created classify session: iid={} dataAfter={}", id, dataAfter);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<ClassifySession> id,
- @Nonnull final ClassifySession dataBefore,
- @Nonnull final ClassifySession dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- throw new UnsupportedOperationException("Classify session update is not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<ClassifySession> id,
- @Nonnull final ClassifySession dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- LOG.debug("Removing classify session: iid={} dataBefore={}", id, dataBefore);
- try {
- classifyAddDelSession(false, id, dataBefore, writeContext);
- LOG.debug("Successfully removed classify session: iid={} dataBefore={}", id, dataBefore);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
- }
-
- private void classifyAddDelSession(final boolean isAdd, @Nonnull final InstanceIdentifier<ClassifySession> id,
- @Nonnull final ClassifySession classifySession,
- @Nonnull final WriteContext writeContext)
- throws VppBaseCallException, WriteFailedException {
- final ClassifyTableKey tableKey = id.firstKeyOf(ClassifyTable.class);
- checkArgument(tableKey != null, "could not find classify table key in {}", id);
-
- final String tableName = tableKey.getName();
- checkState(classifyTableContext.containsTable(tableName, writeContext.getMappingContext()),
- "Could not find classify table index for {} in the classify table context", tableName);
- final int tableIndex = classifyTableContext.getTableIndex(tableName, writeContext.getMappingContext());
-
- final ClassifyTable classifyTable =
- getClassifyTable(writeContext, id.firstIdentifierOf(ClassifyTable.class), isAdd);
- final int hitNextIndex = getNodeIndex(classifySession.getHitNext(), classifyTable, classifyTableContext,
- writeContext.getMappingContext(), id);
- final int opaqueIndex =
- getOpaqueIndex(classifySession.getOpaqueIndex(), classifyTable, writeContext.getMappingContext(), id);
-
- final CompletionStage<ClassifyAddDelSessionReply> createClassifyTableReplyCompletionStage = getFutureJVpp()
- .classifyAddDelSession(
- getClassifyAddDelSessionRequest(isAdd, classifySession, tableIndex, hitNextIndex, opaqueIndex));
-
- getReplyForWrite(createClassifyTableReplyCompletionStage.toCompletableFuture(), id);
- }
-
- private ClassifyTable getClassifyTable(final WriteContext writeContext,
- @Nonnull final InstanceIdentifier<ClassifyTable> id,
- final boolean isAdd) {
- final Optional<ClassifyTable> classifyTable;
- if (isAdd) {
- classifyTable = writeContext.readAfter(id);
- } else {
- classifyTable = writeContext.readBefore(id);
- }
- return classifyTable.get();
- }
-
- private ClassifyAddDelSession getClassifyAddDelSessionRequest(final boolean isAdd,
- @Nonnull final ClassifySession classifySession,
- final int tableIndex,
- final int hitNextIndex,
- final int opaqueIndex) {
- ClassifyAddDelSession request = new ClassifyAddDelSession();
- request.isAdd = booleanToByte(isAdd);
- request.tableIndex = tableIndex;
- request.hitNextIndex = hitNextIndex;
- request.opaqueIndex = opaqueIndex;
-
- // default 0:
- request.advance = classifySession.getAdvance();
-
- request.match = DatatypeConverter.parseHexBinary(classifySession.getMatch().getValue().replace(":", ""));
- return request;
- }
-
- private int getOpaqueIndex(@Nullable final OpaqueIndex opaqueIndex, final ClassifyTable classifyTable,
- final MappingContext ctx, final InstanceIdentifier<ClassifySession> id)
- throws VppBaseCallException, WriteFailedException {
- if (opaqueIndex == null) {
- return ~0; // value not specified
- }
- if (opaqueIndex.getUint32() != null) {
- return opaqueIndex.getUint32().intValue();
- } else {
- return getNodeIndex(opaqueIndex.getVppNode(), classifyTable, classifyTableContext, ctx, id);
- }
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableReader.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableReader.java
deleted file mode 100644
index 745168635..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableReader.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * 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.translate.v3po.vppclassifier;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.base.Optional;
-import com.google.common.primitives.UnsignedInts;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
-import io.fd.honeycomb.translate.v3po.interfacesstate.InterfaceDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.vpp.util.MacTranslator;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableIds;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableIdsReply;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableInfo;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableInfoReply;
-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;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.HexString;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppClassifier;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppClassifierStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppNodeName;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.state.ClassifyTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.state.ClassifyTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.state.ClassifyTableKey;
-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;
-
-/**
- * Reader customizer responsible for classify table read.<br> to VPP.<br> Equivalent to invoking {@code vppctl show
- * class table} command.
- */
-public class ClassifyTableReader extends FutureJVppCustomizer
- implements InitializingListReaderCustomizer<ClassifyTable, ClassifyTableKey, ClassifyTableBuilder>, VppNodeReader,
- MacTranslator, InterfaceDataTranslator, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(ClassifyTableReader.class);
- private final VppClassifierContextManager classifyTableContext;
-
- public ClassifyTableReader(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final VppClassifierContextManager classifyTableContext) {
- super(futureJVppCore);
- this.classifyTableContext = checkNotNull(classifyTableContext, "classifyTableContext should not be null");
- }
-
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder,
- @Nonnull final List<ClassifyTable> readData) {
- ((VppClassifierStateBuilder) builder).setClassifyTable(readData);
- }
-
- @Nonnull
- @Override
- public ClassifyTableBuilder getBuilder(@Nonnull final InstanceIdentifier<ClassifyTable> id) {
- return new ClassifyTableBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<ClassifyTable> id,
- @Nonnull final ClassifyTableBuilder builder, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading attributes for classify table: {}", id);
-
- final ClassifyTableKey key = id.firstKeyOf(ClassifyTable.class);
- checkArgument(key != null, "could not find ClassifyTable key in {}", id);
- final ClassifyTableInfo request = new ClassifyTableInfo();
-
- final String tableName = key.getName();
- if (!classifyTableContext.containsTable(tableName, ctx.getMappingContext())) {
- LOG.debug("Could not find classify table {} in the naming context", tableName);
- return;
- }
- request.tableId = classifyTableContext.getTableIndex(tableName, ctx.getMappingContext());
-
-
- final ClassifyTableInfoReply reply =
- getReplyForRead(getFutureJVpp().classifyTableInfo(request).toCompletableFuture(), id);
-
- // mandatory values:
- builder.setName(tableName);
- builder.setKey(key);
- builder.setNbuckets(UnsignedInts.toLong(reply.nbuckets));
- builder.setSkipNVectors(UnsignedInts.toLong(reply.skipNVectors));
-
- // optional value read from context
- final Optional<String> tableBaseNode =
- classifyTableContext.getTableBaseNode(tableName, ctx.getMappingContext());
- if (tableBaseNode.isPresent()) {
- builder.setClassifierNode(new VppNodeName(tableBaseNode.get()));
- }
-
- builder.setMissNext(
- readVppNode(reply.tableId, reply.missNextIndex, classifyTableContext, ctx.getMappingContext(), LOG)
- .get());
- builder.setMask(new HexString(printHexBinary(reply.mask)));
- builder.setActiveSessions(UnsignedInts.toLong(reply.activeSessions));
-
- if (reply.nextTableIndex != ~0) {
- // next table index is present:
- builder.setNextTable(classifyTableContext.getTableName(reply.nextTableIndex, ctx.getMappingContext()));
- }
-
- if (LOG.isTraceEnabled()) {
- LOG.trace("Attributes for classify table {} successfully read: {}", id, builder.build());
- }
- }
-
- @Nonnull
- @Override
- public List<ClassifyTableKey> getAllIds(@Nonnull final InstanceIdentifier<ClassifyTable> id,
- @Nonnull final ReadContext context) throws ReadFailedException {
- LOG.debug("Reading list of keys for classify tables: {}", id);
-
- final ClassifyTableIdsReply classifyTableIdsReply =
- getReplyForRead(getFutureJVpp().classifyTableIds(new ClassifyTableIds()).toCompletableFuture(),
- id);
- if (classifyTableIdsReply.ids != null) {
- return Arrays.stream(classifyTableIdsReply.ids).mapToObj(i -> {
- final String tableName = classifyTableContext.getTableName(i, context.getMappingContext());
- LOG.trace("Classify table with name: {} and index: {} found in VPP", tableName, i);
- return new ClassifyTableKey(tableName);
- }).collect(Collectors.toList());
- } else {
- return Collections.emptyList();
- }
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.ClassifyTable> init(
- @Nonnull final InstanceIdentifier<ClassifyTable> id, @Nonnull final ClassifyTable readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id),
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.ClassifyTableBuilder(readValue)
- .setName(readValue.getName())
- .build());
- }
-
- static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.ClassifyTable> getCfgId(
- final InstanceIdentifier<ClassifyTable> id) {
- return InstanceIdentifier.create(VppClassifier.class)
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.ClassifyTable.class,
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.ClassifyTableKey(id.firstKeyOf(ClassifyTable.class).getName()));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriter.java
deleted file mode 100644
index 33dc64103..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriter.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * 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.translate.v3po.vppclassifier;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-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.CompletionStage;
-import javax.annotation.Nonnull;
-import javax.xml.bind.DatatypeConverter;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.ClassifyTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.ClassifyTableKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTableReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Writer customizer responsible for classify table create/delete. <br> Sends {@code classify_add_del_table} message to
- * VPP.<br> Equivalent to invoking {@code vppctl classify table} command.
- */
-public class ClassifyTableWriter extends VppNodeWriter
- implements ListWriterCustomizer<ClassifyTable, ClassifyTableKey>, ByteDataTranslator, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(ClassifyTableWriter.class);
- private final VppClassifierContextManager classifyTableContext;
-
- public ClassifyTableWriter(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final VppClassifierContextManager classifyTableContext) {
- super(futureJVppCore);
- this.classifyTableContext = checkNotNull(classifyTableContext, "classifyTableContext should not be null");
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<ClassifyTable> id,
- @Nonnull final ClassifyTable dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("Creating classify table: iid={} dataAfter={}", id, dataAfter);
- try {
- final int newTableIndex =
- classifyAddDelTable(true, id, dataAfter, ~0 /* value not present */,
- writeContext.getMappingContext());
-
- // Add classify table name <-> vpp index mapping to the naming context:
- classifyTableContext.addTable(newTableIndex, dataAfter.getName(), dataAfter.getClassifierNode(),
- writeContext.getMappingContext());
- LOG.debug("Successfully created classify table(id={]): iid={} dataAfter={}", newTableIndex, id, dataAfter);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<ClassifyTable> id,
- @Nonnull final ClassifyTable dataBefore, @Nonnull final ClassifyTable dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- throw new UnsupportedOperationException("Classify table update is not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<ClassifyTable> id,
- @Nonnull final ClassifyTable dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- LOG.debug("Removing classify table: iid={} dataBefore={}", id, dataBefore);
- final String tableName = dataBefore.getName();
- checkState(classifyTableContext.containsTable(tableName, writeContext.getMappingContext()),
- "Removing classify table {}, but index could not be found in the classify table context", tableName);
-
- final int tableIndex = classifyTableContext.getTableIndex(tableName, writeContext.getMappingContext());
- try {
- classifyAddDelTable(false, id, dataBefore, tableIndex, writeContext.getMappingContext());
-
- // Remove deleted interface from interface context:
- classifyTableContext.removeTable(dataBefore.getName(), writeContext.getMappingContext());
- LOG.debug("Successfully removed classify table(id={]): iid={} dataAfter={}", tableIndex, id, dataBefore);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
- }
-
- private int classifyAddDelTable(final boolean isAdd, @Nonnull final InstanceIdentifier<ClassifyTable> id,
- @Nonnull final ClassifyTable table, final int tableId, final MappingContext ctx)
- throws VppBaseCallException, WriteFailedException {
-
- final int missNextIndex =
- getNodeIndex(table.getMissNext(), table, classifyTableContext, ctx, id);
-
- final CompletionStage<ClassifyAddDelTableReply> createClassifyTableReplyCompletionStage =
- getFutureJVpp()
- .classifyAddDelTable(getClassifyAddDelTableRequest(isAdd, tableId, table, missNextIndex, ctx));
-
- final ClassifyAddDelTableReply reply =
- getReplyForWrite(createClassifyTableReplyCompletionStage.toCompletableFuture(), id);
- return reply.newTableIndex;
- }
-
- private ClassifyAddDelTable getClassifyAddDelTableRequest(final boolean isAdd, final int tableIndex,
- @Nonnull final ClassifyTable table,
- final int missNextIndex,
- @Nonnull final MappingContext ctx) {
- final ClassifyAddDelTable request = new ClassifyAddDelTable();
- request.isAdd = booleanToByte(isAdd);
- request.tableIndex = tableIndex;
-
- // mandatory, all u32 values are permitted:
- request.nbuckets = table.getNbuckets().intValue();
- request.memorySize = table.getMemorySize().intValue();
- request.skipNVectors = table.getSkipNVectors().intValue();
-
- // mandatory
- request.missNextIndex = missNextIndex;
-
- final String nextTable = table.getNextTable();
- if (isAdd && nextTable != null) {
- request.nextTableIndex = classifyTableContext.getTableIndex(nextTable, ctx);
- } else {
- request.nextTableIndex = ~0; // value not specified
- }
- request.mask = DatatypeConverter.parseHexBinary(table.getMask().getValue().replace(":", ""));
- checkArgument(request.mask.length % 16 == 0, "Number of mask bytes must be multiple of 16.");
- request.matchNVectors = request.mask.length / 16;
-
- return request;
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppClassifierContextManager.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppClassifierContextManager.java
deleted file mode 100644
index 69dfb644a..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppClassifierContextManager.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.translate.v3po.vppclassifier;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.MappingContext;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppNodeName;
-
-/**
- * Manages metadata for vpp-classifier
- */
-public interface VppClassifierContextManager {
-
- /**
- * Creates metadata for classify table.
- *
- * @param id classify table index
- * @param name classify table name
- * @param classifierNode name of VPP node the table is defined for
- * @param ctx mapping context providing context data for current transaction
- */
- void addTable(final int id, @Nonnull final String name, @Nullable final VppNodeName classifierNode,
- @Nonnull final MappingContext ctx);
-
- /**
- * Check whether metadata for given classify table metadata is present.
- *
- * @param name classify table name
- * @param ctx mapping context providing context data for current transaction
- * @return true if present, false otherwise
- */
- boolean containsTable(@Nonnull String name, @Nonnull final MappingContext ctx);
-
- /**
- * Returns classify table index associated with the given name.
- *
- * @param name classify table name
- * @param ctx mapping context providing context data for current transaction
- * @return integer index value matching supplied classify table name
- * @throws IllegalArgumentException if classify table was not found
- */
- int getTableIndex(@Nonnull final String name, @Nonnull final MappingContext ctx);
-
- /**
- * Retrieves classify table name for given id. If not present, artificial name will be generated.
- *
- * @param id classify table index
- * @param ctx mapping context providing context data for current transaction
- * @return classify table name matching supplied index
- */
- String getTableName(final int id, @Nonnull final MappingContext ctx);
-
- /**
- * Returns name of the base vpp node associated with the classify table.
- *
- * @param name classify table name
- * @param ctx mapping context providing context data for current transaction
- * @return name of VPP node the table is defined for
- */
- Optional<String> getTableBaseNode(final String name, @Nonnull final MappingContext ctx);
-
- /**
- * Removes classify table metadata from current context.
- *
- * @param name classify table name
- * @param ctx mapping context providing context data for current transaction
- */
- void removeTable(@Nonnull final String name, @Nonnull final MappingContext ctx);
-
- /**
- * Adds relative node index to node name mapping for given classify table.
- *
- * @param tableName classify table name
- * @param nodeIndex index of a vpp node, relative to table's base node
- * @param nodeName name of a vpp node
- * @param ctx mapping context providing context data for current transaction
- */
- void addNodeName(@Nonnull String tableName, final int nodeIndex, @Nonnull final String nodeName,
- @Nonnull final MappingContext ctx);
-
- /**
- * Retrieves node name associated with the given classify table and node index.
- *
- * @param tableIndex classify table index
- * @param nodeIndex relative index of a vpp node
- * @param ctx mapping context providing context data for current transaction
- * @return name of vpp node
- */
- Optional<String> getNodeName(final int tableIndex, final int nodeIndex, @Nonnull final MappingContext ctx);
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppClassifierContextManagerImpl.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppClassifierContextManagerImpl.java
deleted file mode 100644
index 13931ae47..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppClassifierContextManagerImpl.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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.translate.v3po.vppclassifier;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkState;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.inject.Inject;
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.util.read.BindingBrokerReader;
-import java.util.List;
-import java.util.stream.Collector;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import javax.inject.Named;
-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.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppNodeName;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.VppClassifierContext;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.VppClassifierContextBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.ClassifyTableContext;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.ClassifyTableContextBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.ClassifyTableContextKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.classify.table.context.NodeContext;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.classify.table.context.NodeContextBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.classify.table.context.NodeContextKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-
-/**
- * Facade on top of {@link MappingContext} that manages {@link ClassifyTableContext}.
- */
-public final class VppClassifierContextManagerImpl implements VppClassifierContextManager {
- private static final Collector<ClassifyTableContext, ?, ClassifyTableContext> SINGLE_ITEM_COLLECTOR =
- RWUtils.singleItemCollector();
-
- @VisibleForTesting
- static final InstanceIdentifier<VppClassifierContext>
- VPP_CLASSIFIER_CONTEXT_IID = KeyedInstanceIdentifier.create(VppClassifierContext.class);
- private final String artificialNamePrefix;
-
- /**
- * Creates new VppClassifierContextManagerImpl.
- *
- * @param artificialNamePrefix artificial name to be used to generate names for classify tables without existing
- * metadata
- */
- public VppClassifierContextManagerImpl(@Nonnull final String artificialNamePrefix) {
- this.artificialNamePrefix =
- Preconditions.checkNotNull(artificialNamePrefix, "artificialNamePrefix should not be null");
- }
-
- private KeyedInstanceIdentifier<ClassifyTableContext, ClassifyTableContextKey> getMappingIid(final String name) {
- return VPP_CLASSIFIER_CONTEXT_IID.child(ClassifyTableContext.class, new ClassifyTableContextKey(name));
- }
-
- @Override
- public void addTable(final int id, @Nonnull final String name, @Nullable final VppNodeName classifierNode,
- @Nonnull final MappingContext ctx) {
- final KeyedInstanceIdentifier<ClassifyTableContext, ClassifyTableContextKey> mappingIid = getMappingIid(name);
- final ClassifyTableContextBuilder tableCtx = new ClassifyTableContextBuilder().setIndex(id).setName(name);
- if (classifierNode != null) {
- tableCtx.setClassifierNodeName(classifierNode.getValue());
- }
- ctx.put(mappingIid, tableCtx.build());
- }
-
- @Override
- public boolean containsTable(@Nonnull final String name, @Nonnull final MappingContext ctx) {
- final Optional<ClassifyTableContext> read = ctx.read(getMappingIid(name));
- return read.isPresent();
- }
-
- @Override
- public int getTableIndex(@Nonnull final String name, @Nonnull final MappingContext ctx) {
- final Optional<ClassifyTableContext> read = ctx.read(getMappingIid(name));
- checkArgument(read.isPresent(), "No mapping stored for name: %s", name);
- return read.get().getIndex();
- }
-
- @Override
- public String getTableName(final int id, @Nonnull final MappingContext ctx) {
- if (!containsName(id, ctx)) {
- final String artificialName = getArtificialName(id);
- addTable(id, artificialName, null, ctx);
- }
-
- final Optional<VppClassifierContext> read = ctx.read(VPP_CLASSIFIER_CONTEXT_IID);
- checkState(read.isPresent(), "VppClassifierContext for index: %s is not present. But should be", id);
-
- return read.get().getClassifyTableContext().stream()
- .filter(t -> t.getIndex().equals(id))
- .collect(SINGLE_ITEM_COLLECTOR).getName();
- }
-
- private boolean containsName(final int index, @Nonnull final MappingContext mappingContext) {
- final Optional<VppClassifierContext> read = mappingContext.read(VPP_CLASSIFIER_CONTEXT_IID);
- return read.isPresent()
- ? read.get().getClassifyTableContext().stream().anyMatch(t -> t.getIndex().equals(index))
- : false;
- }
-
- @Override
- public Optional<String> getTableBaseNode(@Nonnull final String name, @Nonnull final MappingContext ctx) {
- final Optional<ClassifyTableContext> read = ctx.read(getMappingIid(name));
- if (read.isPresent()) {
- return Optional.fromNullable(read.get().getClassifierNodeName());
- }
- return Optional.absent();
- }
-
- @Override
- public void removeTable(@Nonnull final String name, @Nonnull final MappingContext ctx) {
- ctx.delete(getMappingIid(name));
- }
-
- @Override
- public void addNodeName(@Nonnull final String tableName, final int nodeIndex,
- @Nonnull final String nodeName,
- @Nonnull final MappingContext ctx) {
- final KeyedInstanceIdentifier<NodeContext, NodeContextKey> iid =
- getMappingIid(tableName).child(NodeContext.class, new NodeContextKey(nodeName));
- ctx.put(iid, new NodeContextBuilder().setName(nodeName).setIndex(nodeIndex).build());
- }
-
- @Override
- public Optional<String> getNodeName(final int tableIndex, final int nodeIndex, @Nonnull final MappingContext ctx) {
- if (!containsName(tableIndex, ctx)) {
- return Optional.absent();
- }
- final String tableName = getTableName(tableIndex, ctx);
- final Optional<ClassifyTableContext> tableCtx = ctx.read(getMappingIid(tableName));
- final List<NodeContext> nodeContext = tableCtx.get().getNodeContext();
- if (nodeContext == null) {
- return Optional.absent();
- }
- return Optional.fromNullable(nodeContext.stream()
- .filter(n -> n.getIndex().equals(nodeIndex))
- .findFirst()
- .map(nodes -> nodes.getName())
- .orElse(null));
- }
-
- private String getArtificialName(final int index) {
- return artificialNamePrefix + index;
- }
-
- public static final class ContextsReaderFactory implements ReaderFactory {
-
- @Inject
- @Named("honeycomb-context")
- private DataBroker contextBindingBrokerDependency;
-
- @Override
- public void init(final ModifiableReaderRegistryBuilder registry) {
- registry.add(new BindingBrokerReader<>(VPP_CLASSIFIER_CONTEXT_IID,
- contextBindingBrokerDependency,
- LogicalDatastoreType.OPERATIONAL, VppClassifierContextBuilder.class));
- }
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeReader.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeReader.java
deleted file mode 100644
index 23ce094c1..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeReader.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.translate.v3po.vppclassifier;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.MappingContext;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.PacketHandlingAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppNodeName;
-import org.slf4j.Logger;
-
-interface VppNodeReader {
-
- /**
- * Converts vpp node index to YANG representation of vpp node.
- *
- * @param nodeIndex index of vpp node treated as signed integer.
- * @return vpp node representation
- */
- default Optional<VppNode> readVppNode(final int tableIndex, final int nodeIndex,
- @Nonnull final VppClassifierContextManager vppClassifierContextManager,
- @Nonnull final MappingContext ctx, @Nonnull final Logger log) {
- final PacketHandlingAction action = PacketHandlingAction.forValue(nodeIndex);
- if (action == null) {
- return vppClassifierContextManager.getNodeName(tableIndex, nodeIndex, ctx)
- .transform(nodeName -> new VppNode(new VppNodeName(nodeName)));
- }
- return Optional.of(new VppNode(action));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeWriter.java
deleted file mode 100644
index 308c2496e..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeWriter.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.translate.v3po.vppclassifier;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.GetNextIndex;
-import io.fd.vpp.jvpp.core.dto.GetNextIndexReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.ClassifyTable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-abstract class VppNodeWriter extends FutureJVppCustomizer implements JvppReplyConsumer {
-
- protected VppNodeWriter(@Nonnull final FutureJVppCore futureJvpp) {
- super(futureJvpp);
- }
-
- protected int getNodeIndex(@Nonnull final VppNode node, @Nonnull final ClassifyTable classifyTable,
- @Nonnull final VppClassifierContextManager vppClassifierContextManager,
- @Nonnull final MappingContext ctx, @Nonnull final InstanceIdentifier<?> id)
- throws VppBaseCallException, WriteFailedException {
- if (node.getPacketHandlingAction() != null) {
- return node.getPacketHandlingAction().getIntValue();
- } else {
- return nodeNameToIndex(classifyTable, node.getVppNodeName().getValue(), vppClassifierContextManager, ctx,
- id);
- }
- }
-
- private int nodeNameToIndex(@Nonnull final ClassifyTable classifyTable, @Nonnull final String nextNodeName,
- @Nonnull final VppClassifierContextManager vppClassifierContextManager,
- @Nonnull final MappingContext ctx, @Nonnull final InstanceIdentifier<?> id)
- throws WriteFailedException {
- checkArgument(classifyTable != null && classifyTable.getClassifierNode() != null,
- "to use relative node names, table classifier node needs to be provided");
- final GetNextIndex request = new GetNextIndex();
- request.nodeName = classifyTable.getClassifierNode().getValue().getBytes();
- request.nextName = nextNodeName.getBytes();
- final CompletionStage<GetNextIndexReply> getNextIndexCompletionStage =
- getFutureJVpp().getNextIndex(request);
-
- final GetNextIndexReply reply;
- try {
- reply = getReplyForRead(getNextIndexCompletionStage.toCompletableFuture(), id);
-
- // vpp does not provide relative node index to node name conversion (https://jira.fd.io/browse/VPP-219)
- // as a workaround we need to add mapping to vpp-classfier-context
- vppClassifierContextManager.addNodeName(classifyTable.getName(), reply.nextIndex, nextNodeName, ctx);
- } catch (ReadFailedException e) {
- throw new WriteFailedException(id, String.format("Failed to get node index for %s relative to %s",
- nextNodeName, classifyTable.getClassifierNode()), e);
- }
- return reply.nextIndex;
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/BridgeDomainCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/BridgeDomainCustomizer.java
deleted file mode 100644
index 9f122d1a5..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/BridgeDomainCustomizer.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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.translate.v3po.vppstate;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Iterables;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainDetails;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.Vpp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.BridgeDomains;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.BridgeDomainsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomain;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainKey;
-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 final class BridgeDomainCustomizer extends FutureJVppCustomizer
- implements InitializingListReaderCustomizer<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder>, ByteDataTranslator {
-
- private static final Logger LOG = LoggerFactory.getLogger(BridgeDomainCustomizer.class);
- private final NamingContext bdContext;
-
- public BridgeDomainCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext bdContext) {
- super(futureJVppCore);
- this.bdContext = Preconditions.checkNotNull(bdContext, "bdContext should not be null");
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<BridgeDomain> id,
- @Nonnull final BridgeDomainBuilder builder, @Nonnull final ReadContext context)
- throws ReadFailedException {
- LOG.debug("vppstate.BridgeDomainCustomizer.readCurrentAttributes: id={}, builderbuilder={}, context={}",
- id, builder, context);
-
- final BridgeDomainKey key = id.firstKeyOf(id.getTargetType());
- LOG.debug("vppstate.BridgeDomainCustomizer.readCurrentAttributes: key={}", key);
-
- final int bdId = bdContext.getIndex(key.getName(), context.getMappingContext());
- LOG.debug("vppstate.BridgeDomainCustomizer.readCurrentAttributes: bdId={}", bdId);
-
- BridgeDomainDetailsReplyDump reply;
- BridgeDomainDetails bridgeDomainDetails;
- final BridgeDomainDump request = new BridgeDomainDump();
- request.bdId = bdContext.getIndex(key.getName(), context.getMappingContext());
- try {
- reply = getFutureJVpp().bridgeDomainDump(request).toCompletableFuture().get();
- bridgeDomainDetails = Iterables.getOnlyElement(reply.bridgeDomainDetails);
- } catch (Exception e) {
- LOG.debug("Unable to read bridge domain: {}", key.getName(), e);
- return;
- }
-
- logBridgeDomainDetails(bridgeDomainDetails);
-
- builder.setName(key.getName());
- builder.setArpTermination(byteToBoolean(bridgeDomainDetails.arpTerm));
- builder.setFlood(byteToBoolean(bridgeDomainDetails.flood));
- builder.setForward(byteToBoolean(bridgeDomainDetails.forward));
- builder.setLearn(byteToBoolean(bridgeDomainDetails.learn));
- builder.setUnknownUnicastFlood(byteToBoolean(bridgeDomainDetails.uuFlood));
- }
-
- private void logBridgeDomainDetails(final BridgeDomainDetails bridgeDomainDetails) {
- LOG.debug("bridgeDomainDetails={}", bridgeDomainDetails);
- if (bridgeDomainDetails != null) {
- LOG.debug("bridgeDomainDetails.arpTerm={}", bridgeDomainDetails.arpTerm);
- LOG.debug("bridgeDomainDetails.bdId={}", bridgeDomainDetails.bdId);
- LOG.debug("bridgeDomainDetails.bviSwIfIndex={}", bridgeDomainDetails.bviSwIfIndex);
- LOG.debug("bridgeDomainDetails.flood={}", bridgeDomainDetails.flood);
- LOG.debug("bridgeDomainDetails.forward={}", bridgeDomainDetails.forward);
- LOG.debug("bridgeDomainDetails.learn={}", bridgeDomainDetails.learn);
- LOG.debug("bridgeDomainDetails.nSwIfs={}", bridgeDomainDetails.nSwIfs);
- LOG.debug("bridgeDomainDetails.uuFlood={}", bridgeDomainDetails.uuFlood);
- }
- }
-
- @Nonnull
- @Override
- public BridgeDomainBuilder getBuilder(@Nonnull final InstanceIdentifier<BridgeDomain> id) {
- return new BridgeDomainBuilder();
- }
-
- @Nonnull
- @Override
- public List<BridgeDomainKey> getAllIds(@Nonnull final InstanceIdentifier<BridgeDomain> id,
- @Nonnull final ReadContext context) throws ReadFailedException {
- final BridgeDomainDump request = new BridgeDomainDump();
- request.bdId = -1; // dump call
-
- BridgeDomainDetailsReplyDump reply;
- try {
- reply = getFutureJVpp().bridgeDomainDump(request).toCompletableFuture().get();
- } catch (Exception e) {
- throw new ReadFailedException(id, e);
- }
-
- if (reply == null || reply.bridgeDomainDetails == null) {
- return Collections.emptyList();
- }
-
- final int bIdsLength = reply.bridgeDomainDetails.size();
- LOG.debug("vppstate.BridgeDomainCustomizer.getAllIds: bIds.length={}", bIdsLength);
- if (bIdsLength == 0) {
- // No bridge domains
- return Collections.emptyList();
- }
-
- final List<BridgeDomainKey> allIds = new ArrayList<>(bIdsLength);
- for (BridgeDomainDetails detail : reply.bridgeDomainDetails) {
- logBridgeDomainDetails(detail);
-
- final String bName = bdContext.getName(detail.bdId, context.getMappingContext());
- LOG.debug("vppstate.BridgeDomainCustomizer.getAllIds: bName={}", bName);
- allIds.add(new BridgeDomainKey(bName));
- }
-
- return allIds;
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder,
- @Nonnull final List<BridgeDomain> readData) {
- ((BridgeDomainsBuilder) builder).setBridgeDomain(readData);
- }
-
- @Override
- public Initialized<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain> init(
- @Nonnull final InstanceIdentifier<BridgeDomain> id,
- @Nonnull final BridgeDomain readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id),
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomainBuilder()
- .setName(readValue.getName())
- .setLearn(readValue.isLearn())
- .setUnknownUnicastFlood(readValue.isUnknownUnicastFlood())
- .setArpTermination(readValue.isArpTermination())
- .setFlood(readValue.isFlood())
- .setForward(readValue.isForward())
- .build());
- }
-
- static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain> getCfgId(
- final InstanceIdentifier<BridgeDomain> id) {
- return InstanceIdentifier.create(Vpp.class).child(BridgeDomains.class).child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain.class,
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomainKey(
- id.firstKeyOf(BridgeDomain.class).getName()));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizer.java
deleted file mode 100644
index a9326d97f..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizer.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * 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.translate.v3po.vppstate;
-
-import com.google.common.base.Preconditions;
-import com.google.common.primitives.Longs;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.v3po.interfacesstate.InterfaceDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.core.dto.L2FibTableDump;
-import io.fd.vpp.jvpp.core.dto.L2FibTableEntry;
-import io.fd.vpp.jvpp.core.dto.L2FibTableEntryReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.CompletableFuture;
-import java.util.stream.Collector;
-import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.L2FibFilter;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.L2FibForward;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.L2FibTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.L2FibTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntryKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomain;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainKey;
-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 final class L2FibEntryCustomizer extends FutureJVppCustomizer
- implements InitializingListReaderCustomizer<L2FibEntry, L2FibEntryKey, L2FibEntryBuilder>, ByteDataTranslator,
- InterfaceDataTranslator {
-
- private static final Logger LOG = LoggerFactory.getLogger(L2FibEntryCustomizer.class);
-
- private static final Collector<L2FibTableEntry, ?, L2FibTableEntry> SINGLE_ITEM_COLLECTOR =
- RWUtils.singleItemCollector();
-
- private final NamingContext bdContext;
- private final NamingContext interfaceContext;
-
- public L2FibEntryCustomizer(@Nonnull final FutureJVppCore futureJVppCore, @Nonnull final NamingContext bdContext,
- @Nonnull final NamingContext interfaceContext) {
- super(futureJVppCore);
- this.bdContext = Preconditions.checkNotNull(bdContext, "bdContext should not be null");
- this.interfaceContext = Preconditions.checkNotNull(interfaceContext, "interfaceContext should not be null");
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<L2FibEntry> id,
- @Nonnull final L2FibEntryBuilder builder, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
-
- final L2FibEntryKey key = id.firstKeyOf(id.getTargetType());
- final BridgeDomainKey bridgeDomainKey = id.firstKeyOf(BridgeDomain.class);
- final int bdId = bdContext.getIndex(bridgeDomainKey.getName(), ctx.getMappingContext());
- LOG.debug("Reading L2 FIB entry: key={}. bridgeDomainKey={}, bdId={}", key, bridgeDomainKey, bdId);
-
- try {
- // TODO HONEYCOMB-186 use cached l2FibTable
- final L2FibTableEntry entry = dumpL2Fibs(id, bdId).stream().filter(e -> key.getPhysAddress()
- .equals(new PhysAddress(vppPhysAddrToYang(Longs.toByteArray(e.mac), 2))))
- .collect(SINGLE_ITEM_COLLECTOR);
-
- builder.setAction(byteToBoolean(entry.filterMac)
- ? L2FibFilter.class
- : L2FibForward.class);
- builder.setBridgedVirtualInterface(byteToBoolean(entry.bviMac));
-
- if (entry.swIfIndex != -1) {
- builder.setOutgoingInterface(interfaceContext.getName(entry.swIfIndex, ctx.getMappingContext()));
- }
- builder.setStaticConfig(byteToBoolean(entry.staticMac));
- builder.setPhysAddress(key.getPhysAddress());
- builder.setKey(key);
- } catch (Exception e) {
- throw new ReadFailedException(id, e);
- }
- }
-
- @Nonnull
- private List<L2FibTableEntry> dumpL2Fibs(final InstanceIdentifier<L2FibEntry> id, final int bdId)
- throws ReadFailedException {
- final L2FibTableDump l2FibRequest = new L2FibTableDump();
- l2FibRequest.bdId = bdId;
-
- final CompletableFuture<L2FibTableEntryReplyDump> l2FibTableDumpCompletableFuture =
- getFutureJVpp().l2FibTableDump(l2FibRequest).toCompletableFuture();
-
- final L2FibTableEntryReplyDump dump = getReplyForRead(l2FibTableDumpCompletableFuture, id);
-
- if (null == dump || null == dump.l2FibTableEntry) {
- return Collections.emptyList();
- } else {
- return dump.l2FibTableEntry;
- }
- }
-
- @Nonnull
- @Override
- public List<L2FibEntryKey> getAllIds(@Nonnull final InstanceIdentifier<L2FibEntry> id,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- final BridgeDomainKey bridgeDomainKey = id.firstKeyOf(BridgeDomain.class);
- final int bdId = bdContext.getIndex(bridgeDomainKey.getName(), ctx.getMappingContext());
-
- LOG.debug("Reading L2 FIB for bridge domain {} (bdId={})", bridgeDomainKey, bdId);
- return dumpL2Fibs(id, bdId).stream()
- .map(entry -> new L2FibEntryKey(
- new PhysAddress(vppPhysAddrToYang(Longs.toByteArray(entry.mac), 2))))
- .collect(Collectors.toList());
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder, @Nonnull final List<L2FibEntry> readData) {
- ((L2FibTableBuilder) builder).setL2FibEntry(readData);
- }
-
- @Nonnull
- @Override
- public L2FibEntryBuilder getBuilder(@Nonnull final InstanceIdentifier<L2FibEntry> id) {
- return new L2FibEntryBuilder();
- }
-
- @Override
- public Initialized<L2FibEntry> init(
- @Nonnull final InstanceIdentifier<L2FibEntry> id,
- @Nonnull final L2FibEntry readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(getCfgId(id),
- // Convert operational object to config. VPP does not support setting BVI (see v3po.yang)
- new L2FibEntryBuilder(readValue).setBridgedVirtualInterface(null).build());
- }
-
- static InstanceIdentifier<L2FibEntry> getCfgId(
- final @Nonnull InstanceIdentifier<L2FibEntry> id) {
- return BridgeDomainCustomizer.getCfgId(RWUtils.cutId(id, BridgeDomain.class)).child(
- L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(id.firstKeyOf(L2FibEntry.class)));
- }
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java
deleted file mode 100644
index dfa0f9632..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.translate.v3po.vppstate;
-
-import com.google.common.primitives.UnsignedInts;
-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.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.ShowVersion;
-import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import io.fd.vpp.jvpp.dto.ControlPing;
-import io.fd.vpp.jvpp.dto.ControlPingReply;
-import io.fd.vpp.jvpp.dto.JVppReply;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.Version;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.VersionBuilder;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public final class VersionCustomizer
- extends FutureJVppCustomizer
- implements ReaderCustomizer<Version, VersionBuilder>, ByteDataTranslator, JvppReplyConsumer {
-
- public VersionCustomizer(@Nonnull final FutureJVppCore futureJVppCore) {
- super(futureJVppCore);
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final Version readValue) {
- ((VppStateBuilder) parentBuilder).setVersion(readValue);
- }
-
- @Nonnull
- @Override
- public VersionBuilder getBuilder(@Nonnull InstanceIdentifier<Version> id) {
- return new VersionBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Version> id, @Nonnull final VersionBuilder builder,
- @Nonnull final ReadContext context) throws ReadFailedException {
-
- // Execute with timeout
- final CompletionStage<ShowVersionReply> showVersionFuture = getFutureJVpp().showVersion(new ShowVersion());
- final ShowVersionReply reply = getReplyForRead(showVersionFuture.toCompletableFuture(), id);
-
- builder.setBranch(toString(reply.version));
- builder.setName(toString(reply.program));
- builder.setBuildDate(toString(reply.buildDate));
- builder.setBuildDirectory(toString(reply.buildDirectory));
- builder.setPid(getPid(id));
- }
-
- private Long getPid(@Nonnull final InstanceIdentifier<Version> id) throws ReadFailedException {
- final CompletionStage<JVppReply<ControlPing>> request = getFutureJVpp().send(new ControlPing());
- final ControlPingReply reply = (ControlPingReply)getReplyForRead(request.toCompletableFuture(), id);
- return UnsignedInts.toLong(reply.vpePid);
- }
-
-
-}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/vpp/util/SubInterfaceUtils.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/vpp/util/SubInterfaceUtils.java
deleted file mode 100644
index d27dd1e3e..000000000
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/vpp/util/SubInterfaceUtils.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import java.util.List;
-import javax.annotation.Nonnegative;
-import javax.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Tags;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.tags.Tag;
-
-public final class SubInterfaceUtils {
-
- private SubInterfaceUtils() {
- throw new UnsupportedOperationException("Utility class cannot be instantiated.");
- }
-
- public static String getSubInterfaceName(final String superIfName, final int subIfaceId) {
- return String.format("%s.%d", superIfName, subIfaceId);
- }
-
- /**
- * Returns number of sub-interface tags.
- *
- * @param tags data object that represents sub-interface tags
- * @return number of sub interface tags
- */
- @Nonnegative
- public static int getNumberOfTags(@Nullable final Tags tags) {
- if (tags == null) {
- return 0;
- }
- final List<Tag> tagList = tags.getTag();
- if (tagList == null) {
- return 0;
- }
- return tagList.size();
- }
-}
diff --git a/v3po/v3po2vpp/src/main/resources/honeycomb-minimal-resources/config/v3po.json b/v3po/v3po2vpp/src/main/resources/honeycomb-minimal-resources/config/v3po.json
deleted file mode 100644
index 7a73a41bf..000000000
--- a/v3po/v3po2vpp/src/main/resources/honeycomb-minimal-resources/config/v3po.json
+++ /dev/null
@@ -1,2 +0,0 @@
-{
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/DisabledInterfacesManagerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/DisabledInterfacesManagerTest.java
deleted file mode 100644
index 52a7a5c2d..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/DisabledInterfacesManagerTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.translate.v3po;
-
-
-
-
-import static org.hamcrest.CoreMatchers.hasItems;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.MappingContext;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.context.rev160909.DisabledInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.context.rev160909.DisabledInterfacesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.context.rev160909.disabled.interfaces.DisabledInterfaceIndex;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.context.rev160909.disabled.interfaces.DisabledInterfaceIndexBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.context.rev160909.disabled.interfaces.DisabledInterfaceIndexKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-
-public class DisabledInterfacesManagerTest {
-
- private static final InstanceIdentifier<DisabledInterfaces>
- ROOT_ID = InstanceIdentifier.create(DisabledInterfaces.class);
- private static final KeyedInstanceIdentifier<DisabledInterfaceIndex, DisabledInterfaceIndexKey> SPECIFIC_ID_1 =
- ROOT_ID.child(DisabledInterfaceIndex.class, new DisabledInterfaceIndexKey(1));
- private static final KeyedInstanceIdentifier<DisabledInterfaceIndex, DisabledInterfaceIndexKey> SPECIFIC_ID_4 =
- ROOT_ID.child(DisabledInterfaceIndex.class, new DisabledInterfaceIndexKey(4));
-
- @Mock
- private MappingContext mappingContext;
- private DisabledInterfacesManager manager;
-
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- manager = new DisabledInterfacesManager();
- doReturn(Optional.of(new DisabledInterfacesBuilder().setDisabledInterfaceIndex(toIndices(1, 2, 3)).build()))
- .when(mappingContext)
- .read(ROOT_ID);
- doReturn(Optional.of(toIndex(1)))
- .when(mappingContext)
- .read(SPECIFIC_ID_1);
- doReturn(Optional.absent())
- .when(mappingContext)
- .read(SPECIFIC_ID_4);
- }
-
- @Test
- public void testGetAll() throws Exception {
- final List<Integer> disabledInterfaces = manager.getDisabledInterfaces(mappingContext);
- assertThat(disabledInterfaces, hasItems(1, 2, 3));
- }
-
- @Test
- public void testCheckOne() throws Exception {
- assertTrue(manager.isInterfaceDisabled(1, mappingContext));
- assertFalse(manager.isInterfaceDisabled(4, mappingContext));
- }
-
- @Test
- public void testDisable() throws Exception {
- manager.disableInterface(1, mappingContext);
- verify(mappingContext).put(SPECIFIC_ID_1, toIndex(1));
- }
-
- @Test
- public void testRemoveDisability() throws Exception {
- manager.removeDisabledInterface(1, mappingContext);
- verify(mappingContext).delete(SPECIFIC_ID_1);
- }
-
- private List<DisabledInterfaceIndex> toIndices(final int... indices) {
- return Arrays.stream(indices)
- .mapToObj(this::toIndex)
- .collect(Collectors.toList());
- }
-
- private DisabledInterfaceIndex toIndex(final int idx) {
- return new DisabledInterfaceIndexBuilder()
- .setIndex(idx)
- .build();
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/V3poModuleTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/V3poModuleTest.java
deleted file mode 100644
index 19aa2c98b..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/V3poModuleTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.translate.v3po;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.Matchers.empty;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import com.google.inject.Guice;
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import com.google.inject.testing.fieldbinder.Bind;
-import com.google.inject.testing.fieldbinder.BoundFieldModule;
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
-import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import java.util.HashSet;
-import java.util.Set;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-public class V3poModuleTest {
-
- @Named("honeycomb-context")
- @Bind
- @Mock
- private MappingContext mappingContext;
-
- @Named("honeycomb-initializer")
- @Bind
- @Mock
- private DataBroker honeycombInitializer;
-
- @Named("honeycomb-context")
- @Bind
- @Mock
- private DataBroker honeycombContext;
-
- @Bind
- @Mock
- private FutureJVppCore futureJVppCore;
-
- @Inject
- private Set<ReaderFactory> readerFactories = new HashSet<>();
-
- @Inject
- private Set<WriterFactory> writerFactories = new HashSet<>();
-
- @Before
- public void setUp() {
- initMocks(this);
- Guice.createInjector(new V3poModule(), BoundFieldModule.of(this)).injectMembers(this);
- }
-
- @Test
- public void testReaderFactories() throws Exception {
- assertThat(readerFactories, is(not(empty())));
-
- // Test registration process (all dependencies present, topological order of readers does exist, etc.)
- final CompositeReaderRegistryBuilder registryBuilder = new CompositeReaderRegistryBuilder();
- readerFactories.stream().forEach(factory -> factory.init(registryBuilder));
- assertNotNull(registryBuilder.build());
- }
-
- @Test
- public void testWriterFactories() throws Exception {
- assertThat(writerFactories, is(not(empty())));
-
- // Test registration process (all dependencies present, topological order of writers does exist, etc.)
- final FlatWriterRegistryBuilder registryBuilder = new FlatWriterRegistryBuilder();
- writerFactories.stream().forEach(factory -> factory.init(registryBuilder));
- assertNotNull(registryBuilder.build());
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/AclCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/AclCustomizerTest.java
deleted file mode 100644
index 53ff77927..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/AclCustomizerTest.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static junit.framework.TestCase.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-
-import io.fd.honeycomb.translate.v3po.interfaces.acl.ingress.AclCustomizer;
-import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.InputAclSetInterface;
-import io.fd.vpp.jvpp.core.dto.InputAclSetInterfaceReply;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.L2Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.L2AclBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.acl.Ingress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.acl.IngressBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class AclCustomizerTest extends WriterCustomizerTest {
-
- @Mock
- private VppClassifierContextManager classifyTableContext;
-
- private AclCustomizer customizer;
-
- private static final String IFC_TEST_INSTANCE = "ifc-test-instance";
- private static final String IF_NAME = "local0";
- private static final int IF_INDEX = 1;
-
- private static final int ACL_TABLE_INDEX = 0;
- private static final String ACL_TABLE_NAME = "table0";
-
- @Override
- public void setUp() {
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_TEST_INSTANCE);
- customizer = new AclCustomizer(api, new NamingContext("generatedInterfaceName", IFC_TEST_INSTANCE),
- classifyTableContext);
- }
-
- private InstanceIdentifier<Ingress> getAclId(final String name) {
- return InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(name)).augmentation(
- VppInterfaceAugmentation.class).child(Acl.class).child(Ingress.class);
- }
-
- private Ingress generateAcl(final String tableName) {
- final IngressBuilder builder = new IngressBuilder();
- final L2Acl l2Acl = new L2AclBuilder().setClassifyTable(tableName).build();
- builder.setL2Acl(l2Acl);
- return builder.build();
- }
-
- private void whenInputAclSetInterfaceThenSuccess() {
- doReturn(future(new InputAclSetInterfaceReply())).when(api)
- .inputAclSetInterface(any(InputAclSetInterface.class));
- }
-
- private void whenInputAclSetInterfaceThenFailure() {
- doReturn(failedFuture()).when(api).inputAclSetInterface(any(InputAclSetInterface.class));
- }
-
- private static InputAclSetInterface generateInputAclSetInterface(final byte isAdd, final int ifIndex,
- final int l2TableIndex) {
- final InputAclSetInterface request = new InputAclSetInterface();
- request.isAdd = isAdd;
- request.l2TableIndex = l2TableIndex;
- request.ip4TableIndex = ~0;
- request.ip6TableIndex = ~0;
- request.swIfIndex = ifIndex;
- return request;
- }
-
- @Test
- public void testCreate() throws Exception {
- final Ingress acl = generateAcl(ACL_TABLE_NAME);
- final InstanceIdentifier<Ingress> id = getAclId(IF_NAME);
-
- whenInputAclSetInterfaceThenSuccess();
-
- customizer.writeCurrentAttributes(id, acl, writeContext);
-
- verify(api).inputAclSetInterface(generateInputAclSetInterface((byte) 1, IF_INDEX, ACL_TABLE_INDEX));
- }
-
- @Test
- public void testCreateFailed() throws Exception {
- final Ingress acl = generateAcl(ACL_TABLE_NAME);
- final InstanceIdentifier<Ingress> id = getAclId(IF_NAME);
-
- whenInputAclSetInterfaceThenFailure();
-
- try {
- customizer.writeCurrentAttributes(id, acl, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).inputAclSetInterface(generateInputAclSetInterface((byte) 1, IF_INDEX, ACL_TABLE_INDEX));
- return;
- }
- fail("WriteFailedException.CreateFailedException was expected");
- }
-
- @Test
- public void testDelete() throws Exception {
- final Ingress acl = generateAcl(ACL_TABLE_NAME);
- final InstanceIdentifier<Ingress> id = getAclId(IF_NAME);
-
- whenInputAclSetInterfaceThenSuccess();
-
- customizer.deleteCurrentAttributes(id, acl, writeContext);
-
- verify(api).inputAclSetInterface(generateInputAclSetInterface((byte) 0, IF_INDEX, ACL_TABLE_INDEX));
- }
-
- @Test
- public void testDeleteFailed() throws Exception {
- final Ingress acl = generateAcl(ACL_TABLE_NAME);
- final InstanceIdentifier<Ingress> id = getAclId(IF_NAME);
-
- whenInputAclSetInterfaceThenFailure();
-
- try {
- customizer.deleteCurrentAttributes(id, acl, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).inputAclSetInterface(generateInputAclSetInterface((byte) 0, IF_INDEX, ACL_TABLE_INDEX));
- return;
- }
- fail("WriteFailedException.DeleteFailedException was expected");
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/GreCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/GreCustomizerTest.java
deleted file mode 100644
index ee0d8fc23..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/GreCustomizerTest.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import com.google.common.net.InetAddresses;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-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.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Gre;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.GreBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.VppInvocationException;
-import io.fd.vpp.jvpp.core.dto.GreAddDelTunnel;
-import io.fd.vpp.jvpp.core.dto.GreAddDelTunnelReply;
-
-public class GreCustomizerTest extends WriterCustomizerTest {
-
- private static final String IFC_TEST_INSTANCE = "ifc-test-instance";
- private final String IFACE_NAME = "eth0";
- private final int IFACE_ID = 1;
- private InstanceIdentifier<Gre> id = InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IFACE_NAME))
- .augmentation(VppInterfaceAugmentation.class).child(Gre.class);
- private static final byte ADD_GRE = 1;
- private static final byte DEL_GRE = 0;
-
- private GreCustomizer customizer;
-
- @Override
- public void setUp() throws Exception {
- InterfaceTypeTestUtils.setupWriteContext(writeContext,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.GreTunnel.class);
- customizer = new GreCustomizer(api, new NamingContext("generateInterfaceNAme", IFC_TEST_INSTANCE));
- }
-
- private void whenGreAddDelTunnelThenSuccess() {
- final GreAddDelTunnelReply reply = new GreAddDelTunnelReply();
- reply.swIfIndex = IFACE_ID;
- doReturn(future(reply)).when(api).greAddDelTunnel(any(GreAddDelTunnel.class));
- }
-
- private void whenGreAddDelTunnelThenFailure() {
- doReturn(failedFuture()).when(api).greAddDelTunnel(any(GreAddDelTunnel.class));
- }
-
- private GreAddDelTunnel verifyGreAddDelTunnelWasInvoked(final Gre gre) throws VppInvocationException {
- ArgumentCaptor<GreAddDelTunnel> argumentCaptor = ArgumentCaptor.forClass(GreAddDelTunnel.class);
- verify(api).greAddDelTunnel(argumentCaptor.capture());
- final GreAddDelTunnel actual = argumentCaptor.getValue();
- assertEquals(0, actual.isIpv6);
- assertArrayEquals(InetAddresses.forString(gre.getSrc().getIpv4Address().getValue()).getAddress(),
- actual.srcAddress);
- assertArrayEquals(InetAddresses.forString(gre.getDst().getIpv4Address().getValue()).getAddress(),
- actual.dstAddress);
- assertEquals(gre.getOuterFibId().intValue(), actual.outerFibId);
- return actual;
- }
-
- private void verifyGreAddWasInvoked(final Gre gre) throws VppInvocationException {
- final GreAddDelTunnel actual = verifyGreAddDelTunnelWasInvoked(gre);
- assertEquals(ADD_GRE, actual.isAdd);
- }
-
- private void verifyGreDeleteWasInvoked(final Gre gre) throws VppInvocationException {
- final GreAddDelTunnel actual = verifyGreAddDelTunnelWasInvoked(gre);
- assertEquals(DEL_GRE, actual.isAdd);
- }
-
- private static Gre generateGre() {
- final GreBuilder builder = new GreBuilder();
- builder.setSrc(new IpAddress(new Ipv4Address("192.168.20.10")));
- builder.setDst(new IpAddress(new Ipv4Address("192.168.20.11")));
- builder.setOuterFibId(Long.valueOf(123));
- return builder.build();
- }
-
- @Test
- public void testWriteCurrentAttributes() throws Exception {
- final Gre gre = generateGre();
-
- whenGreAddDelTunnelThenSuccess();
-
- noMappingDefined(mappingContext, IFACE_NAME, IFC_TEST_INSTANCE);
-
- customizer.writeCurrentAttributes(id, gre, writeContext);
- verifyGreAddWasInvoked(gre);
- verify(mappingContext).put(eq(mappingIid(IFACE_NAME, IFC_TEST_INSTANCE)),
- eq(mapping(IFACE_NAME, IFACE_ID).get()));
- }
-
- @Test
- public void testWriteCurrentAttributesMappingAlreadyPresent() throws Exception {
- final Gre gre = generateGre();
-
- whenGreAddDelTunnelThenSuccess();
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_TEST_INSTANCE);
-
- customizer.writeCurrentAttributes(id, gre, writeContext);
- verifyGreAddWasInvoked(gre);
-
- // Remove the first mapping before putting in the new one
- verify(mappingContext).delete(eq(mappingIid(IFACE_NAME, IFC_TEST_INSTANCE)));
- verify(mappingContext).put(eq(mappingIid(IFACE_NAME, IFC_TEST_INSTANCE)), eq(mapping(IFACE_NAME, IFACE_ID).get()));
- }
-
- @Test
- public void testWriteCurrentAttributesFailed() throws Exception {
- final Gre gre = generateGre();
-
- whenGreAddDelTunnelThenFailure();
-
- try {
- customizer.writeCurrentAttributes(id, gre, writeContext);
- } catch (WriteFailedException.CreateFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verifyGreAddWasInvoked(gre);
- // Mapping not stored due to failure
- verify(mappingContext, times(0)).put(eq(mappingIid(IFACE_NAME, IFC_TEST_INSTANCE)), eq(mapping(
- IFACE_NAME, 0).get()));
- return;
- }
- fail("WriteFailedException.CreateFailedException was expected");
- }
-
- @Test
- public void testUpdateCurrentAttributes() throws Exception {
- try {
- customizer.updateCurrentAttributes(id, generateGre(), generateGre(), writeContext);
- } catch (WriteFailedException.UpdateFailedException e) {
- assertEquals(UnsupportedOperationException.class, e.getCause().getClass());
- return;
- }
- fail("WriteFailedException.UpdateFailedException was expected");
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws Exception {
- final Gre gre = generateGre();
-
- whenGreAddDelTunnelThenSuccess();
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_TEST_INSTANCE);
-
- customizer.deleteCurrentAttributes(id, gre, writeContext);
- verifyGreDeleteWasInvoked(gre);
- verify(mappingContext).delete(eq(mappingIid(IFACE_NAME, IFC_TEST_INSTANCE)));
- }
-
- @Test
- public void testDeleteCurrentAttributesaFailed() throws Exception {
- final Gre gre = generateGre();
-
- whenGreAddDelTunnelThenFailure();
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_TEST_INSTANCE);
-
- try {
- customizer.deleteCurrentAttributes(id, gre, writeContext);
- } catch (WriteFailedException.DeleteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verifyGreDeleteWasInvoked(gre);
- verify(mappingContext, times(0)).delete(eq(mappingIid(IFACE_NAME, IFC_TEST_INSTANCE)));
- return;
- }
- fail("WriteFailedException.DeleteFailedException was expected");
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceCustomizerTest.java
deleted file mode 100644
index 56abe58f6..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceCustomizerTest.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlags;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsReply;
-
-public class InterfaceCustomizerTest extends WriterCustomizerTest implements ByteDataTranslator {
- private static final String IFACE_CTX_NAME = "interface-ctx";
- private static final String IF_NAME = "eth1";
- private static final int IF_INDEX = 1;
-
- private InterfaceCustomizer customizer;
- private InstanceIdentifier<Interface> IID =
- InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IF_NAME));
-
- @Override
- protected void setUp() throws Exception {
- customizer = new InterfaceCustomizer(api, new NamingContext("ifacePrefix", IFACE_CTX_NAME));
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFACE_CTX_NAME);
- }
-
- @Test
- public void testWrite() throws WriteFailedException {
- final boolean enabled = true;
- when(api.swInterfaceSetFlags(any())).thenReturn(future(new SwInterfaceSetFlagsReply()));
- customizer.writeCurrentAttributes(IID, iface(enabled), writeContext);
- verify(api).swInterfaceSetFlags(expectedRequest(enabled));
- }
-
- @Test
- public void testWriteFailed() {
- final boolean enabled = false;
- when(api.swInterfaceSetFlags(any())).thenReturn(failedFuture());
- try {
- customizer.writeCurrentAttributes(IID, iface(enabled), writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).swInterfaceSetFlags(expectedRequest(enabled));
- return;
- }
- fail("WriteFailedException expected");
- }
-
- @Test
- public void testUpdate() throws WriteFailedException {
- when(api.swInterfaceSetFlags(any())).thenReturn(future(new SwInterfaceSetFlagsReply()));
- customizer.updateCurrentAttributes(IID, iface(false), iface(true), writeContext);
- verify(api).swInterfaceSetFlags(expectedRequest(true));
- }
-
- @Test
- public void testUpdateFailed() {
- when(api.swInterfaceSetFlags(any())).thenReturn(failedFuture());
- try {
- customizer.updateCurrentAttributes(IID, iface(false), iface(true), writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).swInterfaceSetFlags(expectedRequest(true));
- return;
- }
- fail("WriteFailedException expected");
- }
-
- @Test
- public void testDelete() throws WriteFailedException {
- customizer.deleteCurrentAttributes(IID, mock(Interface.class), writeContext);
- verifyZeroInteractions(api);
- }
-
- private Interface iface(final boolean enabled) {
- return new InterfaceBuilder().setName(IF_NAME).setEnabled(enabled).build();
- }
-
- private SwInterfaceSetFlags expectedRequest(final boolean enabled) {
- final SwInterfaceSetFlags request = new SwInterfaceSetFlags();
- request.deleted = 0;
- request.adminUpDown = booleanToByte(enabled);
- request.linkUpDown = booleanToByte(enabled);
- request.swIfIndex = IF_INDEX;
- return request;
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceTypeTestUtils.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceTypeTestUtils.java
deleted file mode 100644
index 9ff5b1b2d..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceTypeTestUtils.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static org.mockito.Mockito.doReturn;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.ModificationCache;
-import io.fd.honeycomb.translate.write.WriteContext;
-import org.mockito.Matchers;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-final class InterfaceTypeTestUtils {
-
- private InterfaceTypeTestUtils() {}
-
- static void setupWriteContext(final WriteContext writeContext, final Class<? extends InterfaceType> ifcType) {
- doReturn(new ModificationCache()).when(writeContext).getModificationCache();
- doReturn(Optional.of(new InterfaceBuilder()
- .setType(ifcType)
- .build())).when(writeContext).readAfter(Matchers.any(InstanceIdentifier.class));
- }
-
-}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/L2CustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/L2CustomizerTest.java
deleted file mode 100644
index ec33295e2..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/L2CustomizerTest.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.L2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.L2Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.Interconnection;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.interconnection.BridgeBased;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.interconnection.BridgeBasedBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.interconnection.XconnectBased;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.interconnection.XconnectBasedBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetL2Bridge;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetL2BridgeReply;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetL2Xconnect;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetL2XconnectReply;
-
-public class L2CustomizerTest extends WriterCustomizerTest implements ByteDataTranslator {
- private static final String IFACE_CTX_NAME = "interface-ctx";
- private static final String BD_CTX_NAME = "bd-ctx";
- private static final String IF1_NAME = "eth1";
- private static final int IF1_INDEX = 1;
- private static final String IF2_NAME = "eth2";
- private static final int IF2_INDEX = 2;
- private static final InstanceIdentifier<L2> IID =
- InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IF1_NAME))
- .augmentation(VppInterfaceAugmentation.class).child(L2.class);
- private static final String BD_NAME = "test_bd";
- private static final int BD_INDEX = 13;
-
- private L2Customizer customizer;
-
- @Override
- protected void setUp() throws Exception {
- customizer = new L2Customizer(api, new NamingContext("ifacePrefix", IFACE_CTX_NAME),
- new NamingContext("bdPrefix", BD_CTX_NAME));
- defineMapping(mappingContext, IF1_NAME, IF1_INDEX, IFACE_CTX_NAME);
- defineMapping(mappingContext, IF2_NAME, IF2_INDEX, IFACE_CTX_NAME);
- defineMapping(mappingContext, BD_NAME, BD_INDEX, BD_CTX_NAME);
- }
-
- @Test
- public void testWrite() throws WriteFailedException {
- when(api.swInterfaceSetL2Xconnect(any())).thenReturn(future(new SwInterfaceSetL2XconnectReply()));
- customizer.writeCurrentAttributes(IID, l2(xconnectBased()), writeContext);
- verify(api).swInterfaceSetL2Xconnect(xconnectRequest(true));
- }
-
- @Test
- public void testWriteFailed() {
- when(api.swInterfaceSetL2Bridge(any())).thenReturn(failedFuture());
- try {
- customizer.writeCurrentAttributes(IID, l2(bridgeBased(false)), writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).swInterfaceSetL2Bridge(bridgeRequest(false, true));
- return;
- }
- fail("WriteFailedException expected");
- }
-
- @Test
- public void testUpdate() throws WriteFailedException {
- when(api.swInterfaceSetL2Bridge(any())).thenReturn(future(new SwInterfaceSetL2BridgeReply()));
- customizer.updateCurrentAttributes(IID, l2(bridgeBased(false)), l2(bridgeBased(true)), writeContext);
- verify(api).swInterfaceSetL2Bridge(bridgeRequest(true, true));
- }
-
- @Test
- public void testDelete() throws WriteFailedException {
- when(api.swInterfaceSetL2Xconnect(any())).thenReturn(future(new SwInterfaceSetL2XconnectReply()));
- customizer.deleteCurrentAttributes(IID, l2(xconnectBased()), writeContext);
- verify(api).swInterfaceSetL2Xconnect(xconnectRequest(false));
- }
-
- @Test
- public void testDeleteFailed() {
- when(api.swInterfaceSetL2Bridge(any())).thenReturn(failedFuture());
- try {
- customizer.deleteCurrentAttributes(IID, l2(bridgeBased(true)), writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).swInterfaceSetL2Bridge(bridgeRequest(true, false));
- return;
- }
- fail("WriteFailedException expected");
- }
-
- private XconnectBased xconnectBased() {
- return new XconnectBasedBuilder().setXconnectOutgoingInterface(IF2_NAME).build();
- }
-
- private SwInterfaceSetL2Xconnect xconnectRequest(final boolean enable) {
- final SwInterfaceSetL2Xconnect request = new SwInterfaceSetL2Xconnect();
- request.rxSwIfIndex = IF1_INDEX;
- request.txSwIfIndex = IF2_INDEX;
- request.enable = booleanToByte(enable);
- return request;
- }
-
- private BridgeBased bridgeBased(final boolean bvi) {
- return new BridgeBasedBuilder().setBridgedVirtualInterface(bvi)
- .setBridgeDomain(BD_NAME).setSplitHorizonGroup((short) 123).build();
- }
-
- private SwInterfaceSetL2Bridge bridgeRequest(final boolean bvi, final boolean enable) {
- final SwInterfaceSetL2Bridge request = new SwInterfaceSetL2Bridge();
- request.bdId = BD_INDEX;
- request.rxSwIfIndex = IF1_INDEX;
- request.bvi = booleanToByte(bvi);
- request.enable = booleanToByte(enable);
- request.shg = 123;
- return request;
- }
-
-
- private L2 l2(final Interconnection interconnection) {
- return new L2Builder().setInterconnection(interconnection).build();
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/LoopbackCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/LoopbackCustomizerTest.java
deleted file mode 100644
index 60af7a143..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/LoopbackCustomizerTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.CreateLoopback;
-import io.fd.vpp.jvpp.core.dto.CreateLoopbackReply;
-import io.fd.vpp.jvpp.core.dto.DeleteLoopback;
-import io.fd.vpp.jvpp.core.dto.DeleteLoopbackReply;
-import org.junit.Test;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Loopback;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.LoopbackBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class LoopbackCustomizerTest extends WriterCustomizerTest {
-
- private static final String IFC_TEST_INSTANCE = "ifc-test-instance";
- private LoopbackCustomizer loopCustomizer;
-
- @Override
- public void setUp() throws Exception {
- InterfaceTypeTestUtils.setupWriteContext(writeContext,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.Loopback.class);
- loopCustomizer = new LoopbackCustomizer(api, new NamingContext("ifcintest", IFC_TEST_INSTANCE));
- }
-
- @Test
- public void testCreate() throws Exception {
- doAnswer(new Answer() {
-
- int idx = 0;
-
- @Override
- public Object answer(final InvocationOnMock invocation) throws Throwable {
- final CreateLoopbackReply t = new CreateLoopbackReply();
- t.swIfIndex = idx++;
- return future(t);
- }
- }).when(api).createLoopback(any(CreateLoopback.class));
-
- loopCustomizer.writeCurrentAttributes(getLoopbackId("loop"), getLoopbackData("ff:ff:ff:ff:ff:ff"), writeContext);
- loopCustomizer.writeCurrentAttributes(getLoopbackId("loop2"), getLoopbackData("ff:ff:ff:ff:ff:ff"), writeContext);
-
- verify(api, times(2)).createLoopback(any(CreateLoopback.class));
- verify(mappingContext).put(eq(mappingIid("loop", IFC_TEST_INSTANCE)), eq(
- mapping("loop", 0).get()));
- verify(mappingContext).put(eq(mappingIid("loop2", IFC_TEST_INSTANCE)), eq(
- mapping("loop2", 1).get()));
- }
-
- @Test
- public void testDelete() throws Exception {
- final CreateLoopbackReply t = new CreateLoopbackReply();
- t.swIfIndex = 0;
- doReturn(future(t)).when(api).createLoopback(any(CreateLoopback.class));
-
- doReturn(future(new DeleteLoopbackReply())).when(api).deleteLoopback(any(DeleteLoopback.class));
-
- loopCustomizer.writeCurrentAttributes(getLoopbackId("loop"), getLoopbackData("ff:ff:ff:ff:ff:ff"), writeContext);
- defineMapping(mappingContext, "loop", 1, IFC_TEST_INSTANCE);
- loopCustomizer.deleteCurrentAttributes(getLoopbackId("loop"), getLoopbackData("ff:ff:ff:ff:ff:ff"), writeContext);
-
- verify(api).createLoopback(any(CreateLoopback.class));
- verify(api).deleteLoopback(any(DeleteLoopback.class));
- verify(mappingContext).delete(eq(mappingIid("loop", IFC_TEST_INSTANCE)));
- }
-
- private InstanceIdentifier<Loopback> getLoopbackId(final String loop) {
- return InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(loop)).augmentation(
- VppInterfaceAugmentation.class).child(Loopback.class);
- }
-
- private Loopback getLoopbackData(final String mac) {
- return new LoopbackBuilder().setMac(new PhysAddress(mac)).build();
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ProxyArpCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ProxyArpCustomizerTest.java
deleted file mode 100644
index 922d072a4..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ProxyArpCustomizerTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import org.junit.Test;
-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.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ProxyArp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ProxyArpBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.ProxyArpAddDel;
-import io.fd.vpp.jvpp.core.dto.ProxyArpAddDelReply;
-
-public class ProxyArpCustomizerTest extends WriterCustomizerTest implements ByteDataTranslator {
- private static final String IF_NAME = "eth1";
-
- private ProxyArpCustomizer customizer;
-
- @Override
- public void setUp() throws Exception {
- customizer = new ProxyArpCustomizer(api);
- }
-
- @Test
- public void testWrite() throws WriteFailedException {
- when(api.proxyArpAddDel(any())).thenReturn(future(new ProxyArpAddDelReply()));
- customizer.writeCurrentAttributes(getProxyArpId(IF_NAME), proxyArp(), writeContext);
- verify(api).proxyArpAddDel(expectedRequest(true));
- }
-
- @Test(expected = WriteFailedException.class)
- public void testWriteFailed() throws WriteFailedException {
- when(api.proxyArpAddDel(any())).thenReturn(failedFuture());
- customizer.writeCurrentAttributes(getProxyArpId(IF_NAME), proxyArp(), writeContext);
- }
-
- @Test(expected = WriteFailedException.UpdateFailedException.class)
- public void testUpdate() throws WriteFailedException.UpdateFailedException {
- customizer.updateCurrentAttributes(getProxyArpId(IF_NAME), proxyArp(), proxyArp(), writeContext);
- }
-
- @Test
- public void testDelete() throws WriteFailedException {
- when(api.proxyArpAddDel(any())).thenReturn(future(new ProxyArpAddDelReply()));
- customizer.deleteCurrentAttributes(getProxyArpId(IF_NAME), proxyArp(), writeContext);
- verify(api).proxyArpAddDel(expectedRequest(false));
- }
-
- @Test(expected = WriteFailedException.DeleteFailedException.class)
- public void testDeleteFailed() throws WriteFailedException {
- when(api.proxyArpAddDel(any())).thenReturn(failedFuture());
- customizer.deleteCurrentAttributes(getProxyArpId(IF_NAME), proxyArp(), writeContext);
- }
-
- private ProxyArp proxyArp() {
- return new ProxyArpBuilder().setVrfId(123L).setHighAddr(new Ipv4AddressNoZone("10.1.1.2"))
- .setLowAddr(new Ipv4AddressNoZone("10.1.1.1")).build();
- }
-
- private ProxyArpAddDel expectedRequest(final boolean isAdd) {
- final ProxyArpAddDel request = new ProxyArpAddDel();
- request.isAdd = booleanToByte(isAdd);
- request.vrfId = 123;
- request.lowAddress = new byte[]{10,1,1,1};
- request.hiAddress = new byte[]{10,1,1,2};
- return request;
- }
-
- private InstanceIdentifier<ProxyArp> getProxyArpId(final String eth0) {
- return InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(eth0)).augmentation(
- VppInterfaceAugmentation.class).child(ProxyArp.class);
- }
-}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizerTest.java
deleted file mode 100644
index 035a0f2d5..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizerTest.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static junit.framework.TestCase.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.TagRewriteOperation;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.VppInvocationException;
-import io.fd.vpp.jvpp.core.dto.L2InterfaceVlanTagRewrite;
-import io.fd.vpp.jvpp.core.dto.L2InterfaceVlanTagRewriteReply;
-import org.junit.Assert;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214._802dot1q;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.SubInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.l2.Rewrite;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.l2.RewriteBuilder;
-import org.opendaylight.yangtools.yang.binding.ChildOf;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class RewriteCustomizerTest extends WriterCustomizerTest {
-
- private NamingContext namingContext;
- private RewriteCustomizer customizer;
-
- private static final String IFC_TEST_INSTANCE = "ifc-test-instance";
- private static final String IF_NAME = "local0";
- private static final String VLAN_IF_NAME = "local0.1";
- private static final int VLAN_IF_ID = 1;
- private static final int VLAN_IF_INDEX = 11;
- private InstanceIdentifier<Rewrite> VLAN_IID;
-
- @Override
- public void setUp() throws Exception {
- namingContext = new NamingContext("generatedSubInterfaceName", IFC_TEST_INSTANCE);
- customizer = new RewriteCustomizer(api, namingContext);
- VLAN_IID = getVlanTagRewriteId(IF_NAME, VLAN_IF_ID);
- defineMapping(mappingContext, VLAN_IF_NAME, VLAN_IF_INDEX, IFC_TEST_INSTANCE);
- }
-
- private static InstanceIdentifier<Rewrite> getVlanTagRewriteId(final String name, final long index) {
- final Class<ChildOf<? super SubInterface>> child = (Class) Rewrite.class;
- final InstanceIdentifier id =
- InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(name)).augmentation(
- SubinterfaceAugmentation.class).child(SubInterfaces.class)
- .child(SubInterface.class, new SubInterfaceKey(index))
- .child(child);
- return id;
- }
-
- private Rewrite generateRewrite(final TagRewriteOperation op) {
- final RewriteBuilder builder = new RewriteBuilder();
- builder.setPopTags((short) op.getPopTags());
- builder.setVlanType(_802dot1q.class);
- return builder.build();
- }
-
- private L2InterfaceVlanTagRewrite generateL2InterfaceVlanTagRewrite(final int swIfIndex,
- final TagRewriteOperation op) {
- final L2InterfaceVlanTagRewrite request = new L2InterfaceVlanTagRewrite();
- request.swIfIndex = swIfIndex;
- request.vtrOp = op.ordinal();
- request.pushDot1Q = 1;
- return request;
- }
-
- /**
- * Positive response
- */
- private void whenL2InterfaceVlanTagRewriteThenSuccess() {
- doReturn(future(new L2InterfaceVlanTagRewriteReply())).when(api)
- .l2InterfaceVlanTagRewrite(any(L2InterfaceVlanTagRewrite.class));
- }
-
- /**
- * Failure response send
- */
- private void whenL2InterfaceVlanTagRewriteThenFailure() {
- doReturn(failedFuture()).when(api).l2InterfaceVlanTagRewrite(any(L2InterfaceVlanTagRewrite.class));
- }
-
- private void verifyL2InterfaceVlanTagRewriteDeleteWasInvoked() throws VppInvocationException {
- final L2InterfaceVlanTagRewrite request = new L2InterfaceVlanTagRewrite();
- request.swIfIndex = VLAN_IF_INDEX;
- verify(api).l2InterfaceVlanTagRewrite(request);
- }
-
- @Test
- public void testCreate() throws Exception {
- final TagRewriteOperation op = TagRewriteOperation.pop_2;
- final Rewrite vlanTagRewrite = generateRewrite(op);
-
- whenL2InterfaceVlanTagRewriteThenSuccess();
-
- customizer.writeCurrentAttributes(VLAN_IID, vlanTagRewrite, writeContext);
-
- verify(api).l2InterfaceVlanTagRewrite(generateL2InterfaceVlanTagRewrite(VLAN_IF_INDEX, op));
- }
-
- @Test
- public void testCreateFailed() throws Exception {
- final TagRewriteOperation op = TagRewriteOperation.pop_2;
- final Rewrite vlanTagRewrite = generateRewrite(op);
-
- whenL2InterfaceVlanTagRewriteThenFailure();
-
- try {
- customizer.writeCurrentAttributes(VLAN_IID, vlanTagRewrite, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).l2InterfaceVlanTagRewrite(generateL2InterfaceVlanTagRewrite(VLAN_IF_INDEX, op));
- return;
- }
- fail("WriteFailedException.CreateFailedException was expected");
- }
-
- @Test
- public void testUpdate() throws Exception {
- final Rewrite before = generateRewrite(TagRewriteOperation.pop_2);
- final Rewrite after = generateRewrite(TagRewriteOperation.pop_1);
-
- whenL2InterfaceVlanTagRewriteThenSuccess();
-
- customizer.updateCurrentAttributes(VLAN_IID, before, after, writeContext);
-
- verify(api)
- .l2InterfaceVlanTagRewrite(generateL2InterfaceVlanTagRewrite(VLAN_IF_INDEX, TagRewriteOperation.pop_1));
- }
-
- @Test
- public void testUpdateFailed() throws Exception {
- final Rewrite before = generateRewrite(TagRewriteOperation.pop_2);
- final Rewrite after = generateRewrite(TagRewriteOperation.pop_1);
-
- whenL2InterfaceVlanTagRewriteThenFailure();
-
- try {
- customizer.updateCurrentAttributes(VLAN_IID, before, after, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api)
- .l2InterfaceVlanTagRewrite(
- generateL2InterfaceVlanTagRewrite(VLAN_IF_INDEX, TagRewriteOperation.pop_1));
- return;
- }
- fail("WriteFailedException.UpdateFailedException was expected");
- }
-
- @Test
- public void testDelete() throws Exception {
- whenL2InterfaceVlanTagRewriteThenSuccess();
-
- customizer.deleteCurrentAttributes(VLAN_IID, null, writeContext);
-
- verifyL2InterfaceVlanTagRewriteDeleteWasInvoked();
- }
-
- @Test
- public void testDeleteFailed() throws Exception {
- whenL2InterfaceVlanTagRewriteThenFailure();
-
- try {
- customizer.deleteCurrentAttributes(VLAN_IID, null, writeContext);
- } catch (WriteFailedException e) {
- Assert.assertTrue(e.getCause() instanceof VppBaseCallException);
- verifyL2InterfaceVlanTagRewriteDeleteWasInvoked();
- return;
- }
- fail("WriteFailedException.DeleteFailedException was expected");
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizerTest.java
deleted file mode 100644
index a6a0b48f0..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizerTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetTable;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetTableReply;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Routing;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.RoutingBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class RoutingCustomizerTest extends WriterCustomizerTest {
- private static final String IFACE_CTX_NAME = "interface-ctx";
- private static final String IF_NAME = "eth1";
- private static final int IF_INDEX = 1;
- private static final InstanceIdentifier<Routing> IID =
- InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IF_NAME))
- .augmentation(VppInterfaceAugmentation.class).child(Routing.class);
-
- private RoutingCustomizer customizer;
-
- @Override
- protected void setUp() throws Exception {
- customizer = new RoutingCustomizer(api, new NamingContext("ifacePrefix", IFACE_CTX_NAME));
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFACE_CTX_NAME);
- }
-
- @Test
- public void testWrite() throws WriteFailedException {
- final int vrfId = 123;
- when(api.swInterfaceSetTable(any())).thenReturn(future(new SwInterfaceSetTableReply()));
- customizer.writeCurrentAttributes(IID, routing(vrfId), writeContext);
- verify(api).swInterfaceSetTable(expectedRequest(vrfId));
- }
-
- @Test(expected = WriteFailedException.class)
- public void testWriteFailed() throws WriteFailedException {
- when(api.swInterfaceSetTable(any())).thenReturn(failedFuture());
- customizer.writeCurrentAttributes(IID, routing(213), writeContext);
- }
-
- @Test(expected = WriteFailedException.class)
- public void testUpdateFailed() throws WriteFailedException {
- when(api.swInterfaceSetTable(any())).thenReturn(failedFuture());
- customizer.updateCurrentAttributes(IID, routing(123L), routing(321L), writeContext);
- }
-
- @Test
- public void testDelete() throws WriteFailedException {
- when(api.swInterfaceSetTable(any())).thenReturn(future(new SwInterfaceSetTableReply()));
- customizer.deleteCurrentAttributes(IID, routing(123), writeContext);
- verify(api).swInterfaceSetTable(expectedRequest(0));
- }
-
- @Test(expected = WriteFailedException.DeleteFailedException.class)
- public void testDeleteFailed() throws WriteFailedException {
- when(api.swInterfaceSetTable(any())).thenReturn(failedFuture());
- customizer.deleteCurrentAttributes(IID, routing(123), writeContext);
- }
-
- private Routing routing(final long vrfId) {
- return new RoutingBuilder().setIpv4VrfId(vrfId).build();
- }
-
- private SwInterfaceSetTable expectedRequest(final int vrfId) {
- final SwInterfaceSetTable request = new SwInterfaceSetTable();
- request.isIpv6 = 0;
- request.swIfIndex = IF_INDEX;
- request.vrfId = vrfId;
- return request;
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizerTest.java
deleted file mode 100644
index bcf3cad6d..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizerTest.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import java.util.Arrays;
-import java.util.List;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.CVlan;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.Dot1qTagVlanType;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.Dot1qVlanId;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.SVlan;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.or.any.Dot1qTag;
-import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.or.any.Dot1qTagBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214._802dot1ad;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.SubInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterfaceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.match.attributes.match.type.vlan.tagged.VlanTaggedBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Match;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.TagsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.tags.Tag;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.tags.TagBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.tags.TagKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.CreateSubif;
-import io.fd.vpp.jvpp.core.dto.CreateSubifReply;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlags;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsReply;
-
-public class SubInterfaceCustomizerTest extends WriterCustomizerTest {
-
- private NamingContext namingContext;
- private SubInterfaceCustomizer customizer;
-
- private static final String IFC_TEST_INSTANCE = "ifc-test-instance";
- private static final String SUPER_IF_NAME = "local0";
- private static final int SUPER_IF_ID = 1;
- private static final String SUB_IFACE_NAME = "local0.11";
- private static final int SUBIF_INDEX = 11;
-
- private static final short STAG_ID = 100;
- private static final short CTAG_ID = 200;
- private static final short CTAG_ANY_ID = 0; // only the *IdAny flag is set
-
- private final Tag STAG_100;
- private final Tag CTAG_200;
- private final Tag CTAG_ANY;
-
- public SubInterfaceCustomizerTest() {
- STAG_100 = generateTag((short) 0, SVlan.class, new Dot1qTag.VlanId(new Dot1qVlanId((int) STAG_ID)));
- CTAG_200 = generateTag((short) 1, CVlan.class, new Dot1qTag.VlanId(new Dot1qVlanId(200)));
- CTAG_ANY = generateTag((short) 1, CVlan.class, new Dot1qTag.VlanId(Dot1qTag.VlanId.Enumeration.Any));
- }
-
- @Override
- public void setUp() throws Exception {
- namingContext = new NamingContext("generatedSubInterfaceName", IFC_TEST_INSTANCE);
- customizer = new SubInterfaceCustomizer(api, namingContext);
- defineMapping(mappingContext, SUB_IFACE_NAME, SUBIF_INDEX, IFC_TEST_INSTANCE);
- defineMapping(mappingContext, SUPER_IF_NAME, SUPER_IF_ID, IFC_TEST_INSTANCE);
- }
-
- private SubInterface generateSubInterface(final boolean enabled, final List<Tag> tagList) {
- SubInterfaceBuilder builder = new SubInterfaceBuilder();
- builder.setVlanType(_802dot1ad.class);
- builder.setIdentifier(11L);
- final TagsBuilder tags = new TagsBuilder();
-
- tags.setTag(tagList);
-
- builder.setTags(tags.build());
-
- builder.setMatch(generateMatch());
- builder.setEnabled(enabled);
- return builder.build();
- }
-
- private static Tag generateTag(final short index, final Class<? extends Dot1qTagVlanType> tagType,
- final Dot1qTag.VlanId vlanId) {
- TagBuilder tag = new TagBuilder();
- tag.setIndex(index);
- tag.setKey(new TagKey(index));
- final Dot1qTagBuilder dtag = new Dot1qTagBuilder();
- dtag.setTagType(tagType);
- dtag.setVlanId(vlanId);
- tag.setDot1qTag(dtag.build());
- return tag.build();
- }
-
- private static Match generateMatch() {
- final MatchBuilder match = new MatchBuilder();
- final VlanTaggedBuilder tagged = new VlanTaggedBuilder();
- tagged.setMatchExactTags(true);
- match.setMatchType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.match.attributes.match.type.VlanTaggedBuilder()
- .setVlanTagged(tagged.build()).build());
- return match.build();
- }
-
- private CreateSubif generateSubInterfaceRequest(final int superIfId, final short innerVlanId,
- final boolean isInnerAny) {
- CreateSubif request = new CreateSubif();
- request.subId = 11;
- request.swIfIndex = superIfId;
- request.twoTags = 1;
- request.innerVlanId = innerVlanId;
- request.innerVlanIdAny = (byte) (isInnerAny
- ? 1
- : 0);
- request.dot1Ad = 1;
- request.outerVlanId = STAG_ID;
- return request;
- }
-
- private SwInterfaceSetFlags generateSwInterfaceEnableRequest(final int swIfIndex) {
- SwInterfaceSetFlags request = new SwInterfaceSetFlags();
- request.swIfIndex = swIfIndex;
- request.adminUpDown = 1;
- return request;
- }
-
- private InstanceIdentifier<SubInterface> getSubInterfaceId(final String name, final long index) {
- return InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(name)).augmentation(
- SubinterfaceAugmentation.class).child(SubInterfaces.class)
- .child(SubInterface.class, new SubInterfaceKey(index));
- }
-
- private void whenCreateSubifThenSuccess() {
- doReturn(future(new CreateSubifReply())).when(api).createSubif(any(CreateSubif.class));
- }
-
- /**
- * Failure response send
- */
- private void whenCreateSubifThenFailure() {
- doReturn(failedFuture()).when(api).createSubif(any(CreateSubif.class));
- }
-
- private void whenSwInterfaceSetFlagsThenSuccess() {
- doReturn(future(new SwInterfaceSetFlagsReply())).when(api).swInterfaceSetFlags(any(SwInterfaceSetFlags.class));
- }
-
- private SwInterfaceSetFlags verifySwInterfaceSetFlagsWasInvoked(final SwInterfaceSetFlags expected)
- throws VppBaseCallException {
- ArgumentCaptor<SwInterfaceSetFlags> argumentCaptor = ArgumentCaptor.forClass(SwInterfaceSetFlags.class);
- verify(api).swInterfaceSetFlags(argumentCaptor.capture());
- final SwInterfaceSetFlags actual = argumentCaptor.getValue();
-
- assertEquals(expected.swIfIndex, actual.swIfIndex);
- assertEquals(expected.adminUpDown, actual.adminUpDown);
- return actual;
- }
-
- @Test
- public void testCreateTwoTags() throws Exception {
- final SubInterface subInterface = generateSubInterface(false, Arrays.asList(STAG_100, CTAG_200));
- final InstanceIdentifier<SubInterface> id = getSubInterfaceId(SUPER_IF_NAME, SUBIF_INDEX);
-
- whenCreateSubifThenSuccess();
- whenSwInterfaceSetFlagsThenSuccess();
-
- customizer.writeCurrentAttributes(id, subInterface, writeContext);
-
- verify(api).createSubif(generateSubInterfaceRequest(SUPER_IF_ID, CTAG_ID, false));
- verify(mappingContext)
- .put(eq(mappingIid(SUB_IFACE_NAME, IFC_TEST_INSTANCE)), eq(
- mapping(SUB_IFACE_NAME, 0).get()));
- }
-
- @Test
- public void testCreateDot1qAnyTag() throws Exception {
- final SubInterface subInterface = generateSubInterface(false, Arrays.asList(STAG_100, CTAG_ANY));
- final InstanceIdentifier<SubInterface> id = getSubInterfaceId(SUPER_IF_NAME, SUBIF_INDEX);
-
- whenCreateSubifThenSuccess();
- whenSwInterfaceSetFlagsThenSuccess();
-
- customizer.writeCurrentAttributes(id, subInterface, writeContext);
-
- verify(api).createSubif(generateSubInterfaceRequest(SUPER_IF_ID, CTAG_ANY_ID, true));
- verify(mappingContext)
- .put(eq(mappingIid(SUB_IFACE_NAME, IFC_TEST_INSTANCE)), eq(
- mapping(SUB_IFACE_NAME, 0).get()));
- }
-
- @Test
- public void testCreateFailed() throws Exception {
- final SubInterface subInterface = generateSubInterface(false, Arrays.asList(STAG_100, CTAG_200));
- final InstanceIdentifier<SubInterface> id = getSubInterfaceId(SUPER_IF_NAME, SUBIF_INDEX);
-
- whenCreateSubifThenFailure();
-
- try {
- customizer.writeCurrentAttributes(id, subInterface, writeContext);
- } catch (WriteFailedException.CreateFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).createSubif(generateSubInterfaceRequest(SUPER_IF_ID, CTAG_ID, false));
- verify(mappingContext, times(0)).put(
- eq(mappingIid(SUPER_IF_NAME, IFC_TEST_INSTANCE)),
- eq(mapping(SUPER_IF_NAME, 0).get()));
- return;
- }
- fail("WriteFailedException.CreateFailedException was expected");
- }
-
- @Test
- public void testUpdate() throws Exception {
- final List<Tag> tags = Arrays.asList(STAG_100, CTAG_200);
- final SubInterface before = generateSubInterface(false, tags);
- final SubInterface after = generateSubInterface(true, tags);
- final InstanceIdentifier<SubInterface> id = getSubInterfaceId(SUPER_IF_NAME, SUBIF_INDEX);
-
- whenSwInterfaceSetFlagsThenSuccess();
- customizer.updateCurrentAttributes(id, before, after, writeContext);
-
- verifySwInterfaceSetFlagsWasInvoked(generateSwInterfaceEnableRequest(SUBIF_INDEX));
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testDelete() throws Exception {
- final SubInterface subInterface = generateSubInterface(false, Arrays.asList(STAG_100, CTAG_200));
- customizer.deleteCurrentAttributes(null, subInterface, writeContext);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceL2CustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceL2CustomizerTest.java
deleted file mode 100644
index 3538a5c3b..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceL2CustomizerTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.interconnection.BridgeBasedBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.SubInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.L2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.L2Builder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetL2Bridge;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetL2BridgeReply;
-
-public class SubInterfaceL2CustomizerTest extends WriterCustomizerTest implements ByteDataTranslator {
- private static final String IFACE_CTX_NAME = "interface-ctx";
- private static final String IF_NAME = "local0";
- private static final int IF_INDEX = 1;
- private static final String SUBIF_NAME = "local0.0";
- private static final int SUBIF_INDEX = 11;
- private static final long SUBIF_ID = 0;
-
- private static final InstanceIdentifier<L2> IID =
- InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IF_NAME)).augmentation(
- SubinterfaceAugmentation.class).child(SubInterfaces.class)
- .child(SubInterface.class, new SubInterfaceKey(SUBIF_ID)).child(L2.class);
-
-
- private static final String BD_CTX_NAME = "bd-ctx";
- private static final String BD_NAME = "test_bd";
- private static final int BD_INDEX = 13;
-
- private SubInterfaceL2Customizer customizer;
-
- @Override
- protected void setUp() throws Exception {
- customizer = new SubInterfaceL2Customizer(api, new NamingContext("ifacePrefix", IFACE_CTX_NAME),
- new NamingContext("bdPrefix", BD_CTX_NAME));
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFACE_CTX_NAME);
- defineMapping(mappingContext, SUBIF_NAME, SUBIF_INDEX, IFACE_CTX_NAME);
- defineMapping(mappingContext, BD_NAME, BD_INDEX, BD_CTX_NAME);
- }
-
- @Test
- public void testWrite() throws WriteFailedException {
- final boolean bvi = true;
- when(api.swInterfaceSetL2Bridge(any())).thenReturn(future(new SwInterfaceSetL2BridgeReply()));
- customizer.writeCurrentAttributes(IID, l2(bvi), writeContext);
- verify(api).swInterfaceSetL2Bridge(bridgeRequest(bvi, true));
- }
-
- @Test
- public void testUpdate() throws WriteFailedException {
- final boolean bvi = false;
- when(api.swInterfaceSetL2Bridge(any())).thenReturn(future(new SwInterfaceSetL2BridgeReply()));
- customizer.updateCurrentAttributes(IID, l2(true), l2(bvi), writeContext);
- verify(api).swInterfaceSetL2Bridge(bridgeRequest(bvi, true));
- }
-
- @Test
- public void testDelete() throws WriteFailedException {
- final boolean bvi = true;
- when(api.swInterfaceSetL2Bridge(any())).thenReturn(future(new SwInterfaceSetL2BridgeReply()));
- customizer.deleteCurrentAttributes(IID, l2(bvi), writeContext);
- verify(api).swInterfaceSetL2Bridge(bridgeRequest(bvi, false));
- }
-
- private L2 l2(final boolean bvi) {
- return new L2Builder().setInterconnection(new BridgeBasedBuilder().setBridgedVirtualInterface(bvi)
- .setBridgeDomain(BD_NAME).setSplitHorizonGroup((short) 123).build()).build();
- }
-
- private SwInterfaceSetL2Bridge bridgeRequest(final boolean bvi, final boolean enable) {
- final SwInterfaceSetL2Bridge request = new SwInterfaceSetL2Bridge();
- request.bdId = BD_INDEX;
- request.rxSwIfIndex = SUBIF_INDEX;
- request.bvi = booleanToByte(bvi);
- request.enable = booleanToByte(enable);
- request.shg = 123;
- return request;
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/TapCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/TapCustomizerTest.java
deleted file mode 100644
index 6e9fbe697..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/TapCustomizerTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import org.junit.Test;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Tap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.TapBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.TapConnect;
-import io.fd.vpp.jvpp.core.dto.TapConnectReply;
-import io.fd.vpp.jvpp.core.dto.TapDelete;
-import io.fd.vpp.jvpp.core.dto.TapDeleteReply;
-import io.fd.vpp.jvpp.core.dto.TapModify;
-import io.fd.vpp.jvpp.core.dto.TapModifyReply;
-
-public class TapCustomizerTest extends WriterCustomizerTest {
-
- private static final String IFC_TEST_INSTANCE = "ifc-test-instance";
- private TapCustomizer tapCustomizer;
-
- @Override
- public void setUp() throws Exception {
- InterfaceTypeTestUtils.setupWriteContext(writeContext,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.Tap.class);
- tapCustomizer = new TapCustomizer(api, new NamingContext("ifcintest", IFC_TEST_INSTANCE));
- }
-
- @Test
- public void testCreate() throws Exception {
- doAnswer(new Answer() {
-
- int idx = 0;
-
- @Override
- public Object answer(final InvocationOnMock invocation) throws Throwable {
- final TapConnectReply t = new TapConnectReply();
- t.swIfIndex = idx++;
- return future(t);
- }
- }).when(api).tapConnect(any(TapConnect.class));
-
- tapCustomizer.writeCurrentAttributes(getTapId("tap"), getTapData("tap", "ff:ff:ff:ff:ff:ff"), writeContext);
- tapCustomizer.writeCurrentAttributes(getTapId("tap2"), getTapData("tap2", "ff:ff:ff:ff:ff:ff"), writeContext);
-
- verify(api, times(2)).tapConnect(any(TapConnect.class));
- verify(mappingContext).put(eq(mappingIid("tap", IFC_TEST_INSTANCE)), eq(
- mapping("tap", 0).get()));
- verify(mappingContext).put(eq(mappingIid("tap2", IFC_TEST_INSTANCE)), eq(
- mapping("tap2", 1).get()));
- }
-
- @Test
- public void testModify() throws Exception {
- final TapConnectReply t = new TapConnectReply();
- t.swIfIndex = 0;
- doReturn(future(t)).when(api).tapConnect(any(TapConnect.class));
-
- final TapModifyReply tmodif = new TapModifyReply();
- tmodif.swIfIndex = 0;
- doReturn(future(tmodif)).when(api).tapModify(any(TapModify.class));
-
- tapCustomizer.writeCurrentAttributes(getTapId("tap"), getTapData("tap", "ff:ff:ff:ff:ff:ff"), writeContext);
-
- defineMapping(mappingContext, "tap", 1, IFC_TEST_INSTANCE);
- tapCustomizer.updateCurrentAttributes(getTapId("tap"), getTapData("tap", "ff:ff:ff:ff:ff:ff"), getTapData("tap", "ff:ff:ff:ff:ff:f1"), writeContext);
-
- verify(api).tapConnect(any(TapConnect.class));
- verify(api).tapModify(any(TapModify.class));
-
- verify(mappingContext).put(eq(mappingIid("tap", IFC_TEST_INSTANCE)), eq(
- mapping("tap", 0).get()));
- }
-
- @Test
- public void testDelete() throws Exception {
- final TapConnectReply t = new TapConnectReply();
- t.swIfIndex = 0;
- doReturn(future(t)).when(api).tapConnect(any(TapConnect.class));
-
- doReturn(future(new TapDeleteReply())).when(api).tapDelete(any(TapDelete.class));
-
- tapCustomizer.writeCurrentAttributes(getTapId("tap"), getTapData("tap", "ff:ff:ff:ff:ff:ff"), writeContext);
- defineMapping(mappingContext, "tap", 1, IFC_TEST_INSTANCE);
- tapCustomizer.deleteCurrentAttributes(getTapId("tap"), getTapData("tap", "ff:ff:ff:ff:ff:ff"), writeContext);
-
- verify(api).tapConnect(any(TapConnect.class));
- verify(api).tapDelete(any(TapDelete.class));
- verify(mappingContext).delete(eq(mappingIid("tap", IFC_TEST_INSTANCE)));
- }
-
- private InstanceIdentifier<Tap> getTapId(final String tap) {
- return InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(tap)).augmentation(
- VppInterfaceAugmentation.class).child(Tap.class);
- }
-
- private Tap getTapData(final String tap, final String mac) {
- return new TapBuilder().setTapName(tap).setMac(new PhysAddress(mac)).build();
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizerTest.java
deleted file mode 100644
index 344b2eb9e..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizerTest.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static org.junit.Assert.assertArrayEquals;
-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.Matchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VhostUserRole;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VhostUser;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VhostUserBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.VppInvocationException;
-import io.fd.vpp.jvpp.core.dto.CreateVhostUserIf;
-import io.fd.vpp.jvpp.core.dto.CreateVhostUserIfReply;
-import io.fd.vpp.jvpp.core.dto.DeleteVhostUserIf;
-import io.fd.vpp.jvpp.core.dto.DeleteVhostUserIfReply;
-import io.fd.vpp.jvpp.core.dto.ModifyVhostUserIf;
-import io.fd.vpp.jvpp.core.dto.ModifyVhostUserIfReply;
-
-public class VhostUserCustomizerTest extends WriterCustomizerTest implements Ipv4Translator {
-
- private VhostUserCustomizer customizer;
- private static final int IFACE_ID = 1;
- private static final String IFACE_NAME = "eth0";
- private static final InstanceIdentifier<VhostUser> ID =
- InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IFACE_NAME))
- .augmentation(VppInterfaceAugmentation.class).child(VhostUser.class);
-
- @Override
- public void setUp() throws Exception {
- InterfaceTypeTestUtils.setupWriteContext(writeContext,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VhostUser.class);
- customizer = new VhostUserCustomizer(api, new NamingContext("generatedInterfaceName", "test-instance"));
- }
-
- private CreateVhostUserIf verifyCreateVhostUserIfWasInvoked(final VhostUser vhostUser)
- throws VppInvocationException {
- ArgumentCaptor<CreateVhostUserIf> argumentCaptor = ArgumentCaptor.forClass(CreateVhostUserIf.class);
- verify(api).createVhostUserIf(argumentCaptor.capture());
- final CreateVhostUserIf actual = argumentCaptor.getValue();
- assertEquals(0, actual.customDevInstance);
-
- assertEquals(booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole())), actual.isServer);
- assertEquals(0, actual.renumber);
- assertEquals(0, actual.useCustomMac);
- assertArrayEquals(vhostUser.getSocket().getBytes(), actual.sockFilename);
- assertNotNull(actual.macAddress);
- return actual;
- }
-
- private ModifyVhostUserIf verifyModifyVhostUserIfWasInvoked(final VhostUser vhostUser, final int swIfIndex)
- throws VppInvocationException {
- ArgumentCaptor<ModifyVhostUserIf> argumentCaptor = ArgumentCaptor.forClass(ModifyVhostUserIf.class);
- verify(api).modifyVhostUserIf(argumentCaptor.capture());
- final ModifyVhostUserIf actual = argumentCaptor.getValue();
- assertEquals(0, actual.customDevInstance);
-
- assertEquals(booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole())), actual.isServer);
- assertEquals(0, actual.renumber);
- assertEquals(swIfIndex, actual.swIfIndex);
- assertArrayEquals(vhostUser.getSocket().getBytes(), actual.sockFilename);
- return actual;
- }
-
- private DeleteVhostUserIf verifyDeleteVhostUserIfWasInvoked(final int swIfIndex) throws VppInvocationException {
- ArgumentCaptor<DeleteVhostUserIf> argumentCaptor = ArgumentCaptor.forClass(DeleteVhostUserIf.class);
- verify(api).deleteVhostUserIf(argumentCaptor.capture());
- final DeleteVhostUserIf actual = argumentCaptor.getValue();
- assertEquals(swIfIndex, actual.swIfIndex);
- return actual;
- }
-
- private static VhostUser generateVhostUser(final VhostUserRole role, final String socketName) {
- VhostUserBuilder builder = new VhostUserBuilder();
- builder.setRole(role);
- builder.setSocket(socketName);
- return builder.build();
- }
-
- @Test
- public void testWriteCurrentAttributes() throws Exception {
- final VhostUser vhostUser = generateVhostUser(VhostUserRole.Server, "socketName");
-
- when(api.createVhostUserIf(any(CreateVhostUserIf.class))).thenReturn(future(new CreateVhostUserIfReply()));
-
- customizer.writeCurrentAttributes(ID, vhostUser, writeContext);
- verifyCreateVhostUserIfWasInvoked(vhostUser);
- verify(mappingContext).put(eq(mappingIid(IFACE_NAME, "test-instance")), eq(
- mapping(IFACE_NAME, 0).get()));
- }
-
- @Test
- public void testWriteCurrentAttributesFailed() throws Exception {
- final VhostUser vhostUser = generateVhostUser(VhostUserRole.Client, "socketName");
-
- doReturn(failedFuture()).when(api).createVhostUserIf(any(CreateVhostUserIf.class));
-
- try {
- customizer.writeCurrentAttributes(ID, vhostUser, writeContext);
- } catch (WriteFailedException.CreateFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verifyCreateVhostUserIfWasInvoked(vhostUser);
- verifyZeroInteractions(mappingContext);
- return;
- }
- fail("WriteFailedException.CreateFailedException was expected");
- }
-
- @Test
- public void testUpdateCurrentAttributes() throws Exception {
- final VhostUser vhostUserBefore = generateVhostUser(VhostUserRole.Client, "socketName0");
- final VhostUser vhostUserAfter = generateVhostUser(VhostUserRole.Server, "socketName1");
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, "test-instance");
-
- when(api.modifyVhostUserIf(any(ModifyVhostUserIf.class))).thenReturn(future(new ModifyVhostUserIfReply()));
-
- customizer.updateCurrentAttributes(ID, vhostUserBefore, vhostUserAfter, writeContext);
- verifyModifyVhostUserIfWasInvoked(vhostUserAfter, IFACE_ID);
- }
-
- @Test
- public void testUpdateCurrentAttributesFailed() throws Exception {
- final VhostUser vhostUserBefore = generateVhostUser(VhostUserRole.Client, "socketName0");
- final VhostUser vhostUserAfter = generateVhostUser(VhostUserRole.Server, "socketName1");
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, "test-instance");
-
- doReturn(failedFuture()).when(api).modifyVhostUserIf(any(ModifyVhostUserIf.class));
-
- try {
- customizer.updateCurrentAttributes(ID, vhostUserBefore, vhostUserAfter, writeContext);
- } catch (WriteFailedException.UpdateFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verifyModifyVhostUserIfWasInvoked(vhostUserAfter, IFACE_ID);
- return;
- }
- fail("WriteFailedException.UpdateFailedException was expected");
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws Exception {
- final VhostUser vhostUser = generateVhostUser(VhostUserRole.Client, "socketName");
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, "test-instance");
-
- when(api.deleteVhostUserIf(any(DeleteVhostUserIf.class))).thenReturn(future(new DeleteVhostUserIfReply()));
-
- customizer.deleteCurrentAttributes(ID, vhostUser, writeContext);
- verifyDeleteVhostUserIfWasInvoked(IFACE_ID);
- verify(mappingContext).delete(eq(mappingIid(IFACE_NAME, "test-instance")));
- }
-
- @Test
- public void testDeleteCurrentAttributesFailed() throws Exception {
- final VhostUser vhostUser = generateVhostUser(VhostUserRole.Client, "socketName");
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, "test-instance");
-
- doReturn(failedFuture()).when(api).deleteVhostUserIf(any(DeleteVhostUserIf.class));
-
- try {
- customizer.deleteCurrentAttributes(ID, vhostUser, writeContext);
- } catch (WriteFailedException.DeleteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verifyDeleteVhostUserIfWasInvoked(IFACE_ID);
- // Delete from context not invoked if delete from VPP failed
- verify(mappingContext, times(0)).delete(eq(mappingIid(IFACE_NAME, "test-instance")));
- verify(mappingContext).read(eq(mappingIid(IFACE_NAME, "test-instance")));
- return;
- }
- fail("WriteFailedException.DeleteFailedException was expected");
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanCustomizerTest.java
deleted file mode 100644
index d2a4f4c9c..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanCustomizerTest.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import com.google.common.net.InetAddresses;
-import io.fd.honeycomb.translate.v3po.DisabledInterfacesManager;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-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.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VxlanVni;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Vxlan;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VxlanBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.VppInvocationException;
-import io.fd.vpp.jvpp.core.dto.VxlanAddDelTunnel;
-import io.fd.vpp.jvpp.core.dto.VxlanAddDelTunnelReply;
-
-public class VxlanCustomizerTest extends WriterCustomizerTest {
-
- private static final byte ADD_VXLAN = 1;
- private static final byte DEL_VXLAN = 0;
-
- @Mock
- private DisabledInterfacesManager disableContext;
-
- private VxlanCustomizer customizer;
- private String ifaceName;
- private InstanceIdentifier<Vxlan> id;
-
- @Override
- public void setUp() throws Exception {
- InterfaceTypeTestUtils.setupWriteContext(writeContext,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VxlanTunnel.class);
-
- customizer =
- new VxlanCustomizer(api, new NamingContext("generateInterfaceNAme", "test-instance"), disableContext);
-
- ifaceName = "eth0";
- id = InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(ifaceName))
- .augmentation(VppInterfaceAugmentation.class).child(Vxlan.class);
- }
-
- private void whenVxlanAddDelTunnelThenSuccess() {
- when(api.vxlanAddDelTunnel(any(VxlanAddDelTunnel.class))).thenReturn(future(new VxlanAddDelTunnelReply()));
- }
-
- private void whenVxlanAddDelTunnelThenFailure() {
- doReturn(failedFuture()).when(api).vxlanAddDelTunnel(any(VxlanAddDelTunnel.class));
- }
-
- private VxlanAddDelTunnel verifyVxlanAddDelTunnelWasInvoked(final Vxlan vxlan) throws VppInvocationException {
- ArgumentCaptor<VxlanAddDelTunnel> argumentCaptor = ArgumentCaptor.forClass(VxlanAddDelTunnel.class);
- verify(api).vxlanAddDelTunnel(argumentCaptor.capture());
- final VxlanAddDelTunnel actual = argumentCaptor.getValue();
- assertEquals(0, actual.isIpv6);
- assertEquals(-1, actual.decapNextIndex);
- assertArrayEquals(InetAddresses.forString(vxlan.getSrc().getIpv4Address().getValue()).getAddress(),
- actual.srcAddress);
- assertArrayEquals(InetAddresses.forString(vxlan.getDst().getIpv4Address().getValue()).getAddress(),
- actual.dstAddress);
- assertEquals(vxlan.getEncapVrfId().intValue(), actual.encapVrfId);
- assertEquals(vxlan.getVni().getValue().intValue(), actual.vni);
- return actual;
- }
-
- private void verifyVxlanAddWasInvoked(final Vxlan vxlan) throws VppInvocationException {
- final VxlanAddDelTunnel actual = verifyVxlanAddDelTunnelWasInvoked(vxlan);
- assertEquals(ADD_VXLAN, actual.isAdd);
- }
-
- private void verifyVxlanDeleteWasInvoked(final Vxlan vxlan) throws VppInvocationException {
- final VxlanAddDelTunnel actual = verifyVxlanAddDelTunnelWasInvoked(vxlan);
- assertEquals(DEL_VXLAN, actual.isAdd);
- }
-
- private static Vxlan generateVxlan(long vni) {
- final VxlanBuilder builder = new VxlanBuilder();
- builder.setSrc(new IpAddress(new Ipv4Address("192.168.20.10")));
- builder.setDst(new IpAddress(new Ipv4Address("192.168.20.11")));
- builder.setEncapVrfId(Long.valueOf(123));
- builder.setVni(new VxlanVni(Long.valueOf(vni)));
- return builder.build();
- }
-
- private static Vxlan generateVxlan() {
- return generateVxlan(Long.valueOf(11));
- }
-
- @Test
- public void testWriteCurrentAttributes() throws Exception {
- final Vxlan vxlan = generateVxlan();
-
- whenVxlanAddDelTunnelThenSuccess();
- noMappingDefined(mappingContext, ifaceName, "test-instance");
-
- customizer.writeCurrentAttributes(id, vxlan, writeContext);
- verifyVxlanAddWasInvoked(vxlan);
- verify(mappingContext).put(eq(mappingIid(ifaceName, "test-instance")), eq(mapping(ifaceName, 0).get()));
- }
-
- @Test
- public void testWriteCurrentAttributesWithExistingVxlanPlaceholder() throws Exception {
- final Vxlan vxlan = generateVxlan();
-
- whenVxlanAddDelTunnelThenSuccess();
- noMappingDefined(mappingContext, ifaceName, "test-instance");
- doReturn(true).when(disableContext).isInterfaceDisabled(0, mappingContext);
-
- customizer.writeCurrentAttributes(id, vxlan, writeContext);
- verifyVxlanAddWasInvoked(vxlan);
- verify(mappingContext).put(eq(mappingIid(ifaceName, "test-instance")), eq(mapping(ifaceName, 0).get()));
- verify(disableContext).removeDisabledInterface(0, mappingContext);
- }
-
- @Test
- public void testWriteCurrentAttributesMappingAlreadyPresent() throws Exception {
- final Vxlan vxlan = generateVxlan();
- final int ifaceId = 0;
-
- whenVxlanAddDelTunnelThenSuccess();
- defineMapping(mappingContext, ifaceName, ifaceId, "test-instance");
-
- customizer.writeCurrentAttributes(id, vxlan, writeContext);
- verifyVxlanAddWasInvoked(vxlan);
-
- // Remove the first mapping before putting in the new one
- verify(mappingContext).delete(eq(mappingIid(ifaceName, "test-instance")));
- verify(mappingContext)
- .put(eq(mappingIid(ifaceName, "test-instance")), eq(mapping(ifaceName, ifaceId).get()));
- }
-
- @Test
- public void testWriteCurrentAttributesFailed() throws Exception {
- final Vxlan vxlan = generateVxlan();
-
- whenVxlanAddDelTunnelThenFailure();
-
- try {
- customizer.writeCurrentAttributes(id, vxlan, writeContext);
- } catch (WriteFailedException.CreateFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verifyVxlanAddWasInvoked(vxlan);
- // Mapping not stored due to failure
- verify(mappingContext, times(0))
- .put(eq(mappingIid(ifaceName, "test-instance")), eq(mapping(ifaceName, 0).get()));
- return;
- }
- fail("WriteFailedException.CreateFailedException was expected");
- }
-
- @Test
- public void testUpdateCurrentAttributes() throws Exception {
- try {
- customizer.updateCurrentAttributes(id, generateVxlan(10), generateVxlan(11), writeContext);
- } catch (WriteFailedException.UpdateFailedException e) {
- assertEquals(UnsupportedOperationException.class, e.getCause().getClass());
- return;
- }
- fail("WriteFailedException.UpdateFailedException was expected");
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws Exception {
- final Vxlan vxlan = generateVxlan();
-
- whenVxlanAddDelTunnelThenSuccess();
- defineMapping(mappingContext, ifaceName, 1, "test-instance");
-
- customizer.deleteCurrentAttributes(id, vxlan, writeContext);
- verifyVxlanDeleteWasInvoked(vxlan);
- verify(mappingContext).delete(eq(mappingIid(ifaceName, "test-instance")));
- verify(disableContext).disableInterface(1, mappingContext);
- }
-
- @Test
- public void testDeleteCurrentAttributesaFailed() throws Exception {
- final Vxlan vxlan = generateVxlan();
-
- whenVxlanAddDelTunnelThenFailure();
- defineMapping(mappingContext, ifaceName, 1, "test-instance");
-
- try {
- customizer.deleteCurrentAttributes(id, vxlan, writeContext);
- } catch (WriteFailedException.DeleteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verifyVxlanDeleteWasInvoked(vxlan);
- verify(mappingContext, times(0)).delete(eq(mappingIid(ifaceName, "test-instance")));
- return;
- }
- fail("WriteFailedException.DeleteFailedException was expected");
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanGpeCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanGpeCustomizerTest.java
deleted file mode 100644
index 0792a0e1e..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanGpeCustomizerTest.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * 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.translate.v3po.interfaces;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import com.google.common.net.InetAddresses;
-import io.fd.honeycomb.translate.v3po.DisabledInterfacesManager;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-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.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VxlanGpeNextProtocol;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VxlanGpeVni;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VxlanGpe;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.VxlanGpeBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.VxlanGpeAddDelTunnel;
-import io.fd.vpp.jvpp.core.dto.VxlanGpeAddDelTunnelReply;
-
-public class VxlanGpeCustomizerTest extends WriterCustomizerTest {
-
- private static final byte ADD_VXLAN_GPE = 1;
- private static final byte DEL_VXLAN_GPE = 0;
-
- @Mock
- private DisabledInterfacesManager interfaceDisableContext;
-
- private VxlanGpeCustomizer customizer;
- private String ifaceName;
- private InstanceIdentifier<VxlanGpe> id;
-
- @Override
- public void setUp() throws Exception {
- InterfaceTypeTestUtils.setupWriteContext(writeContext,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VxlanGpeTunnel.class);
- NamingContext namingContext = new NamingContext("generateInterfaceName", "test-instance");
- customizer = new VxlanGpeCustomizer(api, namingContext, interfaceDisableContext);
-
- ifaceName = "elth0";
- id = InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(ifaceName))
- .augmentation(VppInterfaceAugmentation.class).child(VxlanGpe.class);
- }
-
- private void whenVxlanGpeAddDelTunnelThenSuccess() {
- when(api.vxlanGpeAddDelTunnel(any(VxlanGpeAddDelTunnel.class)))
- .thenReturn(future(new VxlanGpeAddDelTunnelReply()));
- }
-
- private void whenVxlanGpeAddDelTunnelThenFailure() {
- doReturn(failedFuture()).when(api).vxlanGpeAddDelTunnel(any(VxlanGpeAddDelTunnel.class));
- }
-
- private VxlanGpeAddDelTunnel verifyVxlanGpeAddDelTunnelWasInvoked(final VxlanGpe vxlanGpe)
- throws VppBaseCallException {
- ArgumentCaptor<VxlanGpeAddDelTunnel> argumentCaptor = ArgumentCaptor.forClass(VxlanGpeAddDelTunnel.class);
- verify(api).vxlanGpeAddDelTunnel(argumentCaptor.capture());
- final VxlanGpeAddDelTunnel actual = argumentCaptor.getValue();
- assertEquals(0, actual.isIpv6);
- assertArrayEquals(InetAddresses.forString(vxlanGpe.getLocal().getIpv4Address().getValue()).getAddress(),
- actual.local);
- assertArrayEquals(InetAddresses.forString(vxlanGpe.getRemote().getIpv4Address().getValue()).getAddress(),
- actual.remote);
- assertEquals(vxlanGpe.getVni().getValue().intValue(), actual.vni);
- assertEquals(vxlanGpe.getNextProtocol().getIntValue(), actual.protocol);
- assertEquals(vxlanGpe.getEncapVrfId().intValue(), actual.encapVrfId);
- assertEquals(vxlanGpe.getDecapVrfId().intValue(), actual.decapVrfId);
- return actual;
- }
-
- private void verifyVxlanGpeAddWasInvoked(final VxlanGpe vxlanGpe) throws VppBaseCallException {
- final VxlanGpeAddDelTunnel actual = verifyVxlanGpeAddDelTunnelWasInvoked(vxlanGpe);
- assertEquals(ADD_VXLAN_GPE, actual.isAdd);
- }
-
- private void verifyVxlanGpeDeleteWasInvoked(final VxlanGpe vxlanGpe) throws VppBaseCallException {
- final VxlanGpeAddDelTunnel actual = verifyVxlanGpeAddDelTunnelWasInvoked(vxlanGpe);
- assertEquals(DEL_VXLAN_GPE, actual.isAdd);
- }
-
- private static VxlanGpe generateVxlanGpe(long vni) {
- final VxlanGpeBuilder builder = new VxlanGpeBuilder();
- builder.setLocal(new IpAddress(new Ipv4Address("192.168.20.10")));
- builder.setRemote(new IpAddress(new Ipv4Address("192.168.20.11")));
- builder.setVni(new VxlanGpeVni(Long.valueOf(vni)));
- builder.setNextProtocol(VxlanGpeNextProtocol.forValue(1));
- builder.setEncapVrfId(Long.valueOf(123));
- builder.setDecapVrfId(Long.valueOf(456));
- return builder.build();
- }
-
- private static VxlanGpe generateVxlanGpe() {
- return generateVxlanGpe(Long.valueOf(11));
- }
-
- @Test
- public void testWriteCurrentAttributes() throws Exception {
- final VxlanGpe vxlanGpe = generateVxlanGpe();
-
- whenVxlanGpeAddDelTunnelThenSuccess();
- noMappingDefined(mappingContext, ifaceName, "test-instance");
-
- customizer.writeCurrentAttributes(id, vxlanGpe, writeContext);
- verifyVxlanGpeAddWasInvoked(vxlanGpe);
- verify(mappingContext).put(eq(mappingIid(ifaceName, "test-instance")), eq(
- mapping(ifaceName, 0).get()));
- }
-
- @Test
- public void testWriteCurrentAttributesMappingAlreadyPresent() throws Exception {
- final VxlanGpe vxlanGpe = generateVxlanGpe();
- final int ifaceId = 0;
-
- whenVxlanGpeAddDelTunnelThenSuccess();
- defineMapping(mappingContext, ifaceName, ifaceId, "test-instance");
-
- customizer.writeCurrentAttributes(id, vxlanGpe, writeContext);
- verifyVxlanGpeAddWasInvoked(vxlanGpe);
-
- // Remove the first mapping before putting in the new one
- verify(mappingContext).delete(eq(mappingIid(ifaceName, "test-instance")));
- verify(mappingContext).put(eq(mappingIid(ifaceName, "test-instance")),
- eq(mapping(ifaceName, ifaceId).get()));
- }
-
- @Test
- public void testWriteCurrentAttributesFailed() throws Exception {
- final VxlanGpe vxlanGpe = generateVxlanGpe();
-
- whenVxlanGpeAddDelTunnelThenFailure();
-
- try {
- customizer.writeCurrentAttributes(id, vxlanGpe, writeContext);
- } catch (WriteFailedException.CreateFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verifyVxlanGpeAddWasInvoked(vxlanGpe);
- // Mapping not stored due to failure
- verify(mappingContext, times(0))
- .put(eq(mappingIid(ifaceName, "test-instance")), eq(
- mapping(ifaceName, 0).get()));
- return;
- }
- fail("WriteFailedException.CreateFailedException was expected");
- }
-
- @Test
- public void testUpdateCurrentAttributes() throws Exception {
- try {
- customizer.updateCurrentAttributes(id, generateVxlanGpe(10), generateVxlanGpe(11), writeContext);
- } catch (WriteFailedException.UpdateFailedException e) {
- assertEquals(UnsupportedOperationException.class, e.getCause().getClass());
- return;
- }
- fail("WriteFailedException.UpdateFailedException was expected");
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws Exception {
- final VxlanGpe vxlanGpe = generateVxlanGpe();
-
- whenVxlanGpeAddDelTunnelThenSuccess();
- defineMapping(mappingContext, ifaceName, 1, "test-instance");
-
- customizer.deleteCurrentAttributes(id, vxlanGpe, writeContext);
- verifyVxlanGpeDeleteWasInvoked(vxlanGpe);
- verify(mappingContext).delete(eq(mappingIid(ifaceName, "test-instance")));
- }
-
- @Test
- public void testDeleteCurrentAttributesaFailed() throws Exception {
- final VxlanGpe vxlanGpe = generateVxlanGpe();
-
- whenVxlanGpeAddDelTunnelThenFailure();
- defineMapping(mappingContext, ifaceName, 1, "test-instance");
-
- try {
- customizer.deleteCurrentAttributes(id, vxlanGpe, writeContext);
- } catch (WriteFailedException.DeleteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verifyVxlanGpeDeleteWasInvoked(vxlanGpe);
- verify(mappingContext, times(0)).delete(eq(mappingIid(ifaceName, "test-instance")));
- return;
- }
- fail("WriteFailedException.DeleteFailedException was expected");
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/AclWriterTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/AclWriterTest.java
deleted file mode 100644
index d2ace4a10..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/AclWriterTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl;
-
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.when;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import java.util.Collections;
-import java.util.List;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.AccessLists;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.AclBase;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.EthAcl;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.Acl;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.AclKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessListsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.access.lists.AclBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.IetfAclBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.IngressBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class AclWriterTest extends WriterCustomizerTest {
-
- private static final String ACL_NAME = "acl1";
- private static final Class<? extends AclBase> ACL_TYPE = EthAcl.class;
- private static final InstanceIdentifier<Acl> IID =
- InstanceIdentifier.create(AccessLists.class).child(Acl.class, new AclKey(ACL_NAME, ACL_TYPE));
-
- @Mock
- private Acl acl;
- private IetfAclWriter customizer;
-
- @Override
- public void setUp() {
- customizer = new IetfAclWriter();
- when(acl.getAclName()).thenReturn(ACL_NAME);
- doReturn(ACL_TYPE).when(acl).getAclType();
- }
-
- private void defineInterfacesContext(final List<Interface> interfaces) {
- when(writeContext.readAfter(InstanceIdentifier.create(Interfaces.class))).thenReturn(Optional.of(
- new InterfacesBuilder().setInterface(interfaces).build()
- ));
- }
-
- @Test
- public void testWrite() throws Exception {
- customizer.writeCurrentAttributes(IID, acl, writeContext);
- }
-
- @Test
- public void testUpdate() throws WriteFailedException {
- defineInterfacesContext(Collections.emptyList());
- customizer.updateCurrentAttributes(IID, acl, acl, writeContext);
- }
-
- @Test
- public void testDelete() throws WriteFailedException {
- defineInterfacesContext(Collections.emptyList());
- customizer.deleteCurrentAttributes(IID, acl, writeContext);
- }
-
- @Test(expected = WriteFailedException.class)
- public void testDeleteFailed() throws WriteFailedException {
- final Interface iface = new InterfaceBuilder().addAugmentation(VppInterfaceAugmentation.class,
- new VppInterfaceAugmentationBuilder().setIetfAcl(
- new IetfAclBuilder().setIngress(
- new IngressBuilder().setAccessLists(
- new AccessListsBuilder().setAcl(
- Collections.singletonList(new AclBuilder().setName(ACL_NAME).setType(ACL_TYPE).build())
- ).build()
- ).build()
- ).build()
- ).build()
- ).build();
- defineInterfacesContext(Collections.singletonList(iface));
- customizer.deleteCurrentAttributes(IID, acl, writeContext);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceEthWriterTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceEthWriterTest.java
deleted file mode 100644
index 3a50b7673..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceEthWriterTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.PacketHandling;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.packet.handling.DenyBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.AceEth;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.AceEthBuilder;
-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.vpp.acl.rev161214.InterfaceMode;
-
-public class AceEthWriterTest {
-
- private AceEthWriter writer;
- private PacketHandling action;
- private AceEth aceEth;
-
- @Before
- public void setUp() {
- initMocks(this);
- writer = new AceEthWriter();
- action = new DenyBuilder().setDeny(true).build();
- aceEth = new AceEthBuilder()
- .setDestinationMacAddress(new MacAddress("11:22:33:44:55:66"))
- .setDestinationMacAddressMask(new MacAddress("ff:ff:ff:ff:ff:ff"))
- .setSourceMacAddress(new MacAddress("aa:bb:cc:dd:ee:ff"))
- .setSourceMacAddressMask(new MacAddress("ff:ff:ff:00:00:00"))
- .build();
- }
-
- @Test
- public void testCreateTable() {
- final int nextTableIndex = 42;
- final ClassifyAddDelTable request = writer.createTable(aceEth, InterfaceMode.L2, nextTableIndex, 0);
-
- assertEquals(1, request.isAdd);
- assertEquals(-1, request.tableIndex);
- assertEquals(1, request.nbuckets);
- assertEquals(nextTableIndex, request.nextTableIndex);
- assertEquals(0, request.skipNVectors);
- assertEquals(AceEthWriter.MATCH_N_VECTORS, request.matchNVectors);
- assertEquals(AceEthWriter.TABLE_MEM_SIZE, request.memorySize);
-
- byte[] expectedMask = new byte[] {
- // destination MAC:
- (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
- // source MAC:
- (byte) 0xff, (byte) 0xff, (byte) 0xff, 0, 0, 0,
- 0, 0, 0, 0
- };
- assertArrayEquals(expectedMask, request.mask);
- }
-
- @Test
- public void testCreateClassifySession() {
- final int tableIndex = 123;
- final ClassifyAddDelSession request = writer.createSession(action, aceEth, InterfaceMode.L2, tableIndex, 0).get(0);
-
- assertEquals(1, request.isAdd);
- assertEquals(tableIndex, request.tableIndex);
- assertEquals(0, request.hitNextIndex);
-
- byte[] expectedMatch = new byte[] {
- // destination MAC:
- (byte) 0x11, (byte) 0x22, (byte) 0x33, (byte) 0x44, (byte) 0x55, (byte) 0x66,
- // source MAC:
- (byte) 0xaa, (byte) 0xbb, (byte) 0xcc, (byte) 0xdd, (byte) 0xee, (byte) 0xff,
- 0, 0, 0, 0
- };
- assertArrayEquals(expectedMatch, request.match);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIp4WriterTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIp4WriterTest.java
deleted file mode 100644
index f3a9d0f87..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIp4WriterTest.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import static io.fd.honeycomb.translate.v3po.interfaces.acl.common.AclTranslator.VLAN_TAG_LEN;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.PacketHandling;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.packet.handling.DenyBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIp;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIpBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.ace.ip.version.AceIpv4Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.acl.transport.header.fields.DestinationPortRangeBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.acl.transport.header.fields.SourcePortRangeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
-
-public class AceIp4WriterTest {
-
- private AceIp4Writer writer;
- private PacketHandling action;
- private AceIp aceIp;
-
- @Before
- public void setUp() throws Exception {
- initMocks(this);
- writer = new AceIp4Writer();
- action = new DenyBuilder().setDeny(true).build();
- aceIp = new AceIpBuilder()
- .setProtocol((short) 132)
- .setDscp(new Dscp((short) 11))
- .setAceIpVersion(new AceIpv4Builder()
- .setSourceIpv4Network(new Ipv4Prefix("1.2.3.4/32"))
- .setDestinationIpv4Network(new Ipv4Prefix("1.2.4.5/24"))
- .build())
- .setSourcePortRange(new SourcePortRangeBuilder().setLowerPort(new PortNumber(0x1111)).build())
- .setDestinationPortRange(new DestinationPortRangeBuilder().setLowerPort(new PortNumber(0x2222)).build())
- .build();
- }
-
- private static void verifyTableRequest(final ClassifyAddDelTable request, final int nextTableIndex,
- final int vlanTags, final boolean isL2) {
- assertEquals(1, request.isAdd);
- assertEquals(-1, request.tableIndex);
- assertEquals(1, request.nbuckets);
- assertEquals(nextTableIndex, request.nextTableIndex);
- assertEquals(0, request.skipNVectors);
- assertEquals(AceIp4Writer.MATCH_N_VECTORS, request.matchNVectors);
- assertEquals(AceIp4Writer.TABLE_MEM_SIZE, request.memorySize);
-
- byte[] expectedMask = new byte[] {
- // L2:
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- // dscp:
- (byte) 0x00, (byte) 0xfc,
- // protocol:
- 0, 0, 0, 0, 0, 0, 0, (byte) 0xff, 0, 0,
- // source address:
- -1, -1, -1, -1,
- // destination address:
- -1, -1, -1, 0,
- // source and destination port:
- -1, -1, -1, -1,
- // padding:
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- };
-
- if (isL2) {
- expectedMask[12] = (byte) 0xff;
- expectedMask[13] = (byte) 0xff;
- }
- AceIpWriterTestUtils
- .assertArrayEqualsWithOffset(expectedMask, expectedMask.length, request.mask, vlanTags * VLAN_TAG_LEN);
-
- }
-
- private static void verifySessionRequest(final ClassifyAddDelSession request, final int tableIndex,
- final int vlanTags, final boolean isL2) {
- assertEquals(1, request.isAdd);
- assertEquals(tableIndex, request.tableIndex);
- assertEquals(0, request.hitNextIndex);
-
- byte[] expectedMatch = new byte[] {
- // L2:
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- // dscp:
- 0, (byte) 0x2c,
- // protocol (132):
- 0, 0, 0, 0, 0, 0, 0, (byte) 132, 0, 0,
- // source address:
- 1, 2, 3, 4,
- // destination address:
- 1, 2, 4, 0,
- // source and destination port:
- 0x11, 0x11, 0x22, 0x22,
- // padding:
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- };
-
- if (isL2) {
- expectedMatch[12] = (byte) 0x08;
- expectedMatch[13] = (byte) 0x00;
- }
- AceIpWriterTestUtils.assertArrayEqualsWithOffset(expectedMatch, expectedMatch.length, request.match, vlanTags * VLAN_TAG_LEN);
-
- }
-
- @Test
- public void testCreateTable() throws Exception {
- final int nextTableIndex = 42;
- final ClassifyAddDelTable request = writer.createTable(aceIp, InterfaceMode.L3, nextTableIndex, 0);
- verifyTableRequest(request, nextTableIndex, 0, false);
- }
-
- @Test
- public void testCreateTableForL2Interface() throws Exception {
- final int nextTableIndex = 42;
- final ClassifyAddDelTable request = writer.createTable(aceIp, InterfaceMode.L2, nextTableIndex, 0);
- verifyTableRequest(request, nextTableIndex, 0, true);
- }
-
- @Test
- public void testCreateTable1VlanTag() throws Exception {
- final int nextTableIndex = 42;
- final int vlanTags = 1;
- final ClassifyAddDelTable request = writer.createTable(aceIp, InterfaceMode.L3, nextTableIndex, vlanTags);
- verifyTableRequest(request, nextTableIndex, vlanTags, false);
- }
-
- @Test
- public void testCreateTable2VlanTags() throws Exception {
- final int nextTableIndex = 42;
- final int vlanTags = 2;
- final ClassifyAddDelTable request = writer.createTable(aceIp, InterfaceMode.L3, nextTableIndex, vlanTags);
- verifyTableRequest(request, nextTableIndex, vlanTags, false);
- }
-
- @Test
- public void testCreateClassifySession() throws Exception {
- final int tableIndex = 123;
- final ClassifyAddDelSession request = writer.createSession(action, aceIp, InterfaceMode.L3, tableIndex, 0).get(0);
- verifySessionRequest(request, tableIndex, 0, false);
- }
-
- @Test
- public void testCreateClassifySessionForL2Interface() throws Exception {
- final int tableIndex = 123;
- final ClassifyAddDelSession request = writer.createSession(action, aceIp, InterfaceMode.L2, tableIndex, 0).get(0);
- verifySessionRequest(request, tableIndex, 0, true);
- }
-
- @Test
- public void testCreateClassifySession1VlanTag() throws Exception {
- final int tableIndex = 123;
- final int vlanTags = 1;
- final ClassifyAddDelSession request = writer.createSession(action, aceIp, InterfaceMode.L3, tableIndex, vlanTags).get(0);
- verifySessionRequest(request, tableIndex, vlanTags, false);
- }
-
- @Test
- public void testCreateClassifySession2VlanTags() throws Exception {
- final int tableIndex = 123;
- final int vlanTags = 2;
- final ClassifyAddDelSession request = writer.createSession(action, aceIp, InterfaceMode.L3, tableIndex, vlanTags).get(0);
-
- verifySessionRequest(request, tableIndex, vlanTags, false);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIp6WriterTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIp6WriterTest.java
deleted file mode 100644
index 382d8840e..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIp6WriterTest.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import static io.fd.honeycomb.translate.v3po.interfaces.acl.common.AclTranslator.VLAN_TAG_LEN;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.PacketHandling;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.packet.handling.DenyBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIp;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIpBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.ace.ip.version.AceIpv6Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6FlowLabel;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.acl.transport.header.fields.DestinationPortRangeBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.acl.transport.header.fields.SourcePortRangeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
-
-public class AceIp6WriterTest {
-
- private AceIp6Writer writer;
- private PacketHandling action;
- private AceIp aceIp;
-
- @Before
- public void setUp() {
- initMocks(this);
- writer = new AceIp6Writer();
- action = new DenyBuilder().setDeny(true).build();
- aceIp = new AceIpBuilder()
- .setProtocol((short) 132)
- .setDscp(new Dscp((short) 11))
- .setAceIpVersion(new AceIpv6Builder()
- .setFlowLabel(new Ipv6FlowLabel(123L))
- .setSourceIpv6Network(new Ipv6Prefix("2001:db8:85a3:8d3:1319:8a2e:370:7348/128"))
- .setDestinationIpv6Network(new Ipv6Prefix("fe80:1234:5678:abcd:ef01::/64"))
- .build())
- .setSourcePortRange(new SourcePortRangeBuilder().setLowerPort(new PortNumber(0x1111)).build())
- .setDestinationPortRange(new DestinationPortRangeBuilder().setLowerPort(new PortNumber(0x2222)).build())
- .build();
- }
-
-
- private static void verifyTableRequest(final ClassifyAddDelTable request, final int nextTableIndex,
- final int vlanTags, final boolean isL2) {
- assertEquals(1, request.isAdd);
- assertEquals(-1, request.tableIndex);
- assertEquals(1, request.nbuckets);
- assertEquals(nextTableIndex, request.nextTableIndex);
- assertEquals(0, request.skipNVectors);
- assertEquals(vlanTags == 2 ? 5 : 4, request.matchNVectors);
- assertEquals(AceIp6Writer.TABLE_MEM_SIZE, request.memorySize);
-
- byte[] expectedMask = new byte[] {
- // L2:
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- // dscp, flow:
- (byte) 0x0f, (byte) 0xcf, (byte) 0xff, (byte) 0xff,
- // protocol:
- 0, 0, (byte) 0xff, 0,
- // source address:
- (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
- (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
- // destination address:
- (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
- 0, 0, 0, 0, 0, 0, 0, 0,
- // source and destination port:
- -1, -1, -1, -1,
- // padding to multiple of 16B:
- 0, 0, 0, 0, 0, 0
- };
-
- if (isL2) {
- expectedMask[12] = (byte) 0xff;
- expectedMask[13] = (byte) 0xff;
- }
- AceIpWriterTestUtils.assertArrayEqualsWithOffset(expectedMask, vlanTags == 2 ? 80 : 64, request.mask, vlanTags * VLAN_TAG_LEN);
- }
-
- private static void verifySessionRequest(final ClassifyAddDelSession request, final int tableIndex,
- final int vlanTags, final boolean isL2) {
- assertEquals(1, request.isAdd);
- assertEquals(tableIndex, request.tableIndex);
- assertEquals(0, request.hitNextIndex);
-
- byte[] expectedMatch = new byte[] {
- // L2:
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- // dscp(11), flow(123):
- (byte) 0x02, (byte) 0xc0, (byte) 0x00, (byte) 0x7b,
- // protocol (132):
- 0, 0, (byte) 132, 0,
- // source address:
- (byte) 0x20, (byte) 0x01, (byte) 0x0d, (byte) 0xb8, (byte) 0x85, (byte) 0xa3, (byte) 0x08, (byte) 0xd3,
- (byte) 0x13, (byte) 0x19, (byte) 0x8a, (byte) 0x2e, (byte) 0x03, (byte) 0x70, (byte) 0x73, (byte) 0x48,
- // destination address:
- (byte) 0xfe, (byte) 0x80, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0xab, (byte) 0xcd,
- 0, 0, 0, 0, 0, 0, 0, 0,
- // source and destination port:
- 0x11, 0x11, 0x22, 0x22,
- // padding to multiple of 16B:
- 0, 0, 0, 0, 0, 0
- };
-
- if (isL2) {
- expectedMatch[12] = (byte) 0x86;
- expectedMatch[13] = (byte) 0xdd;
- }
- AceIpWriterTestUtils.assertArrayEqualsWithOffset(expectedMatch, vlanTags == 2 ? 80 : 64, request.match, vlanTags * VLAN_TAG_LEN);
-
- }
-
- @Test
- public void testCreateTable() {
- final int nextTableIndex = 42;
- final ClassifyAddDelTable request =
- writer.createTable(aceIp, InterfaceMode.L3, nextTableIndex, 0);
- verifyTableRequest(request, nextTableIndex, 0, false);
- }
-
- @Test
- public void testCreateTableForL2Interface() {
- final int nextTableIndex = 42;
- final ClassifyAddDelTable request =
- writer.createTable(aceIp, InterfaceMode.L2, nextTableIndex, 0);
- verifyTableRequest(request, nextTableIndex, 0, true);
- }
-
- @Test
- public void testCreateTable1VlanTag() {
- final int nextTableIndex = 42;
- final int vlanTags = 1;
- final ClassifyAddDelTable request =
- writer.createTable(aceIp, InterfaceMode.L3, nextTableIndex, vlanTags);
- verifyTableRequest(request, nextTableIndex, vlanTags, false);
- }
-
- @Test
- public void testCreateTable2VlanTags() {
- final int nextTableIndex = 42;
- final int vlanTags = 2;
- final ClassifyAddDelTable request =
- writer.createTable(aceIp, InterfaceMode.L3, nextTableIndex, vlanTags);
- verifyTableRequest(request, nextTableIndex, vlanTags, false);
- }
-
- @Test
- public void testCreateClassifySession() {
- final int tableIndex = 123;
- final ClassifyAddDelSession request =
- writer.createSession(action, aceIp, InterfaceMode.L3, tableIndex, 0).get(0);
- verifySessionRequest(request, tableIndex, 0, false);
- }
-
- @Test
- public void testCreateClassifySessionForL2Interface() {
- final int tableIndex = 123;
- final ClassifyAddDelSession request =
- writer.createSession(action, aceIp, InterfaceMode.L2, tableIndex, 0).get(0);
- verifySessionRequest(request, tableIndex, 0, true);
- }
-
- @Test
- public void testCreateClassifySession1VlanTag() {
- final int tableIndex = 123;
- final int vlanTags = 1;
- final ClassifyAddDelSession request =
- writer.createSession(action, aceIp, InterfaceMode.L3, tableIndex, vlanTags).get(0);
- verifySessionRequest(request, tableIndex, vlanTags, false);
- }
-
- @Test
- public void testCreateClassifySession2VlanTags() {
- final int tableIndex = 123;
- final int vlanTags = 2;
- final ClassifyAddDelSession request =
- writer.createSession(action, aceIp, InterfaceMode.L3, tableIndex, vlanTags).get(0);
- verifySessionRequest(request, tableIndex, vlanTags, false);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIpAndEthWriterTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIpAndEthWriterTest.java
deleted file mode 100644
index d224a067f..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIpAndEthWriterTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.PacketHandling;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.packet.handling.DenyBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.acl.transport.header.fields.DestinationPortRangeBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.acl.transport.header.fields.SourcePortRangeBuilder;
-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.vpp.acl.rev161214.InterfaceMode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIpAndEth;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIpAndEthBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.and.eth.ace.ip.version.AceIpv4Builder;
-
-public class AceIpAndEthWriterTest {
-
- private AceIpAndEthWriter writer;
- private PacketHandling action;
- private AceIpAndEth ace;
-
- @Before
- public void setUp() {
- initMocks(this);
- writer = new AceIpAndEthWriter();
- action = new DenyBuilder().setDeny(true).build();
- ace = new AceIpAndEthBuilder()
- .setDestinationMacAddress(new MacAddress("11:22:33:44:55:66"))
- .setSourceMacAddress(new MacAddress("aa:bb:cc:dd:ee:ff"))
- .setAceIpVersion(new AceIpv4Builder()
- .setSourceIpv4Network(new Ipv4Prefix("1.2.3.4/32")).build())
- .setSourcePortRange(new SourcePortRangeBuilder().setLowerPort(new PortNumber(0x1111)).build())
- .setDestinationPortRange(new DestinationPortRangeBuilder().setLowerPort(new PortNumber(0x2222)).build())
- .build();
- }
-
- @Test
- public void testCreateTable() {
- final int nextTableIndex = 42;
- final ClassifyAddDelTable request = writer.createTable(ace, InterfaceMode.L2, nextTableIndex, 0);
-
- assertEquals(1, request.isAdd);
- assertEquals(-1, request.tableIndex);
- assertEquals(1, request.nbuckets);
- assertEquals(nextTableIndex, request.nextTableIndex);
- assertEquals(0, request.skipNVectors);
- assertEquals(3, request.matchNVectors);
- assertEquals(AceEthWriter.TABLE_MEM_SIZE, request.memorySize);
-
- byte[] expectedMask = new byte[] {
- // destination MAC:
- -1, -1, -1, -1, -1, -1,
- // source MAC:
- -1, -1, -1, -1, -1, -1,
- // ether type:
- -1, -1,
- // IP header
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- // source address:
- -1, -1, -1, -1,
- // destination address:
- 0, 0, 0, 0,
- // source and destination port:
- -1, -1, -1, -1,
- // padding:
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- };
- assertArrayEquals(expectedMask, request.mask);
- }
-
- @Test
- public void testCreateClassifySession() {
- final int tableIndex = 123;
- final ClassifyAddDelSession request = writer.createSession(action, ace, InterfaceMode.L2, tableIndex, 0).get(0);
-
- assertEquals(1, request.isAdd);
- assertEquals(tableIndex, request.tableIndex);
- assertEquals(0, request.hitNextIndex);
-
- byte[] expectedMatch = new byte[] {
- // destination MAC:
- (byte) 0x11, (byte) 0x22, (byte) 0x33, (byte) 0x44, (byte) 0x55, (byte) 0x66,
- // source MAC:
- (byte) 0xaa, (byte) 0xbb, (byte) 0xcc, (byte) 0xdd, (byte) 0xee, (byte) 0xff,
- // ether type (IP4):
- 0x08, 0,
- // IP header
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- // source address:
- 1, 2, 3, 4,
- // destination address:
- 0, 0, 0, 0,
- // source and destination port:
- 0x11, 0x11, 0x22, 0x22,
- // padding:
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- };
- assertArrayEquals(expectedMatch, request.match);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIpWriterTestUtils.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIpWriterTestUtils.java
deleted file mode 100644
index 59e22a87b..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AceIpWriterTestUtils.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import static org.junit.Assert.assertArrayEquals;
-
-final class AceIpWriterTestUtils {
-
- private AceIpWriterTestUtils() {
- throw new UnsupportedOperationException("This utility class cannot be instantiated");
- }
-
- protected static void assertArrayEqualsWithOffset(final byte[] baseExpected, final int expectedLength, final byte[] actual,
- final int offset) {
- byte[] expected = new byte[expectedLength];
- System.arraycopy(baseExpected, 0, expected, offset, Math.min(baseExpected.length, expectedLength-offset));
-
- assertArrayEquals(expected, actual);
- }
-}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AclTableContextManagerImplTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AclTableContextManagerImplTest.java
deleted file mode 100644
index 490e26b2b..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/AclTableContextManagerImplTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import static org.mockito.Mockito.verify;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import io.fd.honeycomb.translate.MappingContext;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.MappingTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.mapping.table.MappingEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.mapping.table.MappingEntryBuilder;
-
-public class AclTableContextManagerImplTest {
-
- private AclTableContextManagerImpl ctx;
- @Mock
- private MappingContext mappingContext;
- private static final int INDEX = 42;
-
- @Before
- public void setUp() throws Exception {
- initMocks(this);
- ctx = new AclTableContextManagerImpl(MappingTable.Direction.Ingress);
- }
-
- @Test
- public void testAddEntry() throws Exception {
- final MappingEntry entry =
- new MappingEntryBuilder().setL2TableId(1).setIp4TableId(2).setIp6TableId(3).setIndex(INDEX).build();
- ctx.addEntry(entry, mappingContext);
- verify(mappingContext).put(ctx.getId(INDEX), entry);
- }
-
- @Test
- public void testRemoveEntry() throws Exception {
- ctx.removeEntry(INDEX, mappingContext);
- verify(mappingContext).delete(ctx.getId(INDEX));
- }
-
- @Test
- public void testReadEntry() throws Exception {
- ctx.getEntry(INDEX, mappingContext);
- verify(mappingContext).read(ctx.getId(INDEX));
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/PortPairTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/PortPairTest.java
deleted file mode 100644
index 2127fb0fa..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/common/PortPairTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.common;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.contains;
-import static org.hamcrest.Matchers.hasSize;
-
-import java.util.List;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.acl.transport.header.fields.DestinationPortRange;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.acl.transport.header.fields.DestinationPortRangeBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.acl.transport.header.fields.SourcePortRange;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.acl.transport.header.fields.SourcePortRangeBuilder;
-
-public class PortPairTest {
-
- @Test
- public void testSingleSrc() {
- final SourcePortRange src = new SourcePortRangeBuilder().setLowerPort(new PortNumber(123)).build();
- final List<PortPair> portPairs = PortPair.fromRange(src, null);
- assertThat(portPairs, hasSize(1));
- assertThat(portPairs, contains(new PortPair(123, null)));
- }
-
- @Test
- public void testSrcRange() {
- final SourcePortRange src = new SourcePortRangeBuilder()
- .setLowerPort(new PortNumber(123))
- .setUpperPort(new PortNumber(125)).build();
- final List<PortPair> portPairs = PortPair.fromRange(src, null);
- assertThat(portPairs, hasSize(3));
- assertThat(portPairs, contains(new PortPair(123, null), new PortPair(124, null), new PortPair(125, null)));
- }
-
- @Test
- public void testSrcRangeWithDst() {
- final SourcePortRange src = new SourcePortRangeBuilder()
- .setLowerPort(new PortNumber(123))
- .setUpperPort(new PortNumber(125)).build();
- final DestinationPortRange dst = new DestinationPortRangeBuilder().setLowerPort(new PortNumber(111)).build();
- final List<PortPair> portPairs = PortPair.fromRange(src, dst);
- assertThat(portPairs, hasSize(3));
- assertThat(portPairs, contains(new PortPair(123, 111), new PortPair(124, 111), new PortPair(125, 111)));
- }
-
- @Test
- public void testSingleDst() {
- final DestinationPortRange dst = new DestinationPortRangeBuilder().setLowerPort(new PortNumber(123)).build();
- final List<PortPair> portPairs = PortPair.fromRange(null, dst);
- assertThat(portPairs, hasSize(1));
- assertThat(portPairs, contains(new PortPair(null, 123)));
- }
-
- @Test
- public void testDstRange() {
- final DestinationPortRange dst = new DestinationPortRangeBuilder()
- .setLowerPort(new PortNumber(10))
- .setUpperPort(new PortNumber(11)).build();
- final List<PortPair> portPairs = PortPair.fromRange(null, dst);
- assertThat(portPairs, hasSize(2));
- assertThat(portPairs, contains(new PortPair(null, 10), new PortPair(null, 11)));
- }
-
- @Test
- public void testDstRangeWithSrc() {
- final SourcePortRange src = new SourcePortRangeBuilder().setLowerPort(new PortNumber(111)).build();
- final DestinationPortRange dst = new DestinationPortRangeBuilder()
- .setLowerPort(new PortNumber(10))
- .setUpperPort(new PortNumber(11)).build();
- final List<PortPair> portPairs = PortPair.fromRange(src, dst);
- assertThat(portPairs, hasSize(2));
- assertThat(portPairs, contains(new PortPair(111, 10), new PortPair(111, 11)));
- }
-
- @Test
- public void testSinglePair() {
- final SourcePortRange src = new SourcePortRangeBuilder().setLowerPort(new PortNumber(123)).build();
- final DestinationPortRange dst = new DestinationPortRangeBuilder().setLowerPort(new PortNumber(321)).build();
- final List<PortPair> portPairs = PortPair.fromRange(src, dst);
- assertThat(portPairs, hasSize(1));
- assertThat(portPairs, contains(new PortPair(123, 321)));
- }
-
- @Test
- public void testCartesianProduct() {
- final SourcePortRange src = new SourcePortRangeBuilder()
- .setLowerPort(new PortNumber(1))
- .setUpperPort(new PortNumber(2)).build();
- final DestinationPortRange dst = new DestinationPortRangeBuilder()
- .setLowerPort(new PortNumber(1))
- .setUpperPort(new PortNumber(3)).build();
- final List<PortPair> portPairs = PortPair.fromRange(src, dst);
- assertThat(portPairs, hasSize(6));
- assertThat(portPairs,
- contains(new PortPair(1, 1), new PortPair(1, 2), new PortPair(1, 3), new PortPair(2, 1), new PortPair(2, 2),
- new PortPair(2, 3)));
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/EgressIetfAclWriterTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/EgressIetfAclWriterTest.java
deleted file mode 100644
index e1aa0b85e..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/EgressIetfAclWriterTest.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.egress;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.common.AclTableContextManager;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSessionReply;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTableReply;
-import io.fd.vpp.jvpp.core.dto.ClassifySetInterfaceL2Tables;
-import io.fd.vpp.jvpp.core.dto.ClassifySetInterfaceL2TablesReply;
-import java.util.Collections;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.AclBase;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.EthAcl;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.AccessListEntriesBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.AceBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.ActionsBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.MatchesBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.packet.handling.PermitBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIpBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.ace.ip.version.AceIpv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Egress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.EgressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.mapping.table.MappingEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessLists;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessListsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.access.lists.AclBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class EgressIetfAclWriterTest extends WriterCustomizerTest {
-
- private static final int IF_INDEX = 1;
- private static final String ACL_NAME = "acl1";
- private static final Class<? extends AclBase> ACL_TYPE = EthAcl.class;
-
- private EgressIetfAclWriter writer;
- @Mock
- private AclTableContextManager aclCtx;
- @Mock
- private InstanceIdentifier<?> id;
-
- @Override
- protected void setUp() throws Exception {
- writer = new EgressIetfAclWriter(api, aclCtx);
- }
-
- private static ClassifyAddDelTable classifyAddDelTable(final int tableIndex) {
- final ClassifyAddDelTable reply = new ClassifyAddDelTable();
- reply.tableIndex = tableIndex;
- return reply;
- }
-
- private ClassifySetInterfaceL2Tables classifySetInterfaceL2TablesRequest() {
- final ClassifySetInterfaceL2Tables request = new ClassifySetInterfaceL2Tables();
- request.isInput = 0;
- request.ip4TableIndex = -1;
- request.ip6TableIndex = -1;
- request.otherTableIndex = -1;
- request.swIfIndex = IF_INDEX;
- return request;
- }
-
- @Test
- public void testDeleteAcl() throws Exception {
- when(api.classifyAddDelTable(any())).thenReturn(future(new ClassifyAddDelTableReply()));
- when(api.classifySetInterfaceL2Tables(any())).thenReturn(future(new ClassifySetInterfaceL2TablesReply()));
- when(aclCtx.getEntry(IF_INDEX, mappingContext)).thenReturn(Optional.of(
- new MappingEntryBuilder()
- .setIndex(IF_INDEX)
- .setL2TableId(1)
- .setIp4TableId(2)
- .setIp6TableId(3)
- .build()));
-
- writer.deleteAcl(id, IF_INDEX, mappingContext);
-
- verify(api).classifySetInterfaceL2Tables(classifySetInterfaceL2TablesRequest());
- verify(api).classifyAddDelTable(classifyAddDelTable(1));
- verify(api).classifyAddDelTable(classifyAddDelTable(2));
- verify(api).classifyAddDelTable(classifyAddDelTable(3));
- verify(aclCtx).removeEntry(IF_INDEX, mappingContext);
- }
-
- @Test
- public void testWrite() throws Exception {
- when(api.classifyAddDelTable(any())).thenReturn(future(new ClassifyAddDelTableReply()));
- when(api.classifyAddDelSession(any())).thenReturn(future(new ClassifyAddDelSessionReply()));
- when(api.classifySetInterfaceL2Tables(any())).thenReturn(future(new ClassifySetInterfaceL2TablesReply()));
-
- final Egress
- acl = new EgressBuilder().setAccessLists(
- new AccessListsBuilder().setAcl(
- Collections.singletonList(new AclBuilder()
- .setName(ACL_NAME)
- .setType(ACL_TYPE)
- .build())
- ).setMode(InterfaceMode.L2).build()
- ).build();
-
- final AccessLists accessLists = acl.getAccessLists();
-
- when(writeContext.readAfter(any())).thenReturn(Optional.of(
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.AclBuilder()
- .setAccessListEntries(
- new AccessListEntriesBuilder().setAce(Collections.singletonList(new AceBuilder()
- .setMatches(new MatchesBuilder().setAceType(
- new AceIpBuilder()
- .setAceIpVersion(new AceIpv4Builder().build())
- .setProtocol((short) 1)
- .build()
- ).build())
- .setActions(new ActionsBuilder().setPacketHandling(new PermitBuilder().build()).build())
- .build())).build()
- ).build()
-
- ));
-
- writer.write(id, IF_INDEX, accessLists.getAcl(), accessLists.getDefaultAction(), accessLists.getMode(),
- writeContext, mappingContext);
-
- final ClassifySetInterfaceL2Tables request = new ClassifySetInterfaceL2Tables();
- request.isInput = 0;
- request.swIfIndex = IF_INDEX;
- request.otherTableIndex = -1;
- request.ip4TableIndex = 0;
- request.ip6TableIndex = -1;
- verify(api).classifySetInterfaceL2Tables(request);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/IetfAclCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/IetfAclCustomizerTest.java
deleted file mode 100644
index 2be2212ff..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/IetfAclCustomizerTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.egress;
-
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-
-import io.fd.honeycomb.translate.v3po.interfaces.acl.common.IetfAclWriter;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import java.util.Collections;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.AclBase;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.IetfAcl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Egress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.EgressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.MixedAcl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessLists;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessListsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.access.lists.AclBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class IetfAclCustomizerTest extends WriterCustomizerTest {
- private static final String IFC_TEST_INSTANCE = "ifc-test-instance";
- private static final String IF_NAME = "local0";
- private static final int IF_INDEX = 1;
- private static final InstanceIdentifier<Egress> IID =
- InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IF_NAME)).augmentation(
- VppInterfaceAugmentation.class).child(IetfAcl.class).child(Egress.class);
- private static final String ACL_NAME = "acl1";
- private static final Class<? extends AclBase> ACL_TYPE = MixedAcl.class;
-
- @Mock
- private IetfAclWriter aclWriter;
- private IetfAclCustomizer customizer;
-
- @Override
- protected void setUp() {
- customizer = new IetfAclCustomizer(aclWriter, new NamingContext("prefix", IFC_TEST_INSTANCE));
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_TEST_INSTANCE);
- }
-
- private static Egress acl(final InterfaceMode mode) {
- return new EgressBuilder().setAccessLists(
- new AccessListsBuilder().setAcl(
- Collections.singletonList(new AclBuilder()
- .setName(ACL_NAME)
- .setType(ACL_TYPE)
- .build())
- ).setMode(mode)
- .build()
- ).build();
- }
-
- private void verifyWrite(final AccessLists accessLists) throws WriteFailedException {
- verify(aclWriter)
- .write(IID, IF_INDEX, accessLists.getAcl(), accessLists.getDefaultAction(), accessLists.getMode(),
- writeContext, mappingContext);
- }
-
- private void verifyDelete() throws WriteFailedException {
- verify(aclWriter).deleteAcl(IID, IF_INDEX, mappingContext);
- }
-
- @Test
- public void testWriteL3() throws Exception {
- customizer.writeCurrentAttributes(IID, acl(InterfaceMode.L3), writeContext);
- verifyZeroInteractions(aclWriter);
- }
-
- @Test
- public void testWriteL2() throws Exception {
- final Egress acl = acl(InterfaceMode.L2);
- customizer.writeCurrentAttributes(IID, acl, writeContext);
- verifyWrite(acl.getAccessLists());
- }
-
- @Test
- public void testUpdate() throws Exception {
- final Egress aclBefore = acl(InterfaceMode.L3);
- final Egress aclAfter = acl(InterfaceMode.L2);
- customizer.updateCurrentAttributes(IID, aclBefore, aclAfter, writeContext);
- verifyDelete();
- verifyWrite(aclAfter.getAccessLists());
- }
-
- @Test
- public void testDelete() throws Exception {
- final Egress acl = acl(InterfaceMode.L2);
- customizer.deleteCurrentAttributes(IID, acl, writeContext);
- verifyDelete();
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/SubInterfaceIetfAclCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/SubInterfaceIetfAclCustomizerTest.java
deleted file mode 100644
index abefa2465..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/egress/SubInterfaceIetfAclCustomizerTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.egress;
-
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-import static org.mockito.Mockito.when;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.common.IetfAclWriter;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import java.util.Collections;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.AclBase;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.InterfaceMode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.MixedAcl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessLists;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessListsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.access.lists.AclBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.SubInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterfaceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.IetfAcl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.Egress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.EgressBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class SubInterfaceIetfAclCustomizerTest extends WriterCustomizerTest {
- private static final String IFC_TEST_INSTANCE = "ifc-test-instance";
- private static final String IF_NAME = "local0";
- private static final int IF_INDEX = 1;
- private static final String SUBIF_NAME = "local0.0";
- private static final int SUBIF_INDEX = 11;
- private static final long SUBIF_ID = 0;
- private static final InstanceIdentifier<Egress> IID =
- InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IF_NAME)).augmentation(
- SubinterfaceAugmentation.class).child(SubInterfaces.class)
- .child(SubInterface.class, new SubInterfaceKey(SUBIF_ID)).child(IetfAcl.class).child(Egress.class);
- private static final String ACL_NAME = "acl1";
- private static final Class<? extends AclBase> ACL_TYPE = MixedAcl.class;
-
- @Mock
- private IetfAclWriter aclWriter;
- private SubInterfaceIetfAclCustomizer customizer;
-
- @Override
- protected void setUp() {
- customizer = new SubInterfaceIetfAclCustomizer(aclWriter, new NamingContext("prefix", IFC_TEST_INSTANCE));
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_TEST_INSTANCE);
- defineMapping(mappingContext, SUBIF_NAME, SUBIF_INDEX, IFC_TEST_INSTANCE);
-
-
- when(writeContext.readAfter(IID.firstIdentifierOf(SubInterface.class))).thenReturn(Optional.of(
- new SubInterfaceBuilder().build()
- ));
- }
-
- private static Egress acl(final InterfaceMode mode) {
- return new EgressBuilder().setAccessLists(
- new AccessListsBuilder().setAcl(
- Collections.singletonList(new AclBuilder()
- .setName(ACL_NAME)
- .setType(ACL_TYPE)
- .build())
- ).setMode(mode)
- .build()
- ).build();
- }
-
- private void verifyWrite(final AccessLists accessLists) throws WriteFailedException {
- verify(aclWriter)
- .write(IID, SUBIF_INDEX, accessLists.getAcl(), accessLists.getDefaultAction(), accessLists.getMode(),
- writeContext, 0, mappingContext);
- }
-
- private void verifyDelete() throws WriteFailedException {
- verify(aclWriter).deleteAcl(IID, SUBIF_INDEX, mappingContext);
- }
-
- @Test
- public void testWriteL3() throws Exception {
- customizer.writeCurrentAttributes(IID, acl(InterfaceMode.L3), writeContext);
- verifyZeroInteractions(aclWriter);
- }
-
- @Test
- public void testWriteL2() throws Exception {
- final Egress acl = acl(InterfaceMode.L2);
- customizer.writeCurrentAttributes(IID, acl, writeContext);
- verifyWrite(acl.getAccessLists());
- }
-
- @Test
- public void testUpdate() throws Exception {
- final Egress aclBefore = acl(InterfaceMode.L3);
- final Egress aclAfter = acl(InterfaceMode.L2);
- customizer.updateCurrentAttributes(IID, aclBefore, aclAfter, writeContext);
- verifyDelete();
- verifyWrite(aclAfter.getAccessLists());
- }
-
- @Test
- public void testDelete() throws Exception {
- final Egress acl = acl(InterfaceMode.L2);
- customizer.deleteCurrentAttributes(IID, acl, writeContext);
- verifyDelete();
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclCustomizerTest.java
deleted file mode 100644
index 8a4e9213d..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclCustomizerTest.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.ingress;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.common.AclTableContextManager;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSessionReply;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTableReply;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableByInterface;
-import io.fd.vpp.jvpp.core.dto.InputAclSetInterface;
-import io.fd.vpp.jvpp.core.dto.InputAclSetInterfaceReply;
-import java.util.Arrays;
-import java.util.Collections;
-import org.junit.Test;
-import org.mockito.ArgumentMatcher;
-import org.mockito.InOrder;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.AclBase;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.EthAcl;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.AccessListEntriesBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.Ace;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.AceBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.ActionsBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.MatchesBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.PacketHandling;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.packet.handling.Deny;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.packet.handling.DenyBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.packet.handling.Permit;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.packet.handling.PermitBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIpBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.ace.ip.version.AceIpv6Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.IetfAcl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.Ingress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.ietf.acl.IngressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.mapping.table.MappingEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessListsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.access.lists.AclBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class IetfAclCustomizerTest extends WriterCustomizerTest {
-
- private static final String IFC_TEST_INSTANCE = "ifc-test-instance";
- private static final String IF_NAME = "local0";
- private static final int IF_INDEX = 1;
- private static final InstanceIdentifier<Ingress> IID =
- InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IF_NAME)).augmentation(
- VppInterfaceAugmentation.class).child(IetfAcl.class).child(Ingress.class);
- private static final String ACL_NAME = "acl1";
- private static final Class<? extends AclBase> ACL_TYPE = EthAcl.class;
-
- @Mock
- private AclTableContextManager aclCtx;
-
- private IetfAclCustomizer customizer;
- private Ingress acl;
- private int DENY = 0;
- private int PERMIT = -1;
-
- @Override
- protected void setUp() {
- customizer = new IetfAclCustomizer(new IngressIetfAclWriter(api, aclCtx), new NamingContext("prefix", IFC_TEST_INSTANCE));
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_TEST_INSTANCE);
- acl = new IngressBuilder().setAccessLists(
- new AccessListsBuilder().setAcl(
- Collections.singletonList(new AclBuilder()
- .setName(ACL_NAME)
- .setType(ACL_TYPE)
- .build())
- ).build()
- ).build();
- }
-
- @Test
- public void testWrite() throws WriteFailedException {
- when(api.classifyAddDelTable(any())).thenReturn(future(new ClassifyAddDelTableReply()));
- when(api.classifyAddDelSession(any())).thenReturn(future(new ClassifyAddDelSessionReply()));
-
- when(writeContext.readAfter(any())).thenReturn(Optional.of(
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.AclBuilder()
- .setAccessListEntries(
- new AccessListEntriesBuilder().setAce(Arrays.asList(ace(permit()), ace(permit()), ace(deny())
- )).build()
- ).build()
-
- ));
- when(api.inputAclSetInterface(any())).thenReturn(future(new InputAclSetInterfaceReply()));
-
- customizer.writeCurrentAttributes(IID, acl, writeContext);
-
- final InOrder inOrder = Mockito.inOrder(api);
- inOrder.verify(api).classifyAddDelTable(argThat(actionOnMissEquals(DENY))); // default action
- inOrder.verify(api).classifyAddDelTable(any());
- inOrder.verify(api).classifyAddDelSession(argThat(actionOnHitEquals(DENY))); // last deny ACE
- inOrder.verify(api).classifyAddDelTable(any());
- inOrder.verify(api).classifyAddDelSession(argThat(actionOnHitEquals(PERMIT)));
- inOrder.verify(api).classifyAddDelTable(any());
- inOrder.verify(api).classifyAddDelSession(argThat(actionOnHitEquals(PERMIT)));
- inOrder.verify(api).inputAclSetInterface(inputAclSetInterfaceWriteRequest()); // assignment
- }
-
- private ArgumentMatcher<ClassifyAddDelTable> actionOnMissEquals(final int action) {
- return table -> table.missNextIndex == action;
- }
-
-
- private ArgumentMatcher<ClassifyAddDelSession> actionOnHitEquals(final int action) {
- return session -> session.hitNextIndex == action;
- }
-
- private Deny deny() {
- return new DenyBuilder().build();
- }
-
- private Permit permit() {
- return new PermitBuilder().build();
- }
-
- private static Ace ace(final PacketHandling action) {
- return new AceBuilder()
- .setMatches(new MatchesBuilder().setAceType(
- new AceIpBuilder()
- .setAceIpVersion(new AceIpv6Builder().build())
- .setProtocol((short) 1)
- .build()
- ).build())
- .setActions(new ActionsBuilder().setPacketHandling(action).build())
- .build();
- }
-
- @Test
- public void testDelete() throws WriteFailedException {
- when(api.inputAclSetInterface(any())).thenReturn(future(new InputAclSetInterfaceReply()));
- when(api.classifyAddDelTable(any())).thenReturn(future(new ClassifyAddDelTableReply()));
- when(aclCtx.getEntry(IF_INDEX, mappingContext)).thenReturn(Optional.of(
- new MappingEntryBuilder()
- .setIndex(IF_INDEX)
- .setL2TableId(1)
- .setIp4TableId(2)
- .setIp6TableId(3)
- .build()));
-
- customizer.deleteCurrentAttributes(IID, acl, writeContext);
-
- final ClassifyTableByInterface expectedRequest = new ClassifyTableByInterface();
- expectedRequest.swIfIndex = IF_INDEX;
- verify(api).inputAclSetInterface(inputAclSetInterfaceDeleteRequest());
- verify(api).classifyAddDelTable(classifyAddDelTable(1));
- verify(api).classifyAddDelTable(classifyAddDelTable(2));
- verify(api).classifyAddDelTable(classifyAddDelTable(3));
- }
-
- private static InputAclSetInterface inputAclSetInterfaceDeleteRequest() {
- final InputAclSetInterface request = new InputAclSetInterface();
- request.swIfIndex = IF_INDEX;
- request.l2TableIndex = 1;
- request.ip4TableIndex = 2;
- request.ip6TableIndex = 3;
- return request;
- }
-
- private static ClassifyAddDelTable classifyAddDelTable(final int tableIndex) {
- final ClassifyAddDelTable reply = new ClassifyAddDelTable();
- reply.tableIndex = tableIndex;
- return reply;
- }
-
- private static InputAclSetInterface inputAclSetInterfaceWriteRequest() {
- final InputAclSetInterface request = new InputAclSetInterface();
- request.swIfIndex = IF_INDEX;
- request.isAdd = 1;
- request.l2TableIndex = -1;
- request.ip4TableIndex = -1;
- request.ip6TableIndex = 0;
- return request;
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizerTest.java
deleted file mode 100644
index d4cfd6104..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizerTest.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.ingress;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.InputAclSetInterface;
-import io.fd.vpp.jvpp.core.dto.InputAclSetInterfaceReply;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip4Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip4AclBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip6Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip6AclBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.SubInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.acl.Ingress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.acl.IngressBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class SubInterfaceAclCustomizerTest extends WriterCustomizerTest {
- private static final String IFC_TEST_INSTANCE = "ifc-test-instance";
- private static final String IF_NAME = "local0";
- private static final int IF_INDEX = 1;
- private static final String SUBIF_NAME = "local0.0";
- private static final int SUBIF_INDEX = 11;
- private static final long SUBIF_ID = 0;
- private static final String TABLE_NAME = "table0";
- private static final int TABLE_INDEX = 123;
-
- private static final InstanceIdentifier<Ingress> IID =
- InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IF_NAME)).augmentation(
- SubinterfaceAugmentation.class).child(SubInterfaces.class)
- .child(SubInterface.class, new SubInterfaceKey(SUBIF_ID)).child(Acl.class).child(Ingress.class);
-
- @Mock
- private VppClassifierContextManager classifyTableContext;
-
- private SubInterfaceAclCustomizer customizer;
-
- @Override
- protected void setUp() throws Exception {
- customizer = new SubInterfaceAclCustomizer(api, new NamingContext("prefix", IFC_TEST_INSTANCE),
- classifyTableContext);
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_TEST_INSTANCE);
- defineMapping(mappingContext, SUBIF_NAME, SUBIF_INDEX, IFC_TEST_INSTANCE);
- when(classifyTableContext.getTableIndex(TABLE_NAME, mappingContext)).thenReturn(TABLE_INDEX);
- }
-
- @Test
- public void testCreate() throws WriteFailedException {
- when(api.inputAclSetInterface(any())).thenReturn(future(new InputAclSetInterfaceReply()));
- customizer.writeCurrentAttributes(IID, ip4Acl(), writeContext);
- verify(api).inputAclSetInterface(expectedIp4AclRequest());
- }
-
- @Test(expected = WriteFailedException.class)
- public void testCreateFailed() throws WriteFailedException {
- when(api.inputAclSetInterface(any())).thenReturn(failedFuture());
- customizer.writeCurrentAttributes(IID, ip4Acl(), writeContext);
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdate() throws WriteFailedException {
- customizer.updateCurrentAttributes(IID, ip4Acl(), ip6Acl(), writeContext);
- }
-
- @Test
- public void testDelete() throws Exception {
- when(api.inputAclSetInterface(any())).thenReturn(future(new InputAclSetInterfaceReply()));
- customizer.deleteCurrentAttributes(IID, ip6Acl(), writeContext);
- verify(api).inputAclSetInterface(expectedIp6AclRequest());
- }
-
- @Test(expected = WriteFailedException.class)
- public void testDeleteFailed() throws WriteFailedException {
- when(api.inputAclSetInterface(any())).thenReturn(failedFuture());
- customizer.deleteCurrentAttributes(IID, ip4Acl(), writeContext);
- }
-
- private Ingress ip4Acl() {
- final IngressBuilder builder = new IngressBuilder();
- final Ip4Acl acl = new Ip4AclBuilder().setClassifyTable(TABLE_NAME).build();
- builder.setIp4Acl(acl);
- return builder.build();
- }
-
- private InputAclSetInterface expectedIp4AclRequest() {
- final InputAclSetInterface request = new InputAclSetInterface();
- request.isAdd = 1;
- request.l2TableIndex = -1;
- request.ip4TableIndex = TABLE_INDEX;
- request.ip6TableIndex = -1;
- request.swIfIndex = SUBIF_INDEX;
- return request;
- }
-
- private Ingress ip6Acl() {
- final IngressBuilder builder = new IngressBuilder();
- final Ip6Acl acl = new Ip6AclBuilder().setClassifyTable(TABLE_NAME).build();
- builder.setIp6Acl(acl);
- return builder.build();
- }
-
- private InputAclSetInterface expectedIp6AclRequest() {
- final InputAclSetInterface request = new InputAclSetInterface();
- request.isAdd = 0;
- request.l2TableIndex = -1;
- request.ip4TableIndex = -1;
- request.ip6TableIndex = TABLE_INDEX;
- request.swIfIndex = SUBIF_INDEX;
- return request;
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceIetfAclCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceIetfAclCustomizerTest.java
deleted file mode 100644
index 75f2b8ec8..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceIetfAclCustomizerTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.acl.ingress;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.v3po.interfaces.acl.common.AclTableContextManager;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableByInterface;
-import io.fd.vpp.jvpp.core.dto.InputAclSetInterface;
-import io.fd.vpp.jvpp.core.dto.InputAclSetInterfaceReply;
-import java.util.Collections;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.AclBase;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.EthAcl;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.AclKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.AccessListEntriesBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.mapping.table.MappingEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.AccessListsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.ietf.acl.base.attributes.access.lists.AclBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.SubInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterfaceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.IetfAcl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.Ingress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.ietf.acl.IngressBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class SubInterfaceIetfAclCustomizerTest extends WriterCustomizerTest {
-
- private static final String IFC_TEST_INSTANCE = "ifc-test-instance";
- private static final String IF_NAME = "local0";
- private static final int IF_INDEX = 1;
- private static final String SUBIF_NAME = "local0.123";
- private static final int SUBIF_INDEX = 2;
- private static final long SUB_IF_ID = 123;
- private static final InstanceIdentifier<Ingress> IID =
- InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IF_NAME)).augmentation(
- SubinterfaceAugmentation.class).child(SubInterfaces.class)
- .child(SubInterface.class, new SubInterfaceKey(SUB_IF_ID)).child(IetfAcl.class).child(Ingress.class);
- private static final String ACL_NAME = "acl1";
- private static final Class<? extends AclBase> ACL_TYPE = EthAcl.class;
-
- private SubInterfaceIetfAclCustomizer customizer;
- private Ingress acl;
-
- @Mock
- private AclTableContextManager aclCtx;
-
- @Override
- protected void setUp() {
- customizer =
- new SubInterfaceIetfAclCustomizer(new IngressIetfAclWriter(api, aclCtx), new NamingContext("prefix", IFC_TEST_INSTANCE));
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_TEST_INSTANCE);
-
- acl = new IngressBuilder().setAccessLists(
- new AccessListsBuilder().setAcl(
- Collections.singletonList(new AclBuilder()
- .setName(ACL_NAME)
- .setType(ACL_TYPE)
- .build())
- ).build()
- ).build();
- }
-
- private static InputAclSetInterface inputAclSetInterfaceWriteRequest() {
- final InputAclSetInterface request = new InputAclSetInterface();
- request.swIfIndex = SUBIF_INDEX;
- request.isAdd = 1;
- request.l2TableIndex = -1;
- request.ip4TableIndex = -1;
- request.ip6TableIndex = -1;
- return request;
- }
-
- @Test
- public void testDelete() throws WriteFailedException {
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_TEST_INSTANCE);
- defineMapping(mappingContext, SUBIF_NAME, SUBIF_INDEX, IFC_TEST_INSTANCE);
- when(api.inputAclSetInterface(any())).thenReturn(future(new InputAclSetInterfaceReply()));
- when(aclCtx.getEntry(SUBIF_INDEX, mappingContext)).thenReturn(Optional.of(
- new MappingEntryBuilder()
- .setIndex(SUBIF_INDEX)
- .setL2TableId(-1)
- .setIp4TableId(-1)
- .setIp6TableId(-1)
- .build()));
-
- customizer.deleteCurrentAttributes(IID, acl, writeContext);
-
- final ClassifyTableByInterface expectedRequest = new ClassifyTableByInterface();
- expectedRequest.swIfIndex = SUBIF_INDEX;
- verify(api).inputAclSetInterface(inputAclSetInterfaceDeleteRequest());
- }
-
- private static InputAclSetInterface inputAclSetInterfaceDeleteRequest() {
- final InputAclSetInterface request = new InputAclSetInterface();
- request.swIfIndex = SUBIF_INDEX;
- request.l2TableIndex = -1;
- request.ip4TableIndex = -1;
- request.ip6TableIndex = -1;
- return request;
- }
-
- @Test
- public void testWrite() throws WriteFailedException {
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_TEST_INSTANCE);
- defineMapping(mappingContext, SUBIF_NAME, SUBIF_INDEX, IFC_TEST_INSTANCE);
-
- when(writeContext.readAfter(IID.firstIdentifierOf(SubInterface.class))).thenReturn(Optional.of(
- new SubInterfaceBuilder().build()
- ));
-
- when(writeContext.readAfter(io.fd.honeycomb.translate.v3po.interfaces.acl.IetfAclWriter.ACL_ID.child(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.Acl.class,
- new AclKey(ACL_NAME, ACL_TYPE)))).thenReturn(Optional.of(
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.AclBuilder()
- .setAccessListEntries(
- new AccessListEntriesBuilder().setAce(Collections.emptyList()).build()
- ).build()
- ));
-
- when(api.inputAclSetInterface(any())).thenReturn(future(new InputAclSetInterfaceReply()));
-
- customizer.writeCurrentAttributes(IID, acl, writeContext);
-
- verify(api).inputAclSetInterface(inputAclSetInterfaceWriteRequest());
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizerTest.java
deleted file mode 100644
index 00b424d9d..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizerTest.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.ip;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.v3po.interfaces.ip.subnet.validation.SubnetValidationException;
-import io.fd.honeycomb.translate.v3po.interfaces.ip.subnet.validation.SubnetValidator;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentMatcher;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-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.inet.types.rev130715.Ipv4AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface1;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.AddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.subnet.Netmask;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.subnet.NetmaskBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.subnet.PrefixLength;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.subnet.PrefixLengthBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DottedQuad;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceAddDelAddress;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceAddDelAddressReply;
-
-public class Ipv4AddressCustomizerTest extends WriterCustomizerTest {
-
- private static final String IFC_CTX_NAME = "ifc-test-instance";
- private static final String IFACE_NAME = "eth0";
- private static final int IFACE_ID = 123;
-
- @Mock
- private SubnetValidator subnetValidator;
-
- private NamingContext interfaceContext;
- private Ipv4AddressCustomizer customizer;
-
- @Before
- public void setUp() throws Exception {
- interfaceContext = new NamingContext("generatedIfaceName", IFC_CTX_NAME);
-
- customizer = new Ipv4AddressCustomizer(api, interfaceContext, subnetValidator);
-
- doReturn(future(new IpAddressDetailsReplyDump())).when(api).ipAddressDump(any());
- when(writeContext.readAfter(Mockito.any()))
- .thenReturn(Optional.of(new Ipv4Builder().setAddress(Collections.emptyList()).build()));
- }
-
- private static InstanceIdentifier<Address> getAddressId(final String ifaceName) {
- return InstanceIdentifier.builder(Interfaces.class)
- .child(Interface.class, new InterfaceKey(ifaceName))
- .augmentation(Interface1.class)
- .child(Ipv4.class)
- .child(Address.class)
- .build();
- }
-
- private void whenSwInterfaceAddDelAddressThenSuccess() {
- doReturn(future(new SwInterfaceAddDelAddressReply())).when(api).swInterfaceAddDelAddress(any(SwInterfaceAddDelAddress.class));
- }
-
- private void whenSwInterfaceAddDelAddressThenFailure() {
- doReturn(failedFuture()).when(api).swInterfaceAddDelAddress(any(SwInterfaceAddDelAddress.class));
- }
-
- @Test
- public void testAddPrefixLengthIpv4Address() throws Exception {
- doNothing().when(subnetValidator).checkNotAddingToSameSubnet(Mockito.anyList());
-
- final InstanceIdentifier<Address> id = getAddressId(IFACE_NAME);
- when(writeContext.readBefore(id)).thenReturn(Optional.absent());
-
- Ipv4AddressNoZone noZoneIp = new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"));
- PrefixLength length = new PrefixLengthBuilder().setPrefixLength(new Integer(24).shortValue()).build();
- Address data = new AddressBuilder().setIp(noZoneIp).setSubnet(length).build();
-
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
- whenSwInterfaceAddDelAddressThenSuccess();
-
- customizer.writeCurrentAttributes(id, data, writeContext);
-
- verify(api).swInterfaceAddDelAddress(generateSwInterfaceAddDelAddressRequest(new byte[]{-64, -88, 2, 1},
- (byte) 1, (byte) 24));
- }
-
- @Test
- public void testAddPrefixLengthIpv4AddressFailed() throws Exception {
- final InstanceIdentifier<Address> id = getAddressId(IFACE_NAME);
- when(writeContext.readBefore(id)).thenReturn(Optional.absent());
-
- Ipv4AddressNoZone noZoneIp = new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"));
- PrefixLength length = new PrefixLengthBuilder().setPrefixLength(new Integer(24).shortValue()).build();
- Address data = new AddressBuilder().setIp(noZoneIp).setSubnet(length).build();
-
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
- whenSwInterfaceAddDelAddressThenFailure();
-
- try {
- customizer.writeCurrentAttributes(id, data, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).swInterfaceAddDelAddress(
- generateSwInterfaceAddDelAddressRequest(new byte[]{-64, -88, 2, 1},
- (byte) 1, (byte) 24));
- return;
- }
- fail("WriteFailedException was expected");
- }
-
- @Test
- public void testAddPrefixLengthIpv4AddressConflicted() throws Exception {
-
- final InstanceIdentifier<Address> id = getAddressId(IFACE_NAME);
- when(writeContext.readBefore(id)).thenReturn(Optional.absent());
-
- Ipv4AddressNoZone noZoneIp = new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"));
- PrefixLength length = new PrefixLengthBuilder().setPrefixLength(new Integer(24).shortValue()).build();
- Address data = new AddressBuilder().setIp(noZoneIp).setSubnet(length).build();
- final List<Address> addressList = Arrays.asList(data);
-
- //throws when validation invoked
- doThrow(SubnetValidationException.forConflictingData((short) 24, Arrays.asList(data))).when(subnetValidator)
- .checkNotAddingToSameSubnet(addressList);
-
- //fake data return from WriteContext
- doReturn(Optional.of(new Ipv4Builder().setAddress(addressList).build())).when(writeContext)
- .readAfter(argThat(matchInstanceIdentifier(Ipv4.class)));
-
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
-
- try {
- customizer.writeCurrentAttributes(id, data, writeContext);
- } catch (WriteFailedException e) {
- //verifies if cause of exception is correct type
- assertTrue(e.getCause() instanceof SubnetValidationException);
-
- //verify that validation call was invoked with data from writeContext
- verify(subnetValidator, times(1)).checkNotAddingToSameSubnet(addressList);
- }
-
- }
-
- private static ArgumentMatcher<InstanceIdentifier<?>> matchInstanceIdentifier(
- Class<?> desiredClass) {
- return o -> o instanceof InstanceIdentifier && (o.getTargetType().equals(desiredClass));
- }
-
- @Test(expected = WriteFailedException.UpdateFailedException.class)
- public void testUpdate() throws Exception {
- final Address data = mock(Address.class);
- customizer.updateCurrentAttributes(getAddressId(IFACE_NAME), data, data, writeContext);
- }
-
- private SwInterfaceAddDelAddress generateSwInterfaceAddDelAddressRequest(final byte[] address, final byte isAdd,
- final byte prefixLength) {
- final SwInterfaceAddDelAddress request = new SwInterfaceAddDelAddress();
- request.swIfIndex = IFACE_ID;
- request.isAdd = isAdd;
- request.isIpv6 = 0;
- request.delAll = 0;
- request.addressLength = prefixLength;
- request.address = address;
- return request;
- }
-
- @Test
- public void testDeletePrefixLengthIpv4Address() throws Exception {
- final InstanceIdentifier<Address> id = getAddressId(IFACE_NAME);
-
- Ipv4AddressNoZone noZoneIp = new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"));
- PrefixLength length = new PrefixLengthBuilder().setPrefixLength(new Integer(24).shortValue()).build();
- Address data = new AddressBuilder().setIp(noZoneIp).setSubnet(length).build();
-
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
- whenSwInterfaceAddDelAddressThenSuccess();
-
- customizer.deleteCurrentAttributes(id, data, writeContext);
-
- verify(api).swInterfaceAddDelAddress(generateSwInterfaceAddDelAddressRequest(new byte[]{-64, -88, 2, 1},
- (byte) 0, (byte) 24));
- }
-
- @Test
- public void testDeletePrefixLengthIpv4AddressFailed() throws Exception {
- final InstanceIdentifier<Address> id = getAddressId(IFACE_NAME);
-
- Ipv4AddressNoZone noZoneIp = new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"));
- PrefixLength length = new PrefixLengthBuilder().setPrefixLength(new Integer(24).shortValue()).build();
- Address data = new AddressBuilder().setIp(noZoneIp).setSubnet(length).build();
-
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
- whenSwInterfaceAddDelAddressThenFailure();
-
- try {
- customizer.deleteCurrentAttributes(id, data, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).swInterfaceAddDelAddress(
- generateSwInterfaceAddDelAddressRequest(new byte[]{-64, -88, 2, 1},
- (byte) 0, (byte) 24));
- return;
- }
- fail("WriteFailedException was expec16ted");
- }
-
- @Test
- public void testNetmaskFailed() {
- final int expectedPrefixLength = 1;
- final String stringMask = "128.0.0.0";
- final InstanceIdentifier<Address> id = getAddressId(IFACE_NAME);
- when(writeContext.readBefore(id)).thenReturn(Optional.absent());
-
- Ipv4AddressNoZone noZoneIp = new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"));
- Netmask subnet = new NetmaskBuilder().setNetmask(new DottedQuad(stringMask)).build();
- Address data = new AddressBuilder().setIp(noZoneIp).setSubnet(subnet).build();
-
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
- whenSwInterfaceAddDelAddressThenFailure();
-
- try {
- customizer.writeCurrentAttributes(id, data, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).swInterfaceAddDelAddress(generateSwInterfaceAddDelAddressRequest(new byte[]{-64, -88, 2, 1},
- (byte) 1, (byte) expectedPrefixLength));
- return;
- }
- fail("WriteFailedException was expec16ted");
-
- }
-
- private void testSingleNetmask(final int expectedPrefixLength, final String stringMask) throws Exception {
- final InstanceIdentifier<Address> id = getAddressId(IFACE_NAME);
- when(writeContext.readBefore(id)).thenReturn(Optional.absent());
-
- Ipv4AddressNoZone noZoneIp = new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"));
- Netmask subnet = new NetmaskBuilder().setNetmask(new DottedQuad(stringMask)).build();
- Address data = new AddressBuilder().setIp(noZoneIp).setSubnet(subnet).build();
-
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
- whenSwInterfaceAddDelAddressThenSuccess();
-
- customizer.writeCurrentAttributes(id, data, writeContext);
-
- verify(api).swInterfaceAddDelAddress(generateSwInterfaceAddDelAddressRequest(new byte[]{-64, -88, 2, 1},
- (byte) 1, (byte) expectedPrefixLength));
- }
-
- private void testSingleIllegalNetmask(final String stringMask) throws Exception {
- try {
- final InstanceIdentifier<Address> id = getAddressId(IFACE_NAME);
- when(writeContext.readBefore(id)).thenReturn(Optional.absent());
-
- Ipv4AddressNoZone noZoneIp = new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"));
- Netmask subnet = new NetmaskBuilder().setNetmask(new DottedQuad(stringMask)).build();
- Address data = new AddressBuilder().setIp(noZoneIp).setSubnet(subnet).build();
-
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
- whenSwInterfaceAddDelAddressThenSuccess();
-
- customizer.writeCurrentAttributes(id, data, writeContext);
- } catch (IllegalArgumentException e) {
- return;
- }
- fail("IllegalArgumentException expected");
-
- }
-
- /**
- * Test contiguous netmask length from QuadDotted notation
- */
- @Test
- public void testNetmaskLength() throws Exception {
- testSingleNetmask(1, "128.0.0.0");
- testSingleNetmask(2, "192.0.0.0");
- testSingleNetmask(8, "255.0.0.0");
- testSingleNetmask(9, "255.128.0.0");
- testSingleNetmask(16, "255.255.0.0");
- testSingleNetmask(24, "255.255.255.0");
- }
-
- @Test
- public void testNetmaskIllegal() throws Exception {
- testSingleIllegalNetmask("");
- testSingleIllegalNetmask(".");
- testSingleIllegalNetmask(".255");
- testSingleIllegalNetmask("255");
- testSingleIllegalNetmask("255.");
- testSingleIllegalNetmask("255.255");
- testSingleIllegalNetmask("255.255.0");
- testSingleIllegalNetmask("255.255.255.");
- testSingleIllegalNetmask("255.255.255.256");
- testSingleIllegalNetmask("0.0.0.0");
- testSingleIllegalNetmask("10.10.10.10");
- testSingleIllegalNetmask("255.1.255.0");
- testSingleIllegalNetmask("255.255.255.255");
- }
-}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4NeighbourCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4NeighbourCustomizerTest.java
deleted file mode 100644
index c856d9b8c..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4NeighbourCustomizerTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.ip;
-
-import static junit.framework.TestCase.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import org.junit.Test;
-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.inet.types.rev130715.Ipv4AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface1;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Neighbor;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.NeighborBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.IpNeighborAddDel;
-import io.fd.vpp.jvpp.core.dto.IpNeighborAddDelReply;
-
-public class Ipv4NeighbourCustomizerTest extends WriterCustomizerTest implements Ipv4Translator {
-
- private static final String IFC_CTX_NAME = "ifc-test-instance";
- private static final String IFACE_NAME = "parent";
- private static final int IFACE_ID = 5;
- private static final InstanceIdentifier<Neighbor> IID =
- InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IFACE_NAME))
- .augmentation(Interface1.class).child(Ipv4.class).child(Neighbor.class);
-
- private Ipv4NeighbourCustomizer customizer;
-
- @Override
- public void setUp() {
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
- customizer = new Ipv4NeighbourCustomizer(api, new NamingContext("prefix", IFC_CTX_NAME));
- }
-
- @Test
- public void testWriteCurrentAttributes() throws WriteFailedException {
- when(api.ipNeighborAddDel(any())).thenReturn(future(new IpNeighborAddDelReply()));
- customizer.writeCurrentAttributes(IID, getData(), writeContext);
- verify(api).ipNeighborAddDel(getExpectedRequest(true));
- }
-
- @Test
- public void testWriteCurrentAttributesFailed() {
- when(api.ipNeighborAddDel(any())).thenReturn(failedFuture());
- try {
- customizer.writeCurrentAttributes(IID, getData(), writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).ipNeighborAddDel(getExpectedRequest(true));
- return;
- }
- fail("WriteFailedException expected");
- }
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdateCurrentAttributes() throws WriteFailedException {
- customizer.updateCurrentAttributes(IID, getData(), getData(), writeContext);
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws WriteFailedException {
- when(api.ipNeighborAddDel(any())).thenReturn(future(new IpNeighborAddDelReply()));
- customizer.deleteCurrentAttributes(IID, getData(), writeContext);
- verify(api).ipNeighborAddDel(getExpectedRequest(false));
- }
-
- @Test
- public void testDeleteCurrentAttributesFailed() {
- when(api.ipNeighborAddDel(any())).thenReturn(failedFuture());
- try {
- customizer.deleteCurrentAttributes(IID, getData(), writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).ipNeighborAddDel(getExpectedRequest(false));
- return;
- }
- fail("WriteFailedException expected");
- }
-
- private Neighbor getData() {
- final Ipv4AddressNoZone noZoneIp = new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"));
- final PhysAddress mac = new PhysAddress("aa:bb:cc:ee:11:22");
- return new NeighborBuilder().setIp(noZoneIp).setLinkLayerAddress(mac).build();
- }
- private IpNeighborAddDel getExpectedRequest(final boolean isAdd) {
- final IpNeighborAddDel request = new IpNeighborAddDel();
- request.isIpv6 = 0;
- request.isAdd = booleanToByte(isAdd);
- request.isStatic = 1;
- request.dstAddress = new byte[] {(byte) 192, (byte) 168, 2, 1};
- request.macAddress = new byte[] {(byte) 0xaa, (byte) 0xbb, (byte) 0xcc, (byte) 0xee, 0x11, 0x22};
- request.swIfIndex = IFACE_ID;
- return request;
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizerTest.java
deleted file mode 100644
index 269fc5212..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizerTest.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.ip;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import org.junit.Test;
-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.inet.types.rev130715.Ipv4AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DottedQuad;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.SubInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.AddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.address.Subnet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.address.subnet.Netmask;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.address.subnet.NetmaskBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.address.subnet.PrefixLength;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.address.subnet.PrefixLengthBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceAddDelAddress;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceAddDelAddressReply;
-
-public class SubInterfaceIpv4AddressCustomizerTest extends WriterCustomizerTest implements ByteDataTranslator {
-
- private static final String IFC_CTX_NAME = "ifc-test-instance";
- private static final String IFACE_NAME = "eth0";
- private static final int IFACE_INDEX = 0;
- private static final String SUBIF_NAME = "eth0.1";
- private static final long SUBIF_ID = 1;
- private static final int SUBIF_INDEX = 123;
- private static final InstanceIdentifier<Address> IID =
- InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IFACE_NAME))
- .augmentation(SubinterfaceAugmentation.class).child(SubInterfaces.class)
- .child(SubInterface.class, new SubInterfaceKey(SUBIF_ID)).child(Ipv4.class).child(Address.class);
-
- private SubInterfaceIpv4AddressCustomizer customizer;
-
- @Override
- protected void setUp() {
- customizer = new SubInterfaceIpv4AddressCustomizer(api, new NamingContext("prefix", IFC_CTX_NAME));
- defineMapping(mappingContext, IFACE_NAME, IFACE_INDEX, IFC_CTX_NAME);
- defineMapping(mappingContext, SUBIF_NAME, SUBIF_INDEX, IFC_CTX_NAME);
- }
-
- @Test
- public void testWrite() throws WriteFailedException {
- when(api.swInterfaceAddDelAddress(any())).thenReturn(future(new SwInterfaceAddDelAddressReply()));
- customizer.writeCurrentAttributes(IID, address(prefixLength()), writeContext);
- verify(api).swInterfaceAddDelAddress(expectedRequest(true));
- }
-
- @Test
- public void testWriteFailed() {
- when(api.swInterfaceAddDelAddress(any())).thenReturn(failedFuture());
- try {
- customizer.writeCurrentAttributes(IID, address(prefixLength()), writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).swInterfaceAddDelAddress(expectedRequest(true));
- return;
- }
- fail("WriteFailedException expected");
- }
-
- @Test
- public void testDelete() throws WriteFailedException {
- when(api.swInterfaceAddDelAddress(any())).thenReturn(future(new SwInterfaceAddDelAddressReply()));
- customizer.deleteCurrentAttributes(IID, address(netmask()), writeContext);
- verify(api).swInterfaceAddDelAddress(expectedRequest(false));
- }
-
- @Test
- public void testDeleteFailed() {
- when(api.swInterfaceAddDelAddress(any())).thenReturn(failedFuture());
- try {
- customizer.deleteCurrentAttributes(IID, address(netmask()), writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).swInterfaceAddDelAddress(expectedRequest(false));
- return;
- }
- fail("WriteFailedException expected");
- }
-
- private SwInterfaceAddDelAddress expectedRequest(boolean isAdd) {
- final SwInterfaceAddDelAddress request = new SwInterfaceAddDelAddress();
- request.isAdd = booleanToByte(isAdd);
- request.swIfIndex = SUBIF_INDEX;
- request.isIpv6 = 0;
- request.delAll = 0;
- request.addressLength = 24;
- request.address = new byte[] {(byte) 192, (byte) 168, 2, 1};
- return request;
- }
-
- @Test(expected = WriteFailedException.UpdateFailedException.class)
- public void testUpdate() throws Exception {
- final Address address = address(prefixLength());
- customizer.updateCurrentAttributes(IID, address, address, writeContext);
- }
-
- private Address address(final Subnet subnet) {
- final Ipv4AddressNoZone noZoneIp = new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"));
- return new AddressBuilder().setIp(noZoneIp).setSubnet(subnet).build();
- }
-
- private PrefixLength prefixLength() {
- return new PrefixLengthBuilder().setPrefixLength(new Integer(24).shortValue()).build();
- }
-
- private Netmask netmask() {
- return new NetmaskBuilder().setNetmask(new DottedQuad("255.255.255.0")).build();
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/subnet/validation/SubnetValidatorTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/subnet/validation/SubnetValidatorTest.java
deleted file mode 100644
index 7c3088f99..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/ip/subnet/validation/SubnetValidatorTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.ip.subnet.validation;
-
-
-import com.google.common.collect.Lists;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.AddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.subnet.NetmaskBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.subnet.PrefixLengthBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DottedQuad;
-
-public class SubnetValidatorTest {
-
- private SubnetValidator subnetValidator;
-
- @Before
- public void init() {
- subnetValidator = new SubnetValidator();
- }
-
- @Test(expected = SubnetValidationException.class)
- public void testValidateNegativeSameTypes() throws SubnetValidationException {
- List<Address> addresses = Lists.newArrayList();
-
- addresses.add(new AddressBuilder().setSubnet(new PrefixLengthBuilder().setPrefixLength((short) 24).build())
- .build());
- addresses.add(new AddressBuilder().setSubnet(new PrefixLengthBuilder().setPrefixLength((short) 24).build())
- .build());
-
- subnetValidator.checkNotAddingToSameSubnet(addresses);
- }
-
- @Test(expected = SubnetValidationException.class)
- public void testValidateNegativeMixedTypes() throws SubnetValidationException {
- List<Address> addresses = Lists.newArrayList();
-
- addresses.add(new AddressBuilder().setSubnet(new PrefixLengthBuilder().setPrefixLength((short) 24).build())
- .build());
- addresses.add(new AddressBuilder()
- .setSubnet(new NetmaskBuilder().setNetmask(new DottedQuad("255.255.255.0")).build())
- .build());
-
- subnetValidator.checkNotAddingToSameSubnet(addresses);
- }
-
- @Test
- public void testValidatePositiveSameTypes() throws SubnetValidationException {
- List<Address> addresses = Lists.newArrayList();
-
- addresses.add(new AddressBuilder().setSubnet(new PrefixLengthBuilder().setPrefixLength((short) 24).build())
- .build());
- addresses.add(new AddressBuilder().setSubnet(new PrefixLengthBuilder().setPrefixLength((short) 25).build())
- .build());
-
- subnetValidator.checkNotAddingToSameSubnet(addresses);
- }
-
- @Test
- public void testValidatePositiveMixedTypes() throws SubnetValidationException {
- List<Address> addresses = Lists.newArrayList();
-
- addresses.add(new AddressBuilder().setSubnet(new PrefixLengthBuilder().setPrefixLength((short) 24).build())
- .build());
- addresses.add(new AddressBuilder()
- .setSubnet(new NetmaskBuilder().setNetmask(new DottedQuad("255.255.0.0")).build())
- .build());
-
- subnetValidator.checkNotAddingToSameSubnet(addresses);
- }
-}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/pbb/PbbRewriteCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/pbb/PbbRewriteCustomizerTest.java
deleted file mode 100644
index e1a791845..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/pbb/PbbRewriteCustomizerTest.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * 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.translate.v3po.interfaces.pbb;
-
-import static org.junit.Assert.assertArrayEquals;
-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 io.fd.honeycomb.translate.vpp.util.NamingContext;
-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.L2InterfacePbbTagRewrite;
-import io.fd.vpp.jvpp.core.dto.L2InterfacePbbTagRewriteReply;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-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.pbb.types.rev161214.Operation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.PbbRewriteInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.interfaces._interface.PbbRewrite;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.interfaces._interface.PbbRewriteBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class PbbRewriteCustomizerTest extends WriterCustomizerTest {
-
- @Captor
- private ArgumentCaptor<L2InterfacePbbTagRewrite> rewriteArgumentCaptor;
-
- private NamingContext interfaceContext;
- private PbbRewriteCustomizer customizer;
- private InstanceIdentifier<PbbRewrite> validId;
- private InstanceIdentifier<PbbRewrite> invalidId;
-
- @Override
- protected void setUp() throws Exception {
- interfaceContext = new NamingContext("interface", "interface-context");
- customizer = new PbbRewriteCustomizer(api, interfaceContext);
-
- defineMapping(mappingContext, "pbb-interface", 1, "interface-context");
- validId = InstanceIdentifier.create(Interfaces.class)
- .child(Interface.class, new InterfaceKey("pbb-interface"))
- .augmentation(PbbRewriteInterfaceAugmentation.class)
- .child(PbbRewrite.class);
-
- invalidId = InstanceIdentifier.create(PbbRewrite.class);
- }
-
- @Test
- public void testWrite() throws WriteFailedException {
- whenRewriteThenSuccess();
- customizer.writeCurrentAttributes(validId, validData(), writeContext);
- verifyRewriteRequest(desiredSetResult());
- }
-
- @Test
- public void testWriteFailedCallFailed() {
- whenRewriteThenFail();
- final PbbRewrite validData = validData();
- try {
- customizer.writeCurrentAttributes(validId, validData, writeContext);
- } catch (Exception e) {
- assertTrue(e instanceof WriteFailedException.CreateFailedException);
- assertTrue(e.getCause() instanceof VppCallbackException);
-
- final WriteFailedException.CreateFailedException ex = ((WriteFailedException.CreateFailedException) e);
- assertEquals(validId, ex.getFailedId());
- assertEquals(validData, ex.getData());
- return;
- }
-
- fail("Test should have failed");
- }
-
- @Test
- public void testWriteFailedInvalidData() {
- verifyInvalidWriteDataCombination(invalidDataNoDestination());
- verifyInvalidWriteDataCombination(invalidDataNoSource());
- verifyInvalidWriteDataCombination(invalidDataNoItag());
- verifyInvalidWriteDataCombination(invalidDataNoOperation());
- verifyInvalidWriteDataCombination(invalidDataNoVlan());
- }
-
- @Test
- public void testUpdate() throws WriteFailedException {
- whenRewriteThenSuccess();
- final PbbRewrite rewrite = validData();
- customizer.updateCurrentAttributes(validId, rewrite, rewrite, writeContext);
- verifyRewriteRequest(desiredSetResult());
- }
-
- @Test
- public void testUpdateFailedCallFailed() {
- whenRewriteThenFail();
- final PbbRewrite invalidData = invalidDataNoVlan();
- final PbbRewrite validData = validData();
- try {
- customizer.updateCurrentAttributes(validId, invalidData, validData, writeContext);
- } catch (Exception e) {
- assertTrue(e instanceof WriteFailedException.UpdateFailedException);
- assertTrue(e.getCause() instanceof VppCallbackException);
-
- final WriteFailedException.UpdateFailedException ex = ((WriteFailedException.UpdateFailedException) e);
- assertEquals(validId, ex.getFailedId());
- assertEquals(invalidData, ex.getDataBefore());
- assertEquals(validData, ex.getDataAfter());
- return;
- }
-
- fail("Test should have failed");
- }
-
- @Test
- public void testUpdateFailedInvalidData() {
- verifyInvalidUpdateDataCombination(invalidDataNoDestination());
- verifyInvalidUpdateDataCombination(invalidDataNoSource());
- verifyInvalidUpdateDataCombination(invalidDataNoItag());
- verifyInvalidUpdateDataCombination(invalidDataNoOperation());
- verifyInvalidUpdateDataCombination(invalidDataNoVlan());
- }
-
- @Test
- public void testDelete() throws WriteFailedException {
- whenRewriteThenSuccess();
- customizer.deleteCurrentAttributes(validId, validData(), writeContext);
- verifyRewriteRequest(desiredDisableResult());
- }
-
- @Test
- public void testDeleteFailedCallFailed() {
- whenRewriteThenFail();
- final PbbRewrite validData = validData();
- try {
- customizer.deleteCurrentAttributes(validId, validData, writeContext);
- } catch (Exception e) {
- assertTrue(e instanceof WriteFailedException.DeleteFailedException);
- assertTrue(e.getCause() instanceof VppCallbackException);
- assertEquals(validId, ((WriteFailedException.DeleteFailedException) e).getFailedId());
- return;
- }
-
- fail("Test should have failed");
- }
-
- @Test
- public void testDeleteFailedInvalidData() {
- verifyInvalidDeleteDataCombination(invalidDataNoDestination());
- verifyInvalidDeleteDataCombination(invalidDataNoSource());
- verifyInvalidDeleteDataCombination(invalidDataNoItag());
- verifyInvalidDeleteDataCombination(invalidDataNoOperation());
- verifyInvalidDeleteDataCombination(invalidDataNoVlan());
- }
-
- private void whenRewriteThenSuccess() {
- when(api.l2InterfacePbbTagRewrite(any())).thenReturn(future(new L2InterfacePbbTagRewriteReply()));
- }
-
- private void whenRewriteThenFail() {
- when(api.l2InterfacePbbTagRewrite(any())).thenReturn(failedFuture());
- }
-
- private void verifyInvalidWriteDataCombination(final PbbRewrite invalidData) {
- try {
- customizer.writeCurrentAttributes(validId, invalidData, writeContext);
- } catch (Exception e) {
- assertTrue(e instanceof NullPointerException);
- return;
- }
-
- fail("Verifying of invalid combination failed");
- }
-
- private void verifyInvalidUpdateDataCombination(final PbbRewrite invalidData) {
- try {
- customizer.updateCurrentAttributes(validId, validData(), invalidData, writeContext);
- } catch (Exception e) {
- assertTrue(e instanceof NullPointerException);
- return;
- }
-
- fail("Verifying of invalid combination failed");
- }
-
-
- private void verifyInvalidDeleteDataCombination(final PbbRewrite invalidData) {
- try {
- customizer.deleteCurrentAttributes(validId, invalidData, writeContext);
- } catch (Exception e) {
- assertTrue(e instanceof NullPointerException);
- return;
- }
-
- fail("Verifying of invalid combination failed");
- }
-
-
- private L2InterfacePbbTagRewrite desiredSetResult() {
- final L2InterfacePbbTagRewrite desiredResult = new L2InterfacePbbTagRewrite();
- desiredResult.swIfIndex = 1;
- desiredResult.vtrOp = Operation.Pop2.getIntValue();
- desiredResult.bDmac = new byte[]{-69, -69, -69, -69, -69, -69};
- desiredResult.bSmac = new byte[]{-86, -86, -86, -86, -86, -86};
- desiredResult.bVlanid = 1;
- desiredResult.iSid = 2;
-
- return desiredResult;
- }
-
- private L2InterfacePbbTagRewrite desiredDisableResult() {
- final L2InterfacePbbTagRewrite desiredResult = new L2InterfacePbbTagRewrite();
- desiredResult.swIfIndex = 1;
- desiredResult.vtrOp = 0;
- desiredResult.bDmac = new byte[]{-69, -69, -69, -69, -69, -69};
- desiredResult.bSmac = new byte[]{-86, -86, -86, -86, -86, -86};
- desiredResult.bVlanid = 1;
- desiredResult.iSid = 2;
-
- return desiredResult;
- }
-
- private void verifyRewriteRequest(final L2InterfacePbbTagRewrite desiredResult) {
- verify(api, times(1)).l2InterfacePbbTagRewrite(rewriteArgumentCaptor.capture());
-
- final L2InterfacePbbTagRewrite actualRequest = rewriteArgumentCaptor.getValue();
-
- assertNotNull(actualRequest);
- assertEquals(actualRequest.bVlanid, desiredResult.bVlanid);
- assertEquals(actualRequest.iSid, desiredResult.iSid);
- assertEquals(actualRequest.vtrOp, desiredResult.vtrOp);
- assertEquals(actualRequest.outerTag, desiredResult.outerTag);
- assertArrayEquals(actualRequest.bDmac, desiredResult.bDmac);
- assertArrayEquals(actualRequest.bSmac, desiredResult.bSmac);
- }
-
- private PbbRewrite invalidDataNoDestination() {
- return new PbbRewriteBuilder()
- .setBVlanTagVlanId(1)
- .setITagIsid(2L)
- .setSourceAddress(new MacAddress("aa:aa:aa:aa:aa:aa"))
- .setInterfaceOperation(Operation.Pop2)
- .build();
- }
-
- private PbbRewrite invalidDataNoSource() {
- return new PbbRewriteBuilder()
- .setBVlanTagVlanId(1)
- .setITagIsid(2L)
- .setDestinationAddress(new MacAddress("bb:bb:bb:bb:bb:bb"))
- .setInterfaceOperation(Operation.Pop2)
- .build();
- }
-
- private PbbRewrite invalidDataNoItag() {
- return new PbbRewriteBuilder()
- .setBVlanTagVlanId(1)
- .setSourceAddress(new MacAddress("aa:aa:aa:aa:aa:aa"))
- .setDestinationAddress(new MacAddress("bb:bb:bb:bb:bb:bb"))
- .setInterfaceOperation(Operation.Pop2)
- .build();
- }
-
- private PbbRewrite invalidDataNoVlan() {
- return new PbbRewriteBuilder()
- .setITagIsid(2L)
- .setSourceAddress(new MacAddress("aa:aa:aa:aa:aa:aa"))
- .setDestinationAddress(new MacAddress("bb:bb:bb:bb:bb:bb"))
- .setInterfaceOperation(Operation.Pop2)
- .build();
- }
-
- private PbbRewrite invalidDataNoOperation() {
- return new PbbRewriteBuilder()
- .setITagIsid(2L)
- .setSourceAddress(new MacAddress("aa:aa:aa:aa:aa:aa"))
- .setDestinationAddress(new MacAddress("bb:bb:bb:bb:bb:bb"))
- .setInterfaceOperation(Operation.Pop2)
- .build();
- }
-
- private PbbRewrite validData() {
- return new PbbRewriteBuilder()
- .setBVlanTagVlanId(1)
- .setITagIsid(2L)
- .setSourceAddress(new MacAddress("aa:aa:aa:aa:aa:aa"))
- .setDestinationAddress(new MacAddress("bb:bb:bb:bb:bb:bb"))
- .setInterfaceOperation(Operation.Pop2)
- .build();
- }
-}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/EthernetCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/EthernetCustomizerTest.java
deleted file mode 100644
index a04b022ea..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/EthernetCustomizerTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import io.fd.honeycomb.vpp.test.util.InterfaceDumpHelper;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.EthernetStateAttributes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Ethernet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.EthernetBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-
-public class EthernetCustomizerTest extends ReaderCustomizerTest<Ethernet, EthernetBuilder> implements
- InterfaceDumpHelper {
- private static final String IFC_CTX_NAME = "ifc-test-instance";
- private static final String IF_NAME = "local0";
- private static final int IF_INDEX = 1;
- private static final InstanceIdentifier<Ethernet> IID =
- InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(IF_NAME))
- .augmentation(VppInterfaceStateAugmentation.class).child(Ethernet.class);
- private NamingContext interfaceContext;
-
- public EthernetCustomizerTest() {
- super(Ethernet.class, VppInterfaceStateAugmentationBuilder.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- interfaceContext = new NamingContext("generatedIfaceName", IFC_CTX_NAME);
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_CTX_NAME);
- }
-
- @Override
- protected ReaderCustomizer<Ethernet, EthernetBuilder> initCustomizer() {
- return new EthernetCustomizer(api, interfaceContext);
- }
-
- private void testRead(final int linkDuplex, final EthernetStateAttributes.Duplex duplex) throws ReadFailedException {
- final EthernetBuilder builder = mock(EthernetBuilder.class);
- final short mtu = 123;
- whenSwInterfaceDumpThenReturn(api, ifaceDetails(mtu, linkDuplex));
- getCustomizer().readCurrentAttributes(IID, builder, ctx);
- verify(builder).setMtu((int)mtu);
- verify(builder).setDuplex(duplex);
- }
-
- private SwInterfaceDetails ifaceDetails(final short mtu, final int duplex) {
- final SwInterfaceDetails details = new SwInterfaceDetails();
- details.swIfIndex = IF_INDEX;
- details.linkMtu = mtu;
- details.linkDuplex = (byte)duplex;
- return details;
- }
-
- @Test
- public void testReadHalfDuplex() throws ReadFailedException {
- testRead(1, EthernetStateAttributes.Duplex.Half);
- }
-
- @Test
- public void testReadFullDuplex() throws ReadFailedException {
- testRead(2, EthernetStateAttributes.Duplex.Full);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/GreCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/GreCustomizerTest.java
deleted file mode 100644
index fa5368629..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/GreCustomizerTest.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-
-import com.google.common.collect.Lists;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.Map;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Gre;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.GreBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppInvocationException;
-import io.fd.vpp.jvpp.core.dto.GreTunnelDetails;
-import io.fd.vpp.jvpp.core.dto.GreTunnelDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.GreTunnelDump;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-
-public class GreCustomizerTest extends ReaderCustomizerTest<Gre, GreBuilder> {
-
- private static final String IFACE_NAME = "ifc1";
- private static final int IFACE_ID = 0;
- private static final String IFC_CTX_NAME = "ifc-test-instance";
-
- private NamingContext interfacesContext;
- static final InstanceIdentifier<Gre> IID =
- InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(IFACE_NAME))
- .augmentation(VppInterfaceStateAugmentation.class).child(Gre.class);
-
- public GreCustomizerTest() {
- super(Gre.class, VppInterfaceStateAugmentationBuilder.class);
- }
-
- @Override
- public void setUp() throws UnknownHostException, VppInvocationException {
- interfacesContext = new NamingContext("gre-tunnel", IFC_CTX_NAME);
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
-
- final SwInterfaceDetails v = new SwInterfaceDetails();
- v.interfaceName = "gre-tunnel4".getBytes();
- final Map<Integer, SwInterfaceDetails> map = new HashMap<>();
- map.put(0, v);
- cache.put(InterfaceCustomizer.DUMPED_IFCS_CONTEXT_KEY, map);
-
- final GreTunnelDetailsReplyDump value = new GreTunnelDetailsReplyDump();
- final GreTunnelDetails greTunnelDetails = new GreTunnelDetails();
- greTunnelDetails.isIpv6 = 0;
- greTunnelDetails.dstAddress = InetAddress.getByName("1.2.3.4").getAddress();
- greTunnelDetails.srcAddress = InetAddress.getByName("1.2.3.5").getAddress();
- greTunnelDetails.outerFibId = 55;
- greTunnelDetails.swIfIndex = 0;
- value.greTunnelDetails = Lists.newArrayList(greTunnelDetails);
-
- doReturn(future(value)).when(api).greTunnelDump(any(GreTunnelDump.class));
- }
-
- @Test
- public void testReadCurrentAttributes() throws Exception {
- final GreBuilder builder = getCustomizer().getBuilder(IID);
- getCustomizer().readCurrentAttributes(IID, builder, ctx);
-
- assertEquals(55, builder.getOuterFibId().intValue());
-
- assertNull(builder.getSrc().getIpv6Address());
- assertNotNull(builder.getSrc().getIpv4Address());
- assertEquals("1.2.3.5", builder.getSrc().getIpv4Address().getValue());
-
- assertNull(builder.getDst().getIpv6Address());
- assertNotNull(builder.getDst().getIpv4Address());
- assertEquals("1.2.3.4", builder.getDst().getIpv4Address().getValue());
-
- verify(api).greTunnelDump(any(GreTunnelDump.class));
- }
-
- @Test(expected = NullPointerException.class)
- public void testReadCurrentAttributesVppNameNotCached() throws Exception {
- InterfaceCustomizer.getCachedInterfaceDump(cache).remove(0);
-
- final GreBuilder builder = getCustomizer().getBuilder(IID);
- getCustomizer().readCurrentAttributes(IID, builder, ctx);
- }
-
- @Test
- public void testReadCurrentAttributesWrongType() throws Exception {
- final SwInterfaceDetails v = new SwInterfaceDetails();
- v.interfaceName = "tap-2".getBytes();
- InterfaceCustomizer.getCachedInterfaceDump(cache).put(0, v);
-
- final GreBuilder builder = getCustomizer().getBuilder(IID);
- getCustomizer().readCurrentAttributes(IID, builder, ctx);
-
- // Should be ignored
- verifyZeroInteractions(api);
- }
-
- @Override
- protected ReaderCustomizer<Gre, GreBuilder> initCustomizer() {
- return new GreCustomizer(api, interfacesContext);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizerTest.java
deleted file mode 100644
index 581da29d7..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizerTest.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.v3po.DisabledInterfacesManager;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
-import io.fd.honeycomb.vpp.test.util.InterfaceDumpHelper;
-import java.util.Arrays;
-import java.util.List;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppInvocationException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
-
-public class InterfaceCustomizerTest extends ListReaderCustomizerTest<Interface, InterfaceKey, InterfaceBuilder>
- implements InterfaceDataTranslator, InterfaceDumpHelper {
-
- private static final String IFC_CTX_NAME = "ifc-test-instance";
- private static final String IFACE0_NAME = "eth0";
- private static final String IFACE1_NAME = "eth1";
- private static final String SUB_IFACE_NAME = "eth1.1";
- private static final int IFACE0_ID = 0;
- private static final int IFACE1_ID = 1;
- private static final int SUB_IFACE_ID = 2;
-
- private NamingContext interfacesContext;
- @Mock
- private DisabledInterfacesManager interfaceDisableContext;
-
- public InterfaceCustomizerTest() {
- super(Interface.class, InterfacesStateBuilder.class);
- }
-
- @Override
- public void setUp() {
- interfacesContext = new NamingContext("generatedIfaceName", IFC_CTX_NAME);
- defineMapping(mappingContext, IFACE0_NAME, IFACE0_ID, IFC_CTX_NAME);
- defineMapping(mappingContext, IFACE1_NAME, IFACE1_ID, IFC_CTX_NAME);
- defineMapping(mappingContext, SUB_IFACE_NAME, SUB_IFACE_ID, IFC_CTX_NAME);
- }
-
- @Override
- protected ReaderCustomizer<Interface, InterfaceBuilder> initCustomizer() {
- return new InterfaceCustomizer(api, interfacesContext, interfaceDisableContext);
- }
-
- private void verifySwInterfaceDumpWasInvoked(final int nameFilterValid, final String ifaceName,
- final int dumpIfcsInvocationCount)
- throws VppInvocationException {
- final SwInterfaceDump expected = new SwInterfaceDump();
- expected.nameFilterValid = (byte) nameFilterValid;
- expected.nameFilter = ifaceName.getBytes();
- verify(api, times(dumpIfcsInvocationCount)).swInterfaceDump(expected);
- }
-
- private void assertIfacesAreEqual(final Interface iface, final SwInterfaceDetails details) {
- assertEquals(iface.getName(), new String(details.interfaceName));
- Assert.assertEquals(yangIfIndexToVpp(iface.getIfIndex().intValue()), details.swIfIndex);
- assertEquals(iface.getPhysAddress().getValue(), vppPhysAddrToYang(details.l2Address));
- }
-
- @Test
- public void testReadCurrentAttributes() throws Exception {
- final InstanceIdentifier<Interface> id = InstanceIdentifier.create(InterfacesState.class)
- .child(Interface.class, new InterfaceKey(IFACE0_NAME));
- final InterfaceBuilder builder = getCustomizer().getBuilder(id);
-
- final SwInterfaceDetails iface = new SwInterfaceDetails();
- iface.interfaceName = IFACE0_NAME.getBytes();
- iface.swIfIndex = 0;
- iface.linkSpeed = 1;
- iface.l2AddressLength = 6;
- iface.l2Address = new byte[iface.l2AddressLength];
- whenSwInterfaceDumpThenReturn(api, iface);
-
- getCustomizer().readCurrentAttributes(id, builder, ctx);
-
- verifySwInterfaceDumpWasInvoked(1, IFACE0_NAME, 1);
- assertIfacesAreEqual(builder.build(), iface);
- }
-
- @Test
- public void testReadCurrentAttributesFailed() throws Exception {
- final String ifaceName = IFACE0_NAME;
- final InstanceIdentifier<Interface> id = InstanceIdentifier.create(InterfacesState.class)
- .child(Interface.class, new InterfaceKey(ifaceName));
- final InterfaceBuilder builder = getCustomizer().getBuilder(id);
-
- whenSwInterfaceDumpThenReturn(api);
-
- try {
- getCustomizer().readCurrentAttributes(id, builder, ctx);
- } catch (IllegalArgumentException e) {
- verifySwInterfaceDumpWasInvoked(0, ifaceName, 2);
- return;
- }
-
- fail("ReadFailedException was expected");
- }
-
- @Test
- public void testReadSubInterface() throws Exception {
- final InstanceIdentifier<Interface> id = InstanceIdentifier.create(InterfacesState.class)
- .child(Interface.class, new InterfaceKey(SUB_IFACE_NAME));
- final InterfaceBuilder builder = mock(InterfaceBuilder.class);
-
- final SwInterfaceDetails iface = new SwInterfaceDetails();
- iface.interfaceName = SUB_IFACE_NAME.getBytes();
- iface.swIfIndex = 2;
- iface.supSwIfIndex = 1;
- iface.subId = 1;
- whenSwInterfaceDumpThenReturn(api, iface);
-
- getCustomizer().readCurrentAttributes(id, builder, ctx);
-
- verifySwInterfaceDumpWasInvoked(1, SUB_IFACE_NAME, 1);
- verifyZeroInteractions(builder);
- }
-
- @Test
- public void testGetAllIds() throws Exception {
- final InstanceIdentifier<Interface> id = InstanceIdentifier.create(InterfacesState.class)
- .child(Interface.class);
-
- final SwInterfaceDetails swIf0 = new SwInterfaceDetails();
- swIf0.swIfIndex = 0;
- swIf0.interfaceName = IFACE0_NAME.getBytes();
- final SwInterfaceDetails swIf1 = new SwInterfaceDetails();
- swIf1.swIfIndex = 1;
- swIf1.interfaceName = IFACE1_NAME.getBytes();
- final SwInterfaceDetails swSubIf1 = new SwInterfaceDetails();
- swSubIf1.swIfIndex = 2;
- swSubIf1.subId = 1;
- swSubIf1.supSwIfIndex = 1;
- swSubIf1.interfaceName = SUB_IFACE_NAME.getBytes();
- whenSwInterfaceDumpThenReturn(api, swIf0, swIf1, swSubIf1);
-
- final List<InterfaceKey> expectedIds = Arrays.asList(new InterfaceKey(IFACE0_NAME), new InterfaceKey(
- IFACE1_NAME));
- final List<InterfaceKey> actualIds = getCustomizer().getAllIds(id, ctx);
-
- verifySwInterfaceDumpWasInvoked(0, "", 1);
-
- // sub-interface should not be on the list
- assertEquals(expectedIds, actualIds);
- }
-
- @Test
- public void testGetAllIdsWithDisabled() throws Exception {
- final InstanceIdentifier<Interface> id = InstanceIdentifier.create(InterfacesState.class)
- .child(Interface.class);
-
- doReturn(true).when(interfaceDisableContext).isInterfaceDisabled(1, mappingContext);
-
- final SwInterfaceDetails swIf0 = new SwInterfaceDetails();
- swIf0.swIfIndex = 0;
- swIf0.interfaceName = IFACE0_NAME.getBytes();
- final SwInterfaceDetails swIf1 = new SwInterfaceDetails();
- swIf1.swIfIndex = 1;
- swIf1.interfaceName = IFACE1_NAME.getBytes();
- whenSwInterfaceDumpThenReturn(api, swIf0, swIf1);
-
- final List<InterfaceKey> expectedIds = Arrays.asList(new InterfaceKey(IFACE0_NAME));
- final List<InterfaceKey> actualIds = getCustomizer().getAllIds(id, ctx);
-
- // disabled interface should not be on the list
- assertEquals(expectedIds, actualIds);
- }
-}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceDataTranslatorTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceDataTranslatorTest.java
deleted file mode 100644
index 56e40826a..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceDataTranslatorTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.EthernetCsmacd;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.Tap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VhostUser;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VxlanGpeTunnel;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VxlanTunnel;
-
-public class InterfaceDataTranslatorTest implements InterfaceDataTranslator {
-
- @Test
- public void testVppPhysAddrToYang() throws Exception {
- assertEquals("01:02:03:04:05:06", vppPhysAddrToYang(new byte[]{1, 2, 3, 4, 5, 6}));
- assertEquals("0a:0b:0c:0d:0e:0f", vppPhysAddrToYang(new byte[]{0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 0}));
- }
-
- @Test(expected = NullPointerException.class)
- public void testVppPhysAddrToYangFailNullArgument() throws Exception {
- vppPhysAddrToYang(null);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testVppPhysAddrToYangInvalidByteArrayLength() throws Exception {
- vppPhysAddrToYang(new byte[]{1, 2, 3, 4, 5});
- }
-
- @Test
- public void testGetInterfaceType() {
- assertEquals(Tap.class, getInterfaceType("tap0"));
- assertEquals(VxlanTunnel.class, getInterfaceType("vxlan0"));
- assertEquals(VxlanGpeTunnel.class, getInterfaceType("vxlan_gpe0"));
- assertEquals(VhostUser.class, getInterfaceType("VirtualEthernet0/0/0"));
- assertEquals(EthernetCsmacd.class, getInterfaceType("eth0.0"));
- assertEquals(EthernetCsmacd.class, getInterfaceType("local0"));
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/L2CustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/L2CustomizerTest.java
deleted file mode 100644
index 6bc839a37..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/L2CustomizerTest.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.L2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.L2Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.Interconnection;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.interconnection.BridgeBasedBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainDetails;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainDump;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainSwIfDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-
-public class L2CustomizerTest extends ReaderCustomizerTest<L2, L2Builder> {
-
- private static final String IFC_CTX_NAME = "ifc-test-instance";
- private static final String BD_CTX_NAME = "bd-test-instance";
- private NamingContext interfaceContext;
- private NamingContext bridgeDomainContext;
-
- public L2CustomizerTest() {
- super(L2.class, VppInterfaceStateAugmentationBuilder.class);
- }
-
- @Override
- public void setUp() {
- interfaceContext = new NamingContext("generatedIfaceName", IFC_CTX_NAME);
- bridgeDomainContext = new NamingContext("generatedBDName", BD_CTX_NAME);
- }
-
- @Override
- protected ReaderCustomizer<L2, L2Builder> initCustomizer() {
- return new L2Customizer(api, interfaceContext, bridgeDomainContext);
- }
-
- private InstanceIdentifier<L2> getL2Id(final String name) {
- return InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(name))
- .augmentation(
- VppInterfaceStateAugmentation.class).child(L2.class);
- }
-
- private void whenBridgeDomainSwIfDumpThenReturn(final List<BridgeDomainSwIfDetails> bdSwIfList,
- final List<BridgeDomainDetails> bridgeDomainDetailses) {
- final BridgeDomainDetailsReplyDump reply = new BridgeDomainDetailsReplyDump();
- reply.bridgeDomainSwIfDetails = bdSwIfList;
- reply.bridgeDomainDetails = bridgeDomainDetailses;
- when(api.bridgeDomainSwIfDump(any(BridgeDomainDump.class))).thenReturn(future(reply));
- }
-
-
- private BridgeDomainSwIfDetails generateBdSwIfDetails(final int ifId, final int bdId) {
- final BridgeDomainSwIfDetails bdSwIfDetails = new BridgeDomainSwIfDetails();
- bdSwIfDetails.swIfIndex = ifId;
- bdSwIfDetails.shg = 1;
- bdSwIfDetails.bdId = bdId;
- return bdSwIfDetails;
- }
-
- private Interconnection generateInterconnection(final int ifId, final String bdName, final Boolean bvi) {
- final BridgeBasedBuilder bbBuilder = new BridgeBasedBuilder();
- bbBuilder.setBridgeDomain(bdName);
- bbBuilder.setSplitHorizonGroup((short) 1);
- if (bvi != null) {
- bbBuilder.setBridgedVirtualInterface(bvi);
- } else {
- bbBuilder.setBridgedVirtualInterface(false); // false is default
- }
- return bbBuilder.build();
- }
-
- @Test
- public void testRead() throws Exception {
- final Map<Integer, SwInterfaceDetails> cachedInterfaceDump = new HashMap<>();
- final int ifId = 1;
- final int bdId = 1;
- final String bdName = "bd001";
- final String ifName = "eth0.sub0";
- defineMapping(mappingContext, ifName, ifId, IFC_CTX_NAME);
- defineMapping(mappingContext, bdName, bdId, BD_CTX_NAME);
-
- final SwInterfaceDetails ifaceDetails = new SwInterfaceDetails();
- ifaceDetails.subId = ifId;
- cachedInterfaceDump.put(ifId, ifaceDetails);
- cache.put(InterfaceCustomizer.DUMPED_IFCS_CONTEXT_KEY, cachedInterfaceDump);
-
- // BVIinterfaceContext
- whenBridgeDomainSwIfDumpThenReturn(Collections.singletonList(generateBdSwIfDetails(ifId, bdId)),
- Collections.singletonList(generateBdDetails(ifId, bdId)));
-
- L2Builder builder = mock(L2Builder.class);
- getCustomizer().readCurrentAttributes(getL2Id(ifName), builder, ctx);
-
- verify(builder).setInterconnection(generateInterconnection(ifId, bdName, true));
-
- // Not BVI
- whenBridgeDomainSwIfDumpThenReturn(Collections.singletonList(generateBdSwIfDetails(ifId, bdId)),
- Collections.singletonList(generateBdDetails(99 /* Different ifc is marked as BVI in bd details */, bdId)));
-
- builder = mock(L2Builder.class);
- getCustomizer().readCurrentAttributes(getL2Id(ifName), builder, ctx);
-
- verify(builder).setInterconnection(generateInterconnection(ifId, bdName, null));
- }
-
- private BridgeDomainDetails generateBdDetails(final int ifId, final int bdId) {
- final BridgeDomainDetails bridgeDomainDetails = new BridgeDomainDetails();
- bridgeDomainDetails.bviSwIfIndex = ifId;
- bridgeDomainDetails.bdId = bdId;
- return bridgeDomainDetails;
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/RewriteCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/RewriteCustomizerTest.java
deleted file mode 100644
index 7ca1bd607..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/RewriteCustomizerTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.TagRewriteOperation;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceStateAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214._802dot1q;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.SubInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.L2Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.l2.Rewrite;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.l2.RewriteBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.tag.rewrite.PushTags;
-import org.opendaylight.yangtools.yang.binding.ChildOf;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-
-public class RewriteCustomizerTest extends ReaderCustomizerTest<Rewrite, RewriteBuilder> {
-
- private static final String IFC_CTX_NAME = "ifc-test-instance";
- private static final String IF_NAME = "local0";
- private static final String VLAN_IF_NAME = "local0.1";
- private static final int VLAN_IF_INDEX = 11;
- private static final int VLAN_ID = 1;
-
- private NamingContext interfacesContext;
-
- @Captor
- private ArgumentCaptor<List<PushTags>> captor;
-
- public RewriteCustomizerTest() {
- super(Rewrite.class, L2Builder.class);
- }
-
- @Override
- public void setUp() {
- interfacesContext = new NamingContext("generatedIfaceName", IFC_CTX_NAME);
- defineMapping(mappingContext, VLAN_IF_NAME, VLAN_IF_INDEX, IFC_CTX_NAME);
- }
-
- @Override
- protected ReaderCustomizer<Rewrite, RewriteBuilder> initCustomizer() {
- return new RewriteCustomizer(api, interfacesContext);
- }
-
- private InstanceIdentifier<Rewrite> getVlanTagRewriteId(final String name, final long index) {
- final Class<ChildOf<? super SubInterface>> child = (Class)Rewrite.class;
- final InstanceIdentifier id =
- InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(name)).augmentation(
- SubinterfaceStateAugmentation.class).child(SubInterfaces.class)
- .child(SubInterface.class, new SubInterfaceKey(index))
- .child(child);
- return id;
- }
-
- @Test
- public void testRead() throws ReadFailedException {
- final Map<Integer, SwInterfaceDetails> cachedInterfaceDump = new HashMap<>();
-
- final SwInterfaceDetails ifaceDetails = new SwInterfaceDetails();
- ifaceDetails.subId = VLAN_ID;
- ifaceDetails.interfaceName = VLAN_IF_NAME.getBytes();
- ifaceDetails.vtrOp = TagRewriteOperation.translate_2_to_2.ordinal();
- ifaceDetails.subNumberOfTags = 2;
- ifaceDetails.vtrTag1 = 123;
- ifaceDetails.vtrTag2 = 321;
- ifaceDetails.vtrPushDot1Q = 1;
- cachedInterfaceDump.put(VLAN_IF_INDEX, ifaceDetails);
- cache.put(InterfaceCustomizer.DUMPED_IFCS_CONTEXT_KEY, cachedInterfaceDump);
-
- final RewriteBuilder builder = mock(RewriteBuilder.class);
-
- getCustomizer().readCurrentAttributes(getVlanTagRewriteId(IF_NAME, VLAN_ID), builder, ctx);
-
- verify(builder).setVlanType(_802dot1q.class);
- verify(builder).setPopTags((short) 2);
-
- verify(builder).setPushTags(captor.capture());
- final List<PushTags> tags = captor.getValue();
- assertEquals(ifaceDetails.subNumberOfTags, tags.size());
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizerTest.java
deleted file mode 100644
index 30c551c89..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizerTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
-import io.fd.honeycomb.vpp.test.util.InterfaceDumpHelper;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceStateAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.SubInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.SubInterfacesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterfaceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.match.attributes.match.type.VlanTagged;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Match;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Tags;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-
-public class SubInterfaceCustomizerTest extends ListReaderCustomizerTest<SubInterface, SubInterfaceKey, SubInterfaceBuilder> implements
- InterfaceDumpHelper {
-
- private static final String IFC_CTX_NAME = "ifc-test-instance";
- private static final String SUPER_IF_NAME = "local0";
- private static final int SUPER_IF_INDEX = 1;
- private static final String VLAN_IF_NAME = "local0.1";
- private static final int VLAN_IF_ID = 1;
- private static final int VLAN_IF_INDEX = 11;
-
- private NamingContext interfacesContext;
-
- public SubInterfaceCustomizerTest() {
- super(SubInterface.class, SubInterfacesBuilder.class);
- }
-
- @Override
- public void setUp() {
- interfacesContext = new NamingContext("generatedIfaceName", IFC_CTX_NAME);
- defineMapping(mappingContext, SUPER_IF_NAME, SUPER_IF_INDEX, IFC_CTX_NAME);
- defineMapping(mappingContext, VLAN_IF_NAME, VLAN_IF_INDEX, IFC_CTX_NAME);
- }
-
- @Override
- protected ReaderCustomizer<SubInterface, SubInterfaceBuilder> initCustomizer() {
- return new SubInterfaceCustomizer(api, interfacesContext);
- }
-
- private InstanceIdentifier<SubInterface> getSubInterfaceId(final String name, final long id) {
- return InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(name)).augmentation(
- SubinterfaceStateAugmentation.class).child(
- SubInterfaces.class).child(SubInterface.class, new SubInterfaceKey(id));
- }
-
- @Test
- public void testRead() throws ReadFailedException {
- final Map<Integer, SwInterfaceDetails> cachedInterfaceDump = new HashMap<>();
-
- final SwInterfaceDetails ifaceDetails = new SwInterfaceDetails();
- ifaceDetails.subId = VLAN_IF_ID;
- ifaceDetails.interfaceName = VLAN_IF_NAME.getBytes();
- ifaceDetails.subDot1Ad = 1;
- defineMapping(mappingContext, SUPER_IF_NAME, SUPER_IF_INDEX, IFC_CTX_NAME);
- defineMapping(mappingContext, VLAN_IF_NAME, VLAN_IF_INDEX, IFC_CTX_NAME);
- ifaceDetails.subNumberOfTags = 2;
- ifaceDetails.subOuterVlanIdAny = 1;
- ifaceDetails.subInnerVlanIdAny = 1;
- ifaceDetails.subExactMatch = 1;
- cachedInterfaceDump.put(VLAN_IF_INDEX, ifaceDetails);
- cache.put(InterfaceCustomizer.DUMPED_IFCS_CONTEXT_KEY, cachedInterfaceDump);
-
- final SubInterfaceBuilder builder = mock(SubInterfaceBuilder.class);
- getCustomizer().readCurrentAttributes(getSubInterfaceId(SUPER_IF_NAME, VLAN_IF_ID), builder, ctx);
-
- verify(builder).setIdentifier((long) VLAN_IF_ID);
-
- ArgumentCaptor<Tags> tagCaptor = ArgumentCaptor.forClass(Tags.class);
- verify(builder).setTags(tagCaptor.capture());
- assertEquals(ifaceDetails.subNumberOfTags, tagCaptor.getValue().getTag().size());
-
- ArgumentCaptor<Match> matchCaptor = ArgumentCaptor.forClass(Match.class);
- verify(builder).setMatch(matchCaptor.capture());
- final VlanTagged matchType = (VlanTagged)matchCaptor.getValue().getMatchType();
- assertTrue(matchType.getVlanTagged().isMatchExactTags());
- }
-
- @Test
- public void testGetAllIds() throws Exception {
- final SwInterfaceDetails iface = new SwInterfaceDetails();
- iface.interfaceName = VLAN_IF_NAME.getBytes();
- iface.swIfIndex = VLAN_IF_INDEX;
- iface.subId = VLAN_IF_ID;
- iface.supSwIfIndex = SUPER_IF_INDEX;
- whenSwInterfaceDumpThenReturn(api, iface);
-
- final List<SubInterfaceKey> allIds =
- getCustomizer().getAllIds(getSubInterfaceId(SUPER_IF_NAME, VLAN_IF_ID), ctx);
-
- assertEquals(1, allIds.size());
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceL2CustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceL2CustomizerTest.java
deleted file mode 100644
index 83e84102b..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceL2CustomizerTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-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.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceStateAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.SubInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterfaceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.L2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.L2Builder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class SubInterfaceL2CustomizerTest extends ReaderCustomizerTest<L2, L2Builder> {
-
- private static final String IFC_CTX_NAME = "ifc-test-instance";
- private static final String BD_CTX_NAME = "bd-test-instance";
- private NamingContext interfaceContext;
- private NamingContext bridgeDomainContext;
-
- private static final String IF_NAME = "local0";
- private static final int IF_INDEX = 1;
- private static final String SUB_IF_NAME = "local0.1";
- private static final long SUB_IF_ID = 1;
- private static final int SUB_IF_INDEX = 11;
- private InstanceIdentifier<L2> IID =
- InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(IF_NAME))
- .augmentation(SubinterfaceStateAugmentation.class)
- .child(SubInterfaces.class).child(SubInterface.class, new SubInterfaceKey(SUB_IF_ID)).child(L2.class);
-
- public SubInterfaceL2CustomizerTest() {
- super(L2.class, SubInterfaceBuilder.class);
- }
-
- @Override
- protected void setUp() {
- interfaceContext = new NamingContext("generatedIfaceName", IFC_CTX_NAME);
- bridgeDomainContext = new NamingContext("generatedBDName", BD_CTX_NAME);
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_CTX_NAME);
- defineMapping(mappingContext, SUB_IF_NAME, SUB_IF_INDEX, IFC_CTX_NAME);
- }
-
- @Override
- protected ReaderCustomizer<L2, L2Builder> initCustomizer() {
- return new SubInterfaceL2Customizer(api, interfaceContext, bridgeDomainContext);
- }
-
- @Test(expected = ReadFailedException.class)
- public void testReadFailed() throws ReadFailedException {
- final L2Builder builder = mock(L2Builder.class);
- when(api.swInterfaceDump(any())).thenReturn(failedFuture());
- getCustomizer().readCurrentAttributes(IID, builder, ctx);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/TapCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/TapCustomizerTest.java
deleted file mode 100644
index 3535085f8..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/TapCustomizerTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-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.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import io.fd.honeycomb.vpp.test.util.InterfaceDumpHelper;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Tap;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.TapBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceTapDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceTapDetailsReplyDump;
-
-public class TapCustomizerTest extends ReaderCustomizerTest<Tap, TapBuilder> implements InterfaceDumpHelper {
-
- private static final String IFC_CTX_NAME = "ifc-test-instance";
- private static final String IF_NAME = "tap1";
- private static final String TAP_NAME = "testTapName";
- private static final int IF_INDEX = 1;
- private static final InstanceIdentifier<Tap> IID =
- InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(IF_NAME))
- .augmentation(VppInterfaceStateAugmentation.class).child(Tap.class);
- private NamingContext interfaceContext;
-
- public TapCustomizerTest() {
- super(Tap.class, VppInterfaceStateAugmentationBuilder.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- interfaceContext = new NamingContext("generatedIfaceName", IFC_CTX_NAME);
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_CTX_NAME);
- whenSwInterfaceDumpThenReturn(api, ifaceDetails());
- }
-
- private SwInterfaceDetails ifaceDetails() {
- final SwInterfaceDetails details = new SwInterfaceDetails();
- details.swIfIndex = IF_INDEX;
- details.interfaceName = IF_NAME.getBytes();
- return details;
- }
-
- @Override
- protected ReaderCustomizer<Tap, TapBuilder> initCustomizer() {
- return new TapCustomizer(api, interfaceContext);
- }
-
- @Test
- public void testRead() throws ReadFailedException {
- final TapBuilder builder = mock(TapBuilder.class);
- when(api.swInterfaceTapDump(any())).thenReturn(future(tapDump()));
- getCustomizer().readCurrentAttributes(IID, builder, ctx);
- verify(builder).setTapName(TAP_NAME);
- }
-
- @Test(expected = ReadFailedException.class)
- public void testReadFailed() throws ReadFailedException {
- when(api.swInterfaceTapDump(any())).thenReturn(failedFuture());
- getCustomizer().readCurrentAttributes(IID, mock(TapBuilder.class), ctx);
- }
-
- private SwInterfaceTapDetailsReplyDump tapDump() {
- final SwInterfaceTapDetailsReplyDump reply = new SwInterfaceTapDetailsReplyDump();
- final SwInterfaceTapDetails details = new SwInterfaceTapDetails();
- details.devName = TAP_NAME.getBytes();
- details.swIfIndex = IF_INDEX;
- reply.swInterfaceTapDetails.add(details);
- return reply;
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/VhostUserCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/VhostUserCustomizerTest.java
deleted file mode 100644
index 90e3ed02c..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/VhostUserCustomizerTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-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.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import io.fd.honeycomb.vpp.test.util.InterfaceDumpHelper;
-import java.math.BigInteger;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VhostUserRole;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.VhostUser;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.VhostUserBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceVhostUserDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceVhostUserDetailsReplyDump;
-
-public class VhostUserCustomizerTest extends ReaderCustomizerTest<VhostUser, VhostUserBuilder> implements
- InterfaceDumpHelper {
- private static final String IFC_CTX_NAME = "ifc-test-instance";
- private static final String IF_NAME = "VirtualEthernet1";
- private static final int IF_INDEX = 1;
- private static final InstanceIdentifier<VhostUser> IID =
- InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(IF_NAME))
- .augmentation(VppInterfaceStateAugmentation.class).child(VhostUser.class);
-
- private NamingContext interfaceContext;
-
- public VhostUserCustomizerTest() {
- super(VhostUser.class, VppInterfaceStateAugmentationBuilder.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- interfaceContext = new NamingContext("generatedIfaceName", IFC_CTX_NAME);
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_CTX_NAME);
- whenSwInterfaceDumpThenReturn(api, ifaceDetails());
- }
-
- private SwInterfaceDetails ifaceDetails() {
- final SwInterfaceDetails details = new SwInterfaceDetails();
- details.swIfIndex = IF_INDEX;
- details.interfaceName = IF_NAME.getBytes();
- return details;
- }
-
- @Override
- protected ReaderCustomizer<VhostUser, VhostUserBuilder> initCustomizer() {
- return new VhostUserCustomizer(api, interfaceContext);
- }
-
- @Test
- public void testRead() throws ReadFailedException {
- final VhostUserBuilder builder = mock(VhostUserBuilder.class);
- when(api.swInterfaceVhostUserDump(any())).thenReturn(future(vhostDump()));
- getCustomizer().readCurrentAttributes(IID, builder, ctx);
- verifyVhostBuilder(builder);
- }
-
- @Test(expected = ReadFailedException.class)
- public void testReadFailed() throws ReadFailedException {
- when(api.swInterfaceVhostUserDump(any())).thenReturn(failedFuture());
- getCustomizer().readCurrentAttributes(IID, mock(VhostUserBuilder.class), ctx);
- }
-
- private SwInterfaceVhostUserDetailsReplyDump vhostDump() {
- final SwInterfaceVhostUserDetailsReplyDump reply = new SwInterfaceVhostUserDetailsReplyDump();
- final SwInterfaceVhostUserDetails details = new SwInterfaceVhostUserDetails();
- details.swIfIndex = IF_INDEX;
- details.interfaceName = IF_NAME.getBytes();
- details.isServer = 1;
- details.features = 2;
- details.numRegions = 3;
- details.sockFilename = "socketName".getBytes();
- details.virtioNetHdrSz = 4;
- details.sockErrno = 5;
- reply.swInterfaceVhostUserDetails.add(details);
- return reply;
- }
-
- private void verifyVhostBuilder(final VhostUserBuilder builder) {
- verify(builder).setRole(VhostUserRole.Server);
- verify(builder).setFeatures(BigInteger.valueOf(2));
- verify(builder).setNumMemoryRegions(3L);
- verify(builder).setSocket("socketName");
- verify(builder).setVirtioNetHdrSize(4L);
- verify(builder).setConnectError("5");
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanCustomizerTest.java
deleted file mode 100644
index 84beebc39..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanCustomizerTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-
-import com.google.common.collect.Lists;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.Map;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Vxlan;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.VxlanBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppInvocationException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.dto.VxlanTunnelDetails;
-import io.fd.vpp.jvpp.core.dto.VxlanTunnelDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.VxlanTunnelDump;
-
-public class VxlanCustomizerTest extends ReaderCustomizerTest<Vxlan, VxlanBuilder> {
-
- private static final String IFC_CTX_NAME = "ifc-test-instance";
- private static final String IF_NAME = "ifc1";
- private static final int IF_INDEX = 0;
-
- private NamingContext interfacesContext;
- static final InstanceIdentifier<Vxlan> IID =
- InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(IF_NAME))
- .augmentation(VppInterfaceStateAugmentation.class).child(Vxlan.class);
-
- public VxlanCustomizerTest() {
- super(Vxlan.class, VppInterfaceStateAugmentationBuilder.class);
- }
-
- @Override
- public void setUp() throws UnknownHostException, VppInvocationException {
- interfacesContext = new NamingContext("vxlan-tunnel", IFC_CTX_NAME);
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_CTX_NAME);
-
- final SwInterfaceDetails v = new SwInterfaceDetails();
- v.interfaceName = "vxlan-tunnel4".getBytes();
- final Map<Integer, SwInterfaceDetails> map = new HashMap<>();
- map.put(0, v);
- cache.put(InterfaceCustomizer.DUMPED_IFCS_CONTEXT_KEY, map);
-
- final VxlanTunnelDetailsReplyDump value = new VxlanTunnelDetailsReplyDump();
- final VxlanTunnelDetails vxlanTunnelDetails = new VxlanTunnelDetails();
- vxlanTunnelDetails.isIpv6 = 0;
- vxlanTunnelDetails.decapNextIndex = 1;
- vxlanTunnelDetails.dstAddress = InetAddress.getByName("1.2.3.4").getAddress();
- vxlanTunnelDetails.srcAddress = InetAddress.getByName("1.2.3.5").getAddress();
- vxlanTunnelDetails.encapVrfId = 55;
- vxlanTunnelDetails.swIfIndex = 0;
- vxlanTunnelDetails.vni = 9;
- value.vxlanTunnelDetails = Lists.newArrayList(vxlanTunnelDetails);
- doReturn(future(value)).when(api).vxlanTunnelDump(any(VxlanTunnelDump.class));
- }
-
- @Test
- public void testReadCurrentAttributes() throws Exception {
- final VxlanBuilder builder = getCustomizer().getBuilder(IID);
- getCustomizer().readCurrentAttributes(IID, builder, ctx);
-
- assertEquals(9, builder.getVni().getValue().intValue());
- assertEquals(55, builder.getEncapVrfId().intValue());
-
- assertNull(builder.getSrc().getIpv6Address());
- assertNotNull(builder.getSrc().getIpv4Address());
- assertEquals("1.2.3.5", builder.getSrc().getIpv4Address().getValue());
-
- assertNull(builder.getDst().getIpv6Address());
- assertNotNull(builder.getDst().getIpv4Address());
- assertEquals("1.2.3.4", builder.getDst().getIpv4Address().getValue());
-
- verify(api).vxlanTunnelDump(any(VxlanTunnelDump.class));
- }
-
- @Test(expected = NullPointerException.class)
- public void testReadCurrentAttributesVppNameNotCached() throws Exception {
- InterfaceCustomizer.getCachedInterfaceDump(cache).remove(0);
-
- final VxlanBuilder builder = getCustomizer().getBuilder(IID);
- getCustomizer().readCurrentAttributes(IID, builder, ctx);
- }
-
- @Test
- public void testReadCurrentAttributesWrongType() throws Exception {
- final SwInterfaceDetails v = new SwInterfaceDetails();
- v.interfaceName = "tap-2".getBytes();
- InterfaceCustomizer.getCachedInterfaceDump(cache).put(0, v);
-
- final VxlanBuilder builder = getCustomizer().getBuilder(IID);
- getCustomizer().readCurrentAttributes(IID, builder, ctx);
-
- // Should be ignored
- verifyZeroInteractions(api);
- }
-
- @Override
- protected ReaderCustomizer<Vxlan, VxlanBuilder> initCustomizer() {
- return new VxlanCustomizer(api, interfacesContext);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanGpeCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanGpeCustomizerTest.java
deleted file mode 100644
index e506ab361..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanGpeCustomizerTest.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-
-import com.google.common.collect.Lists;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.Map;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.VxlanGpe;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.VxlanGpeBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.dto.VxlanGpeTunnelDetails;
-import io.fd.vpp.jvpp.core.dto.VxlanGpeTunnelDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.VxlanGpeTunnelDump;
-
-public class VxlanGpeCustomizerTest extends ReaderCustomizerTest<VxlanGpe, VxlanGpeBuilder> {
-
- private static final String IFC_CTX_NAME = "ifc-test-instance";
- private static final String IF_NAME = "ifc2";
- private static final int IF_INDEX = 0;
-
- private NamingContext interfacesContext;
- private static final InstanceIdentifier<VxlanGpe> VXLAN_GPE_ID =
- InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(IF_NAME))
- .augmentation(VppInterfaceStateAugmentation.class).child(VxlanGpe.class);
-
- public VxlanGpeCustomizerTest() {
- super(VxlanGpe.class, VppInterfaceStateAugmentationBuilder.class);
- }
-
- @Override
- public void setUp() throws UnknownHostException, VppBaseCallException {
- interfacesContext = new NamingContext("vxlan_gpe_inf", IFC_CTX_NAME);
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_CTX_NAME);
-
- final SwInterfaceDetails v = new SwInterfaceDetails();
- v.interfaceName = "vxlan_gpe_inf2".getBytes();
- final Map<Integer, SwInterfaceDetails> map = new HashMap<>();
- map.put(0, v);
- cache.put(InterfaceCustomizer.DUMPED_IFCS_CONTEXT_KEY, map);
-
- final VxlanGpeTunnelDetailsReplyDump value = new VxlanGpeTunnelDetailsReplyDump();
- final VxlanGpeTunnelDetails vxlanGpeTunnelDetails = new VxlanGpeTunnelDetails();
- vxlanGpeTunnelDetails.isIpv6 = 0;
- vxlanGpeTunnelDetails.local = InetAddress.getByName("1.2.3.4").getAddress();
- vxlanGpeTunnelDetails.remote = InetAddress.getByName("1.2.3.5").getAddress();
- vxlanGpeTunnelDetails.vni = 9;
- vxlanGpeTunnelDetails.protocol = 1;
- vxlanGpeTunnelDetails.encapVrfId = 55;
- vxlanGpeTunnelDetails.decapVrfId = 66;
- vxlanGpeTunnelDetails.swIfIndex = 0;
- value.vxlanGpeTunnelDetails = Lists.newArrayList(vxlanGpeTunnelDetails);
- doReturn(future(value)).when(api).vxlanGpeTunnelDump(any(VxlanGpeTunnelDump.class));
- }
-
- @Test
- public void testReadCurrentAttributes() throws Exception {
- final VxlanGpeBuilder builder = getCustomizer().getBuilder(VXLAN_GPE_ID);
- getCustomizer().readCurrentAttributes(VXLAN_GPE_ID, builder, ctx);
-
- assertNull(builder.getLocal().getIpv6Address());
- assertNotNull(builder.getLocal().getIpv4Address());
- assertEquals("1.2.3.4", builder.getLocal().getIpv4Address().getValue());
-
- assertNull(builder.getRemote().getIpv6Address());
- assertNotNull(builder.getRemote().getIpv4Address());
- assertEquals("1.2.3.5", builder.getRemote().getIpv4Address().getValue());
-
- assertEquals(9, builder.getVni().getValue().intValue());
- assertEquals(1, builder.getNextProtocol().getIntValue());
- assertEquals(55, builder.getEncapVrfId().intValue());
- assertEquals(66, builder.getDecapVrfId().intValue());
-
- verify(api).vxlanGpeTunnelDump(any(VxlanGpeTunnelDump.class));
- }
-
- @Test(expected = NullPointerException.class)
- public void testReadCurrentAttributesVppNameNotCached() throws Exception {
- InterfaceCustomizer.getCachedInterfaceDump(cache).remove(0);
-
- final VxlanGpeBuilder builder = getCustomizer().getBuilder(VXLAN_GPE_ID);
- getCustomizer().readCurrentAttributes(VXLAN_GPE_ID, builder, ctx);
- }
-
- @Test
- public void testReadCurrentAttributesWrongType() throws Exception {
- final SwInterfaceDetails v = new SwInterfaceDetails();
- v.interfaceName = "tap-3".getBytes();
- InterfaceCustomizer.getCachedInterfaceDump(cache).put(0, v);
-
- final VxlanGpeBuilder builder = getCustomizer().getBuilder(VXLAN_GPE_ID);
- getCustomizer().readCurrentAttributes(VXLAN_GPE_ID, builder, ctx);
-
- // Should be ignored
- verifyZeroInteractions(api);
- }
-
- @Override
- protected ReaderCustomizer<VxlanGpe, VxlanGpeBuilder> initCustomizer() {
- return new VxlanGpeCustomizer(api, interfacesContext);
- }
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/AclCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/AclCustomizerTest.java
deleted file mode 100644
index b6dd44559..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/AclCustomizerTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate.acl.ingress;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-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.v3po.vppclassifier.VppClassifierContextManager;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableByInterfaceReply;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceStateAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.L2AclBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.AclBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.acl.Ingress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces.state._interface.acl.IngressBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class AclCustomizerTest extends ReaderCustomizerTest<Ingress, IngressBuilder> {
-
- private static final String IF_NAME = "local0";
- private static final int IF_INDEX = 1;
- private static final int TABLE_INDEX = 123;
- private static final String TABLE_NAME = "table123";
- private static final InstanceIdentifier<Ingress> IID =
- InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(IF_NAME))
- .augmentation(VppInterfaceStateAugmentation.class).child(Acl.class).child(Ingress.class);
-
- private static final String IFC_CTX_NAME = "ifc-test-instance";
-
- private NamingContext interfaceContext;
-
- @Mock
- private VppClassifierContextManager classifyTableContext;
-
- public AclCustomizerTest() {
- super(Ingress.class, AclBuilder.class);
- }
-
- @Override
- public void setUp() {
- interfaceContext = new NamingContext("generatedIfaceName", IFC_CTX_NAME);
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_CTX_NAME);
- }
-
- @Override
- protected ReaderCustomizer<Ingress, IngressBuilder> initCustomizer() {
- return new AclCustomizer(api, interfaceContext, classifyTableContext);
- }
-
- @Test
- public void testRead() throws ReadFailedException {
- final IngressBuilder builder = mock(IngressBuilder.class);
-
- final ClassifyTableByInterfaceReply reply = new ClassifyTableByInterfaceReply();
- reply.l2TableId = TABLE_INDEX;
- reply.ip4TableId = ~0;
- reply.ip6TableId = ~0;
- when(api.classifyTableByInterface(any())).thenReturn(future(reply));
-
- when(classifyTableContext.getTableName(TABLE_INDEX, mappingContext)).thenReturn(TABLE_NAME);
-
- getCustomizer().readCurrentAttributes(IID, builder, ctx);
-
- verify(builder).setL2Acl(new L2AclBuilder().setClassifyTable(TABLE_NAME).build());
- verify(builder).setIp4Acl(null);
- verify(builder).setIp6Acl(null);
- }
-
- @Test(expected = ReadFailedException.class)
- public void testReadFailed() throws ReadFailedException {
- when(api.classifyTableByInterface(any())).thenReturn(failedFuture());
- getCustomizer().readCurrentAttributes(IID, mock(IngressBuilder.class), ctx);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/SubInterfaceAclCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/SubInterfaceAclCustomizerTest.java
deleted file mode 100644
index 7406f94d7..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/SubInterfaceAclCustomizerTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate.acl.ingress;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-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.v3po.vppclassifier.VppClassifierContextManager;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableByInterfaceReply;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip4AclBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.Ip6AclBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceStateAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.SubInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Acl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.AclBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.acl.Ingress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.acl.IngressBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class SubInterfaceAclCustomizerTest extends ReaderCustomizerTest<Ingress, IngressBuilder> {
- private static final String IFC_CTX_NAME = "ifc-test-instance";
- private static final String IF_NAME = "local0";
- private static final int IF_INDEX = 1;
- private static final String SUB_IF_NAME = "local0.1";
- private static final long SUB_IF_ID = 1;
- private static final int SUB_IF_INDEX = 11;
- private static final int TABLE_INDEX = 123;
- private static final String TABLE_NAME = "table123";
-
- private static final InstanceIdentifier<Ingress> IID =
- InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(IF_NAME))
- .augmentation(SubinterfaceStateAugmentation.class).child(SubInterfaces.class)
- .child(SubInterface.class, new SubInterfaceKey(SUB_IF_ID)).child(Acl.class).child(Ingress.class);
-
- private NamingContext interfaceContext;
-
- @Mock
- private VppClassifierContextManager classifyTableContext;
-
- public SubInterfaceAclCustomizerTest() {
- super(Ingress.class, AclBuilder.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- interfaceContext = new NamingContext("generatedIfaceName", IFC_CTX_NAME);
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_CTX_NAME);
- defineMapping(mappingContext, SUB_IF_NAME, SUB_IF_INDEX, IFC_CTX_NAME);
- }
-
- @Override
- protected ReaderCustomizer<Ingress, IngressBuilder> initCustomizer() {
- return new SubInterfaceAclCustomizer(api, interfaceContext, classifyTableContext);
- }
-
- @Test
- public void testRead() throws ReadFailedException {
- final IngressBuilder builder = mock(IngressBuilder.class);
-
- final ClassifyTableByInterfaceReply reply = new ClassifyTableByInterfaceReply();
- reply.swIfIndex = SUB_IF_INDEX;
- reply.l2TableId = ~0;
- reply.ip4TableId = TABLE_INDEX;
- reply.ip6TableId = TABLE_INDEX;
- when(api.classifyTableByInterface(any())).thenReturn(future(reply));
-
- when(classifyTableContext.getTableName(TABLE_INDEX, mappingContext)).thenReturn(TABLE_NAME);
-
- getCustomizer().readCurrentAttributes(IID, builder, ctx);
-
- verify(builder).setL2Acl(null);
- verify(builder).setIp4Acl(new Ip4AclBuilder().setClassifyTable(TABLE_NAME).build());
- verify(builder).setIp6Acl(new Ip6AclBuilder().setClassifyTable(TABLE_NAME).build());
- }
-
- @Test(expected = ReadFailedException.class)
- public void testReadFailed() throws ReadFailedException {
- when(api.classifyTableByInterface(any())).thenReturn(failedFuture());
- getCustomizer().readCurrentAttributes(IID, mock(IngressBuilder.class), ctx);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4AddressCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4AddressCustomizerTest.java
deleted file mode 100644
index efe6c6afe..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4AddressCustomizerTest.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate.ip;
-
-
-import static org.hamcrest.Matchers.empty;
-import static org.hamcrest.Matchers.hasSize;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.util.read.cache.CacheKeyFactory;
-import io.fd.honeycomb.translate.util.read.cache.IdentifierCacheKeyFactory;
-import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetails;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.IpAddressDump;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.CompletableFuture;
-import java.util.stream.Collectors;
-import org.hamcrest.Matchers;
-import org.junit.Test;
-import org.mockito.Mockito;
-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.inet.types.rev130715.Ipv4AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.AddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.AddressKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.address.subnet.PrefixLength;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class Ipv4AddressCustomizerTest extends ListReaderCustomizerTest<Address, AddressKey, AddressBuilder> implements
- Ipv4Translator {
-
- private static final String IFACE_NAME = "eth0";
- private static final String IFACE_2_NAME = "eth1";
- private static final int IFACE_ID = 1;
- private static final int IFACE_2_ID = 2;
- private static final String IFC_CTX_NAME = "ifc-test-instance";
-
- private NamingContext interfacesContext;
- private InstanceIdentifier<Address> ifaceOneAddressOneIdentifier;
- private InstanceIdentifier<Address> ifaceTwoAddressOneIdentifier;
- private CacheKeyFactory cacheKeyFactory;
-
- public Ipv4AddressCustomizerTest() {
- super(Address.class, Ipv4Builder.class);
- }
-
- @Override
- public void setUp() {
- interfacesContext = new NamingContext("generatedIfaceName", IFC_CTX_NAME);
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
- defineMapping(mappingContext, IFACE_2_NAME, IFACE_2_ID, IFC_CTX_NAME);
-
- ifaceOneAddressOneIdentifier =
- InstanceIdentifier.create(InterfacesState.class)
- .child(Interface.class, new InterfaceKey(IFACE_NAME))
- .augmentation(Interface2.class)
- .child(Ipv4.class)
- .child(Address.class, new AddressKey(new Ipv4AddressNoZone("192.168.2.1")));
- ifaceTwoAddressOneIdentifier =
- InstanceIdentifier.create(InterfacesState.class)
- .child(Interface.class, new InterfaceKey(IFACE_2_NAME))
- .augmentation(Interface2.class)
- .child(Ipv4.class)
- .child(Address.class, new AddressKey(new Ipv4AddressNoZone("192.168.2.1")));
-
- // to simulate complex key
- cacheKeyFactory = new IdentifierCacheKeyFactory(ImmutableSet.of(Interface.class));
- }
-
- @Override
- protected ReaderCustomizer<Address, AddressBuilder> initCustomizer() {
- return new Ipv4AddressCustomizer(api, interfacesContext);
- }
-
- private static InstanceIdentifier<Address> getId(final String address, final String ifaceName) {
- return InstanceIdentifier.builder(InterfacesState.class)
- .child(Interface.class, new InterfaceKey(ifaceName))
- .augmentation(Interface2.class)
- .child(Ipv4.class)
- .child(Address.class, new AddressKey(new Ipv4AddressNoZone(new Ipv4Address(address))))
- .build();
- }
-
- @Test
- public void testReadCurrentAttributesFor2Ifcs() throws ReadFailedException {
- //changed to mock to not store first dumped data(otherwise that double thenReturn on line 118 is not gonna work)
-
- IpAddressDetails detail1 = new IpAddressDetails();
- IpAddressDetails detail2 = new IpAddressDetails();
-
- detail1.ip = reverseBytes(
- ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"))));
- detail2.ip = reverseBytes(
- ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.2"))));
-
- IpAddressDetailsReplyDump reply = new IpAddressDetailsReplyDump();
- reply.ipAddressDetails = ImmutableList.of(detail1);
- IpAddressDetailsReplyDump reply2 = new IpAddressDetailsReplyDump();
- reply2.ipAddressDetails = ImmutableList.of(detail2);
-
- CompletableFuture<IpAddressDetailsReplyDump> future = new CompletableFuture<>();
- future.complete(reply);
- CompletableFuture<IpAddressDetailsReplyDump> future2 = new CompletableFuture<>();
- future2.complete(reply2);
-
- when(api.ipAddressDump(Mockito.any(IpAddressDump.class))).thenReturn(future).thenReturn(future2)
- .thenReturn(future).thenReturn(future2);
- when(api.ipAddressDump(Mockito.any(IpAddressDump.class))).thenReturn(future(reply)).thenReturn(future(reply2))
- .thenReturn(future(reply)).thenReturn(future(reply2));
- when(ctx.getModificationCache()).thenReturn(cache);
-
-
- final InstanceIdentifier<Address> id = getId("192.168.2.1", IFACE_NAME);
- final InstanceIdentifier<Address> id2 = getId("192.168.2.2", IFACE_2_NAME);
-
- final List<AddressKey> ifc1Ids = getCustomizer().getAllIds(id, ctx);
- assertThat(ifc1Ids.size(), is(1));
- assertThat(ifc1Ids, Matchers.hasItem(new AddressKey(new Ipv4AddressNoZone("192.168.2.1"))));
- final List<AddressKey> ifc2Ids = getCustomizer().getAllIds(id2, ctx);
- assertThat(ifc2Ids.size(), is(1));
- assertThat(ifc2Ids, Matchers.hasItem(new AddressKey(new Ipv4AddressNoZone("192.168.2.2"))));
-
- AddressBuilder builder = new AddressBuilder();
- getCustomizer().readCurrentAttributes(id, builder, ctx);
- assertEquals(builder.getIp().getValue(), "192.168.2.1");
- builder = new AddressBuilder();
- getCustomizer().readCurrentAttributes(id2, builder, ctx);
- assertEquals(builder.getIp().getValue(), "192.168.2.2");
- }
-
- @Test
- public void testReadCurrentAttributesSuccessfull() throws ReadFailedException {
- IpAddressDetails detail1 = new IpAddressDetails();
- IpAddressDetails detail2 = new IpAddressDetails();
- IpAddressDetails detail3 = new IpAddressDetails();
-
- detail1.ip = reverseBytes(
- ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"))));
- detail2.ip = reverseBytes(
- ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.2"))));
- detail3.ip = reverseBytes(
- ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.3"))));
-
- IpAddressDetailsReplyDump reply = new IpAddressDetailsReplyDump();
- reply.ipAddressDetails = ImmutableList.of(detail1, detail2, detail3);
- when(api.ipAddressDump(Mockito.any(IpAddressDump.class))).thenReturn(future(reply));
- when(ctx.getModificationCache()).thenReturn(cache);
-
- final AddressBuilder builder = new AddressBuilder();
- final InstanceIdentifier<Address> id = getId("192.168.2.1", IFACE_NAME);
-
- getCustomizer().readCurrentAttributes(id, builder, ctx);
-
- assertEquals("192.168.2.1", builder.getIp().getValue());
- }
-
- @Test
- public void testGetAllIdsFromSuccessfull() throws ReadFailedException {
- IpAddressDetails detail1 = new IpAddressDetails();
- IpAddressDetails detail2 = new IpAddressDetails();
- IpAddressDetails detail3 = new IpAddressDetails();
-
- detail1.ip = reverseBytes(
- ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"))));
- detail2.ip = reverseBytes(
- ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.2"))));
- detail3.ip = reverseBytes(
- ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.3"))));
-
- IpAddressDetailsReplyDump reply = new IpAddressDetailsReplyDump();
- reply.ipAddressDetails = ImmutableList.of(detail1, detail2, detail3);
- when(api.ipAddressDump(Mockito.any(IpAddressDump.class))).thenReturn(future(reply));
- when(ctx.getModificationCache()).thenReturn(cache);
-
- final InstanceIdentifier<Address> id = getId("192.168.2.1", IFACE_NAME);
-
- List<Ipv4AddressNoZone> ids = getCustomizer().getAllIds(id, ctx).stream()
- .map(key -> key.getIp())
- .collect(Collectors.toList());
-
- assertEquals(3, ids.size());
- assertEquals(true, "192.168.2.1".equals(ids.get(0).getValue()));
- assertEquals(true, "192.168.2.2".equals(ids.get(1).getValue()));
- assertEquals(true, "192.168.2.3".equals(ids.get(2).getValue()));
- }
-
- @Test
- public void testCachingScopeSpecificRequest() throws ReadFailedException {
- fillCacheForTwoIfaces();
- final AddressBuilder ifaceOneAddressBuilder = new AddressBuilder();
- final AddressBuilder ifaceTwoAddressBuilder = new AddressBuilder();
-
- getCustomizer().readCurrentAttributes(ifaceOneAddressOneIdentifier, ifaceOneAddressBuilder, ctx);
- getCustomizer().readCurrentAttributes(ifaceTwoAddressOneIdentifier, ifaceTwoAddressBuilder, ctx);
-
- // addresses have caching scope of parent interface, so returned address should have respective prefix lengths
- assertEquals("192.168.2.1", ifaceOneAddressBuilder.getIp().getValue());
- assertTrue(ifaceOneAddressBuilder.getSubnet() instanceof PrefixLength);
- assertEquals(22, PrefixLength.class.cast(ifaceOneAddressBuilder.getSubnet()).getPrefixLength().intValue());
-
- assertEquals("192.168.2.1", ifaceTwoAddressBuilder.getIp().getValue());
- assertTrue(ifaceTwoAddressBuilder.getSubnet() instanceof PrefixLength);
- assertEquals(23, PrefixLength.class.cast(ifaceTwoAddressBuilder.getSubnet()).getPrefixLength().intValue());
- }
-
- @Test
- public void testCachingScopeGetAll() throws ReadFailedException {
- fillCacheForFirstIfaceSecondEmpty();
-
- final List<AddressKey> keysForIfaceOne = getCustomizer().getAllIds(ifaceOneAddressOneIdentifier, ctx);
- assertThat(keysForIfaceOne, hasSize(1));
- final AddressKey keyIfaceOne = keysForIfaceOne.get(0);
- assertEquals("192.168.2.1", keyIfaceOne.getIp().getValue());
-
- final List<AddressKey> keysForIfaceTwo = getCustomizer().getAllIds(ifaceTwoAddressOneIdentifier, ctx);
- assertThat(keysForIfaceTwo, is(empty()));
- }
-
- private void fillCacheForTwoIfaces() {
- IpAddressDetails detailIfaceOneAddressOne = new IpAddressDetails();
- IpAddressDetails detailIfaceTwoAddressOne = new IpAddressDetails();
- IpAddressDetailsReplyDump replyIfaceOne = new IpAddressDetailsReplyDump();
- IpAddressDetailsReplyDump replyIfaceTwo = new IpAddressDetailsReplyDump();
-
- replyIfaceOne.ipAddressDetails = Arrays.asList(detailIfaceOneAddressOne);
- replyIfaceTwo.ipAddressDetails = Arrays.asList(detailIfaceTwoAddressOne);
-
- detailIfaceOneAddressOne.ip = reverseBytes(
- ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"))));
- detailIfaceOneAddressOne.prefixLength = 22;
-
- detailIfaceTwoAddressOne.ip = reverseBytes(
- ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"))));
- detailIfaceTwoAddressOne.prefixLength = 23;
-
- cache.put(cacheKeyFactory.createKey(ifaceOneAddressOneIdentifier), replyIfaceOne);
- cache.put(cacheKeyFactory.createKey(ifaceTwoAddressOneIdentifier), replyIfaceTwo);
- }
-
- private void fillCacheForFirstIfaceSecondEmpty() {
- IpAddressDetails detailIfaceOneAddressOne = new IpAddressDetails();
- IpAddressDetailsReplyDump replyIfaceOne = new IpAddressDetailsReplyDump();
- replyIfaceOne.ipAddressDetails = Arrays.asList(detailIfaceOneAddressOne);
-
- detailIfaceOneAddressOne.ip = reverseBytes(
- ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"))));
- detailIfaceOneAddressOne.prefixLength = 22;
-
- cache.put(cacheKeyFactory.createKey(ifaceOneAddressOneIdentifier), replyIfaceOne);
- cache.put(cacheKeyFactory.createKey(ifaceTwoAddressOneIdentifier), new IpAddressDetailsReplyDump());
- }
-}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4CustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4CustomizerTest.java
deleted file mode 100644
index f536a37eb..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4CustomizerTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate.ip;
-
-import static org.mockito.Mockito.verifyZeroInteractions;
-
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4Builder;
-
-public class Ipv4CustomizerTest extends ReaderCustomizerTest<Ipv4, Ipv4Builder> {
-
- public Ipv4CustomizerTest() {
- super(Ipv4.class, Interface2Builder.class);
- }
-
- @Test
- public void testReadCurrentAttributes() throws Exception {
- customizer.readCurrentAttributes(null, null, ctx);
- verifyZeroInteractions(api);
- }
-
- @Override
- protected ReaderCustomizer<Ipv4, Ipv4Builder> initCustomizer() {
- return new Ipv4Customizer(api);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizerTest.java
deleted file mode 100644
index 9a9346a5a..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizerTest.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate.ip;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsInAnyOrder;
-import static org.hamcrest.Matchers.empty;
-import static org.hamcrest.Matchers.hasSize;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import com.google.common.collect.ImmutableSet;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
-import io.fd.honeycomb.translate.util.read.cache.CacheKeyFactory;
-import io.fd.honeycomb.translate.util.read.cache.IdentifierCacheKeyFactory;
-import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetails;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetailsReplyDump;
-import java.util.Arrays;
-import java.util.List;
-import org.junit.Assert;
-import org.junit.Test;
-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.inet.types.rev130715.Ipv4AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceStateAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.SubInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.AddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.AddressKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.address.subnet.PrefixLength;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip4.attributes.ipv4.address.subnet.PrefixLengthBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class SubInterfaceIpv4AddressCustomizerTest extends ListReaderCustomizerTest<Address, AddressKey, AddressBuilder>
- implements Ipv4Translator {
-
- private static final String IFC_CTX_NAME = "ifc-test-instance";
- private static final String IF_NAME = "local0";
- private static final int IF_INDEX = 1;
- private static final String SUB_IF_NAME = "local0.1";
- private static final String SUB_IF_2_NAME = "local0.2";
- private static final long SUB_IF_ID = 1;
- private static final int SUB_IF_INDEX = 11;
- private static final int SUB_IF_2_INDEX = 12;
- private static final InstanceIdentifier<Ipv4> IP4_IID =
- InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(IF_NAME))
- .augmentation(SubinterfaceStateAugmentation.class)
- .child(SubInterfaces.class).child(SubInterface.class, new SubInterfaceKey(SUB_IF_ID))
- .child(Ipv4.class);
- private InstanceIdentifier<Address> ifaceOneAddressOneIdentifier;
- private InstanceIdentifier<Address> ifaceTwoAddressOneIdentifier;
- private CacheKeyFactory cacheKeyFactory;
- private static final Ipv4AddressNoZone IP1 = new Ipv4AddressNoZone("10.1.1.1");
- private static final Ipv4AddressNoZone IP2 = new Ipv4AddressNoZone("10.1.1.2");
- private static final short PREFIX_LENGTH = 16;
-
- private NamingContext interfaceContext;
-
- public SubInterfaceIpv4AddressCustomizerTest() {
- super(Address.class, Ipv4Builder.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- interfaceContext = new NamingContext("generatedIfaceName", IFC_CTX_NAME);
-
- ifaceOneAddressOneIdentifier = InstanceIdentifier.create(InterfacesState.class)
- .child(Interface.class, new InterfaceKey(IF_NAME))
- .augmentation(SubinterfaceStateAugmentation.class)
- .child(SubInterfaces.class)
- .child(SubInterface.class, new SubInterfaceKey(1L))
- .child(Ipv4.class)
- .child(Address.class, new AddressKey(new Ipv4AddressNoZone("192.168.2.1")));
- ifaceTwoAddressOneIdentifier = InstanceIdentifier.create(InterfacesState.class)
- .child(Interface.class, new InterfaceKey(IF_NAME))
- .augmentation(SubinterfaceStateAugmentation.class)
- .child(SubInterfaces.class)
- .child(SubInterface.class, new SubInterfaceKey(2L))
- .child(Ipv4.class)
- .child(Address.class, new AddressKey(new Ipv4AddressNoZone("192.168.2.1")));
-
- // to simulate complex key
- cacheKeyFactory = new IdentifierCacheKeyFactory(ImmutableSet.of(SubInterface.class));
-
- defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_CTX_NAME);
- defineMapping(mappingContext, SUB_IF_NAME, SUB_IF_INDEX, IFC_CTX_NAME);
- defineMapping(mappingContext, SUB_IF_2_NAME, SUB_IF_2_INDEX, IFC_CTX_NAME);
- }
-
- @Override
- protected ListReaderCustomizer<Address, AddressKey, AddressBuilder> initCustomizer() {
- return new SubInterfaceIpv4AddressCustomizer(api, interfaceContext);
- }
-
- private static InstanceIdentifier<Address> getId() {
- return IP4_IID.child(Address.class);
- }
-
- private static InstanceIdentifier<Address> getId(final Ipv4AddressNoZone ip) {
- return IP4_IID.child(Address.class, new AddressKey(ip));
- }
-
- @Test
- public void testRead() throws ReadFailedException {
- final AddressBuilder builder = mock(AddressBuilder.class);
- when(api.ipAddressDump(any())).thenReturn(future(dump()));
- getCustomizer().readCurrentAttributes(getId(IP2), builder, ctx);
- verify(builder).setIp(IP2);
- verify(builder).setSubnet(new PrefixLengthBuilder().setPrefixLength(PREFIX_LENGTH).build());
- }
-
- @Test(expected = ReadFailedException.class)
- public void testReadFailed() throws ReadFailedException {
- when(api.ipAddressDump(any())).thenReturn(failedFuture());
- getCustomizer().readCurrentAttributes(getId(IP1), mock(AddressBuilder.class), ctx);
- }
-
- @Test
- public void testGetAllIds() throws ReadFailedException {
- when(api.ipAddressDump(any())).thenReturn(future(dump()));
- final List<AddressKey> allIds = getCustomizer().getAllIds(getId(), ctx);
- assertThat(allIds, hasSize(2));
- assertThat(allIds, containsInAnyOrder(new AddressKey(IP1), new AddressKey(IP2)));
- }
-
- @Test(expected = ReadFailedException.class)
- public void testGetAllIdsFailed() throws ReadFailedException {
- when(api.ipAddressDump(any())).thenReturn(failedFuture());
- getCustomizer().getAllIds(getId(), ctx);
- }
-
- @Test
- public void testCacheScope() {
-
- }
-
- @Test
- public void testCachingScopeSpecificRequest() throws ReadFailedException {
- fillCacheForTwoIfaces();
- final AddressBuilder ifaceOneAddressBuilder = new AddressBuilder();
- final AddressBuilder ifaceTwoAddressBuilder = new AddressBuilder();
-
- getCustomizer().readCurrentAttributes(ifaceOneAddressOneIdentifier, ifaceOneAddressBuilder, ctx);
- getCustomizer().readCurrentAttributes(ifaceTwoAddressOneIdentifier, ifaceTwoAddressBuilder, ctx);
-
- // addresses have caching scope of parent interface, so returned address should have respective prefix lengths
- assertEquals("192.168.2.1", ifaceOneAddressBuilder.getIp().getValue());
- assertTrue(ifaceOneAddressBuilder.getSubnet() instanceof PrefixLength);
- assertEquals(22, PrefixLength.class.cast(ifaceOneAddressBuilder.getSubnet()).getPrefixLength().intValue());
-
- assertEquals("192.168.2.1", ifaceTwoAddressBuilder.getIp().getValue());
- assertTrue(ifaceTwoAddressBuilder.getSubnet() instanceof PrefixLength);
- assertEquals(23, PrefixLength.class.cast(ifaceTwoAddressBuilder.getSubnet()).getPrefixLength().intValue());
- }
-
- @Test
- public void testCachingScopeGetAll() throws ReadFailedException {
- fillCacheForFirstIfaceSecondEmpty();
-
- final List<AddressKey> keysForIfaceOne = getCustomizer().getAllIds(ifaceOneAddressOneIdentifier, ctx);
- Assert.assertThat(keysForIfaceOne, hasSize(1));
- final AddressKey keyIfaceOne = keysForIfaceOne.get(0);
- assertEquals("192.168.2.1", keyIfaceOne.getIp().getValue());
-
- final List<AddressKey> keysForIfaceTwo = getCustomizer().getAllIds(ifaceTwoAddressOneIdentifier, ctx);
- Assert.assertThat(keysForIfaceTwo, is(empty()));
- }
-
- private void fillCacheForTwoIfaces() {
- IpAddressDetails detailIfaceOneAddressOne = new IpAddressDetails();
- IpAddressDetails detailIfaceTwoAddressOne = new IpAddressDetails();
- IpAddressDetailsReplyDump replyIfaceOne = new IpAddressDetailsReplyDump();
- IpAddressDetailsReplyDump replyIfaceTwo = new IpAddressDetailsReplyDump();
-
- replyIfaceOne.ipAddressDetails = Arrays.asList(detailIfaceOneAddressOne);
- replyIfaceTwo.ipAddressDetails = Arrays.asList(detailIfaceTwoAddressOne);
-
- detailIfaceOneAddressOne.ip = reverseBytes(
- ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"))));
- detailIfaceOneAddressOne.prefixLength = 22;
-
- detailIfaceTwoAddressOne.ip = reverseBytes(
- ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"))));
- detailIfaceTwoAddressOne.prefixLength = 23;
-
- cache.put(cacheKeyFactory.createKey(ifaceOneAddressOneIdentifier), replyIfaceOne);
- cache.put(cacheKeyFactory.createKey(ifaceTwoAddressOneIdentifier), replyIfaceTwo);
- }
-
- private void fillCacheForFirstIfaceSecondEmpty() {
- IpAddressDetails detailIfaceOneAddressOne = new IpAddressDetails();
- IpAddressDetailsReplyDump replyIfaceOne = new IpAddressDetailsReplyDump();
- replyIfaceOne.ipAddressDetails = Arrays.asList(detailIfaceOneAddressOne);
-
- detailIfaceOneAddressOne.ip = reverseBytes(
- ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"))));
- detailIfaceOneAddressOne.prefixLength = 22;
-
- cache.put(cacheKeyFactory.createKey(ifaceOneAddressOneIdentifier), replyIfaceOne);
- cache.put(cacheKeyFactory.createKey(ifaceTwoAddressOneIdentifier), new IpAddressDetailsReplyDump());
- }
-
- private IpAddressDetailsReplyDump dump() {
- final IpAddressDetailsReplyDump reply = new IpAddressDetailsReplyDump();
-
- final IpAddressDetails details1 = new IpAddressDetails();
- details1.ip = new byte[]{1, 1, 1, 10};
- details1.prefixLength = (byte) PREFIX_LENGTH;
- reply.ipAddressDetails.add(details1);
-
- final IpAddressDetails details2 = new IpAddressDetails();
- details2.ip = new byte[]{2, 1, 1, 10};
- details2.prefixLength = (byte) PREFIX_LENGTH;
- reply.ipAddressDetails.add(details2);
-
- return reply;
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/pbb/PbbRewriteStateCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/pbb/PbbRewriteStateCustomizerTest.java
deleted file mode 100644
index 156e9a055..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/pbb/PbbRewriteStateCustomizerTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.translate.v3po.interfacesstate.pbb;
-
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.PbbRewriteStateInterfaceAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.interfaces.state._interface.PbbRewriteState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.pbb.rev161214.interfaces.state._interface.PbbRewriteStateBuilder;
-
-public class PbbRewriteStateCustomizerTest extends ReaderCustomizerTest<PbbRewriteState, PbbRewriteStateBuilder> {
-
- public PbbRewriteStateCustomizerTest() {
- super(PbbRewriteState.class, PbbRewriteStateInterfaceAugmentationBuilder.class);
- }
-
- @Override
- protected ReaderCustomizer<PbbRewriteState, PbbRewriteStateBuilder> initCustomizer() {
- return new PbbRewriteStateCustomizer(api);
- }
-}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducerTest.java
deleted file mode 100644
index 40ae35700..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducerTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.translate.v3po.notification;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import io.fd.honeycomb.notification.NotificationCollector;
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.vpp.test.util.NamingContextHelper;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.util.FutureProducer;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.InterfaceStateChange;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.InterfaceStatus;
-import io.fd.vpp.jvpp.core.callback.SwInterfaceSetFlagsNotificationCallback;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsNotification;
-import io.fd.vpp.jvpp.core.dto.WantInterfaceEvents;
-import io.fd.vpp.jvpp.core.dto.WantInterfaceEventsReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import io.fd.vpp.jvpp.core.notification.CoreNotificationRegistry;
-
-public class InterfaceChangeNotificationProducerTest implements FutureProducer, NamingContextHelper {
-
- private static final String IFC_CTX_NAME = "ifc-test-instance";
- private static final String IFACE_NAME = "eth0";
- private static final int IFACE_ID = 0;
-
- @Mock
- private FutureJVppCore jVpp;
- private NamingContext namingContext = new NamingContext("test", IFC_CTX_NAME);
- @Mock
- private MappingContext mappingContext;
- @Mock
- private NotificationCollector collector;
- @Mock
- private CoreNotificationRegistry notificationRegistry;
- @Mock
- private AutoCloseable notificationListenerReg;
-
- private ArgumentCaptor<SwInterfaceSetFlagsNotificationCallback> callbackArgumentCaptor;
-
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- doReturn(notificationRegistry).when(jVpp).getNotificationRegistry();
- callbackArgumentCaptor = ArgumentCaptor.forClass(SwInterfaceSetFlagsNotificationCallback.class);
- doReturn(notificationListenerReg).when(notificationRegistry).registerSwInterfaceSetFlagsNotificationCallback(
- callbackArgumentCaptor.capture());
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
- doReturn(future(new WantInterfaceEventsReply())).when(jVpp).wantInterfaceEvents(any(WantInterfaceEvents.class));
- }
-
- @Test
- public void testStart() throws Exception {
- final InterfaceChangeNotificationProducer interfaceChangeNotificationProducer =
- new InterfaceChangeNotificationProducer(jVpp, namingContext, mappingContext);
-
- interfaceChangeNotificationProducer.start(collector);
- verify(jVpp).wantInterfaceEvents(any(WantInterfaceEvents.class));
- verify(jVpp).getNotificationRegistry();
- verify(notificationRegistry).registerSwInterfaceSetFlagsNotificationCallback(any(
- SwInterfaceSetFlagsNotificationCallback.class));
-
- interfaceChangeNotificationProducer.stop();
- verify(jVpp, times(2)).wantInterfaceEvents(any(WantInterfaceEvents.class));
- verify(notificationListenerReg).close();
- }
-
- @Test
- public void testNotification() throws Exception {
- final InterfaceChangeNotificationProducer interfaceChangeNotificationProducer =
- new InterfaceChangeNotificationProducer(jVpp, namingContext, mappingContext);
-
- interfaceChangeNotificationProducer.start(collector);
-
- final SwInterfaceSetFlagsNotification swInterfaceSetFlagsNotification = new SwInterfaceSetFlagsNotification();
- swInterfaceSetFlagsNotification.deleted = 0;
- swInterfaceSetFlagsNotification.swIfIndex = IFACE_ID;
- swInterfaceSetFlagsNotification.adminUpDown = 1;
- swInterfaceSetFlagsNotification.linkUpDown = 1;
- callbackArgumentCaptor.getValue().onSwInterfaceSetFlagsNotification(swInterfaceSetFlagsNotification);
- final ArgumentCaptor<InterfaceStateChange> notificationCaptor =
- ArgumentCaptor.forClass(InterfaceStateChange.class);
- verify(collector).onNotification(notificationCaptor.capture());
-
- assertEquals(IFACE_NAME, notificationCaptor.getValue().getName().getString());
- assertEquals(InterfaceStatus.Up, notificationCaptor.getValue().getAdminStatus());
- assertEquals(InterfaceStatus.Up, notificationCaptor.getValue().getOperStatus());
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java
deleted file mode 100644
index 95000c029..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * 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.translate.v3po.vpp;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.VppInvocationException;
-import io.fd.vpp.jvpp.core.dto.BdIpMacAddDel;
-import io.fd.vpp.jvpp.core.dto.BdIpMacAddDelReply;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-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.yang.types.rev130715.PhysAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domain.attributes.ArpTerminationTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domain.attributes.arp.termination.table.ArpTerminationTableEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domain.attributes.arp.termination.table.ArpTerminationTableEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domain.attributes.arp.termination.table.ArpTerminationTableEntryKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.BridgeDomains;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomainKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest {
- private static final String BD_CTX_NAME = "bd-test-instance";
- private static final String IFC_CTX_NAME = "ifc-test-instance";
-
- private static final String BD_NAME = "testBD0";
- private static final int BD_ID = 111;
- private static final String IFACE_NAME = "eth0";
- private static final int IFACE_ID = 123;
- private ArpTerminationTableEntryCustomizer customizer;
- private byte[] ipAddressRaw;
- private byte[] physAddressRaw;
- private PhysAddress physAddress;
- private IpAddress ipAddress;
- private ArpTerminationTableEntry entry;
- private InstanceIdentifier<ArpTerminationTableEntry> id;
-
- @Override
- public void setUp() throws Exception {
- customizer = new ArpTerminationTableEntryCustomizer(api, new NamingContext("generatedBdName", BD_CTX_NAME));
-
- ipAddressRaw = new byte[]{1, 2, 3, 4};
- physAddressRaw = new byte[]{1, 2, 3, 4, 5, 6};
- physAddress = new PhysAddress("01:02:03:04:05:06");
-
- ipAddress = new IpAddress(Ipv4AddressNoZone.getDefaultInstance("1.2.3.4"));
- entry = generateArpEntry(ipAddress, physAddress);
- id = getArpEntryId(ipAddress, physAddress);
-
- defineMapping(mappingContext, BD_NAME, BD_ID, BD_CTX_NAME);
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
- }
-
- private static InstanceIdentifier<ArpTerminationTableEntry> getArpEntryId(final IpAddress ipAddress,
- final PhysAddress physAddress) {
- return InstanceIdentifier.create(BridgeDomains.class).child(BridgeDomain.class, new BridgeDomainKey(BD_NAME))
- .child(ArpTerminationTable.class)
- .child(ArpTerminationTableEntry.class, new ArpTerminationTableEntryKey(ipAddress, physAddress));
- }
-
- private void whenBdIpMacAddDelThenSuccess() {
- doReturn(future(new BdIpMacAddDelReply())).when(api).bdIpMacAddDel(any(BdIpMacAddDel.class));
- }
-
- private void whenBdIpMacAddDelThenFailure() {
- doReturn(failedFuture()).when(api).bdIpMacAddDel(any(BdIpMacAddDel.class));
- }
-
- private BdIpMacAddDel generateBdIpMacAddDelRequest(final byte[] ipAddress, final byte[] macAddress,
- final byte isAdd) {
- final BdIpMacAddDel request = new BdIpMacAddDel();
- request.ipAddress = ipAddress;
- request.macAddress = macAddress;
- request.bdId = BD_ID;
- request.isAdd = isAdd;
- return request;
- }
-
- private ArpTerminationTableEntry generateArpEntry(final IpAddress ipAddress, final PhysAddress physAddress) {
- final ArpTerminationTableEntryBuilder entry = new ArpTerminationTableEntryBuilder();
- entry.setKey(new ArpTerminationTableEntryKey(ipAddress, physAddress));
- entry.setPhysAddress(physAddress);
- entry.setIpAddress(ipAddress);
- return entry.build();
- }
-
- private void verifyBdIpMacAddDelWasInvoked(final BdIpMacAddDel expected) throws
- VppInvocationException {
- ArgumentCaptor<BdIpMacAddDel> argumentCaptor = ArgumentCaptor.forClass(BdIpMacAddDel.class);
- verify(api).bdIpMacAddDel(argumentCaptor.capture());
- final BdIpMacAddDel actual = argumentCaptor.getValue();
- assertArrayEquals(expected.macAddress, actual.macAddress);
- assertArrayEquals(expected.ipAddress, actual.ipAddress);
- assertEquals(expected.bdId, actual.bdId);
- assertEquals(expected.isAdd, actual.isAdd);
- }
-
- @Test
- public void testCreate() throws Exception {
- whenBdIpMacAddDelThenSuccess();
- customizer.writeCurrentAttributes(id, entry, writeContext);
- verifyBdIpMacAddDelWasInvoked(generateBdIpMacAddDelRequest(ipAddressRaw, physAddressRaw, (byte) 1));
- }
-
- @Test
- public void testCreateFailed() throws Exception {
- whenBdIpMacAddDelThenFailure();
- try {
- customizer.writeCurrentAttributes(id, entry, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verifyBdIpMacAddDelWasInvoked(generateBdIpMacAddDelRequest(ipAddressRaw, physAddressRaw, (byte) 1));
- return;
- }
- fail("WriteFailedException.CreateFailedException was expected");
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdate() throws Exception {
- customizer.updateCurrentAttributes(InstanceIdentifier.create(ArpTerminationTableEntry.class),
- mock(ArpTerminationTableEntry.class),
- mock(ArpTerminationTableEntry.class), writeContext);
- }
-
- @Test
- public void testDelete() throws Exception {
- whenBdIpMacAddDelThenSuccess();
- customizer.deleteCurrentAttributes(id, entry, writeContext);
- verifyBdIpMacAddDelWasInvoked(generateBdIpMacAddDelRequest(ipAddressRaw, physAddressRaw, (byte) 0));
- }
-
- @Test
- public void testDeleteFailed() throws Exception {
- whenBdIpMacAddDelThenFailure();
- try {
- customizer.deleteCurrentAttributes(id, entry, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verifyBdIpMacAddDelWasInvoked(generateBdIpMacAddDelRequest(ipAddressRaw, physAddressRaw, (byte) 0));
- return;
- }
- fail("WriteFailedException.DeleteFailedException was expected");
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java
deleted file mode 100644
index 9143080fe..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * 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.translate.v3po.vpp;
-
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.VppInvocationException;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDel;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDelReply;
-import javax.annotation.Nullable;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.BridgeDomains;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomainBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomainKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-
-public class BridgeDomainCustomizerTest extends WriterCustomizerTest implements ByteDataTranslator {
-
- private static final String BD_CTX_NAME = "bd-test-instance";
- private static final byte ADD_OR_UPDATE_BD = (byte) 1;
- private BridgeDomainCustomizer customizer;
-
- @Override
- public void setUp() throws Exception {
- customizer = new BridgeDomainCustomizer(api, new NamingContext("generatedBDName", BD_CTX_NAME));
- }
-
- @Nullable
- private static Boolean intToBoolean(final int value) {
- if (value == 0) {
- return Boolean.FALSE;
- }
- if (value == 1) {
- return Boolean.TRUE;
- }
- return null;
- }
-
- private static KeyedInstanceIdentifier<BridgeDomain, BridgeDomainKey> bdIdentifierForName(
- final String bdName) {
- return InstanceIdentifier.create(BridgeDomains.class).child(BridgeDomain.class, new BridgeDomainKey(bdName));
- }
-
- private BridgeDomain generateBridgeDomain(final String bdName) {
- final byte arpTerm = 0;
- final byte flood = 1;
- final byte forward = 0;
- final byte learn = 1;
- final byte uuf = 0;
- return generateBridgeDomain(bdName, arpTerm, flood, forward, learn, uuf);
- }
-
- private BridgeDomain generateBridgeDomain(final String bdName, final int arpTerm, final int flood,
- final int forward, final int learn, final int uuf) {
- return new BridgeDomainBuilder()
- .setName(bdName)
- .setArpTermination(intToBoolean(arpTerm))
- .setFlood(intToBoolean(flood))
- .setForward(intToBoolean(forward))
- .setLearn(intToBoolean(learn))
- .setUnknownUnicastFlood(intToBoolean(uuf))
- .build();
- }
-
- private void verifyBridgeDomainAddOrUpdateWasInvoked(final BridgeDomain bd, final int bdId)
- throws VppInvocationException {
- final BridgeDomainAddDel expected = new BridgeDomainAddDel();
- expected.arpTerm = booleanToByte(bd.isArpTermination());
- expected.flood = booleanToByte(bd.isFlood());
- expected.forward = booleanToByte(bd.isForward());
- expected.learn = booleanToByte(bd.isLearn());
- expected.uuFlood = booleanToByte(bd.isUnknownUnicastFlood());
- expected.isAdd = ADD_OR_UPDATE_BD;
- expected.bdId = bdId;
- verify(api).bridgeDomainAddDel(expected);
- }
-
- private void verifyBridgeDomainDeleteWasInvoked(final int bdId) throws VppInvocationException {
- final BridgeDomainAddDel expected = new BridgeDomainAddDel();
- expected.bdId = bdId;
- verify(api).bridgeDomainAddDel(expected);
- }
-
- private void whenBridgeDomainAddDelThenSuccess() {
- when(api.bridgeDomainAddDel(any(BridgeDomainAddDel.class))).thenReturn(future(new BridgeDomainAddDelReply()));
- }
-
- private void whenBridgeDomainAddDelThenFailure() {
- doReturn(failedFuture()).when(api).bridgeDomainAddDel(any(BridgeDomainAddDel.class));
- }
-
- @Test
- public void testAddBridgeDomain() throws Exception {
- final int bdId = 1;
- final String bdName = "bd1";
- final BridgeDomain bd = generateBridgeDomain(bdName);
- noMappingDefined(mappingContext, bdName, BD_CTX_NAME);
-
- whenBridgeDomainAddDelThenSuccess();
-
- customizer.writeCurrentAttributes(bdIdentifierForName(bdName), bd, writeContext);
-
- verifyBridgeDomainAddOrUpdateWasInvoked(bd, bdId);
- verify(mappingContext).put(mappingIid(bdName, BD_CTX_NAME), mapping(bdName, bdId).get());
- }
-
- @Test
- public void testAddBridgeDomainPresentInBdContext() throws Exception {
- final int bdId = 1;
- final String bdName = "bd1";
- final BridgeDomain bd = generateBridgeDomain(bdName);
- defineMapping(mappingContext, bdName, bdId, BD_CTX_NAME);
-
- whenBridgeDomainAddDelThenSuccess();
-
- customizer.writeCurrentAttributes(bdIdentifierForName(bdName), bd, writeContext);
-
- verifyBridgeDomainAddOrUpdateWasInvoked(bd, bdId);
- verify(mappingContext).put(mappingIid(bdName, BD_CTX_NAME), mapping(bdName, bdId).get());
- }
-
- @Test
- public void testAddBridgeDomainFailed() throws Exception {
- final int bdId = 1;
- final String bdName = "bd1";
- final BridgeDomain bd = generateBridgeDomain(bdName);
- noMappingDefined(mappingContext, bdName, BD_CTX_NAME);
-
- whenBridgeDomainAddDelThenFailure();
-
- try {
- customizer.writeCurrentAttributes(bdIdentifierForName(bdName), bd, writeContext);
- } catch (WriteFailedException e) {
- verifyBridgeDomainAddOrUpdateWasInvoked(bd, bdId);
- return;
- }
- fail("WriteFailedException.CreateFailedException was expected");
- }
-
- @Test
- public void testDeleteBridgeDomain() throws Exception {
- final int bdId = 1;
- final String bdName = "bd1";
- final BridgeDomain bd = generateBridgeDomain(bdName);
- defineMapping(mappingContext, bdName, bdId, BD_CTX_NAME);
-
- whenBridgeDomainAddDelThenSuccess();
-
- customizer.deleteCurrentAttributes(bdIdentifierForName(bdName), bd, writeContext);
-
- verifyBridgeDomainDeleteWasInvoked(bdId);
- }
-
- @Test
- public void testDeleteUnknownBridgeDomain() throws Exception {
- final String bdName = "bd1";
- final BridgeDomain bd = generateBridgeDomain("bd1");
- noMappingDefined(mappingContext, bdName, BD_CTX_NAME);
-
- try {
- customizer.deleteCurrentAttributes(bdIdentifierForName(bdName), bd, writeContext);
- } catch (IllegalArgumentException e) {
- verify(api, never()).bridgeDomainAddDel(any(BridgeDomainAddDel.class));
- return;
- }
- fail("IllegalArgumentException was expected");
- }
-
- @Test
- public void testDeleteBridgeDomainFailed() throws Exception {
- final int bdId = 1;
- final String bdName = "bd1";
- final BridgeDomain bd = generateBridgeDomain(bdName);
- defineMapping(mappingContext, bdName, bdId, BD_CTX_NAME);
-
- whenBridgeDomainAddDelThenFailure();
-
- try {
- customizer.deleteCurrentAttributes(bdIdentifierForName(bdName), bd, writeContext);
- } catch (WriteFailedException e) {
- verifyBridgeDomainDeleteWasInvoked(bdId);
- return;
- }
-
- fail("WriteFailedException.DeleteFailedException was expected");
- }
-
- @Test
- public void testUpdateBridgeDomain() throws Exception {
- final int bdId = 1;
- final String bdName = "bd1";
- defineMapping(mappingContext, bdName, bdId, BD_CTX_NAME);
-
- final byte arpTermBefore = 1;
- final byte floodBefore = 1;
- final byte forwardBefore = 0;
- final byte learnBefore = 1;
- final byte uufBefore = 0;
-
- final BridgeDomain dataBefore =
- generateBridgeDomain(bdName, arpTermBefore, floodBefore, forwardBefore, learnBefore, uufBefore);
- final BridgeDomain dataAfter =
- generateBridgeDomain(bdName, arpTermBefore ^ 1, floodBefore ^ 1, forwardBefore ^ 1, learnBefore ^ 1,
- uufBefore ^ 1);
-
- whenBridgeDomainAddDelThenSuccess();
-
- customizer
- .updateCurrentAttributes(bdIdentifierForName(bdName), dataBefore, dataAfter,
- writeContext);
- verifyBridgeDomainAddOrUpdateWasInvoked(dataAfter, bdId);
- }
-
- @Test
- public void testUpdateUnknownBridgeDomain() throws Exception {
- final String bdName = "bd1";
- final BridgeDomain bdBefore = generateBridgeDomain(bdName, 0, 1, 0, 1, 0);
- final BridgeDomain bdAfter = generateBridgeDomain(bdName, 1, 1, 0, 1, 0);
- noMappingDefined(mappingContext, bdName, BD_CTX_NAME);
-
- try {
- customizer
- .updateCurrentAttributes(bdIdentifierForName(bdName), bdBefore, bdAfter,
- writeContext);
- } catch (IllegalArgumentException e) {
- verify(api, never()).bridgeDomainAddDel(any(BridgeDomainAddDel.class));
- return;
- }
- fail("IllegalArgumentException was expected");
- }
-
- @Test
- public void testUpdateBridgeDomainFailed() throws Exception {
- final int bdId = 1;
- final String bdName = "bd1";
- final BridgeDomain bdBefore = generateBridgeDomain(bdName, 0, 1, 0, 1, 0);
- final BridgeDomain bdAfter = generateBridgeDomain(bdName, 1, 1, 0, 1, 0);
- defineMapping(mappingContext, bdName, bdId, BD_CTX_NAME);
-
- whenBridgeDomainAddDelThenFailure();
-
- try {
- customizer.updateCurrentAttributes(bdIdentifierForName(bdName), bdBefore, bdAfter, writeContext);
- } catch (WriteFailedException e) {
- verifyBridgeDomainAddOrUpdateWasInvoked(bdAfter, bdId);
- return;
- }
- fail("IllegalStateException was expected");
- }
-
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizerTest.java
deleted file mode 100644
index 88e75a7ac..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizerTest.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * 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.translate.v3po.vpp;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.VppInvocationException;
-import io.fd.vpp.jvpp.core.dto.L2FibAddDel;
-import io.fd.vpp.jvpp.core.dto.L2FibAddDelReply;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.L2FibFilter;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.L2FibTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntryKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.BridgeDomains;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomainKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class L2FibEntryCustomizerTest extends WriterCustomizerTest {
- private static final String BD_CTX_NAME = "bd-test-instance";
- private static final String IFC_CTX_NAME = "ifc-test-instance";
-
- private static final String BD_NAME = "testBD0";
- private static final int BD_ID = 111;
- private static final String IFACE_NAME = "eth0";
- private static final int IFACE_ID = 123;
-
- private L2FibEntryCustomizer customizer;
-
- @Override
- public void setUp() throws Exception {
- defineMapping(mappingContext, BD_NAME, BD_ID, BD_CTX_NAME);
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
-
- customizer = new L2FibEntryCustomizer(
- api,
- new NamingContext("generatedBdName", BD_CTX_NAME),
- new NamingContext("generatedIfaceName", IFC_CTX_NAME));
- }
-
- private static InstanceIdentifier<L2FibEntry> getL2FibEntryId(final PhysAddress address) {
- return InstanceIdentifier.create(BridgeDomains.class).child(BridgeDomain.class, new BridgeDomainKey(BD_NAME))
- .child(L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(address));
- }
-
- private void whenL2FibAddDelThenSuccess() {
- doReturn(future(new L2FibAddDelReply())).when(api).l2FibAddDel(any(L2FibAddDel.class));
- }
-
- private void whenL2FibAddDelThenFailure() {
- doReturn(failedFuture()).when(api).l2FibAddDel(any(L2FibAddDel.class));
- }
-
- private L2FibAddDel generateL2FibAddDelRequest(final long mac, final byte isAdd) {
- final L2FibAddDel request = new L2FibAddDel();
- request.mac = mac;
- request.bdId = BD_ID;
- request.swIfIndex = IFACE_ID;
- request.isAdd = isAdd;
- if (isAdd == 1) {
- request.staticMac = 1;
- request.filterMac = 1;
- }
- return request;
- }
-
- private L2FibEntry generateL2FibEntry(final PhysAddress address) {
- final L2FibEntryBuilder entry = new L2FibEntryBuilder();
- entry.setKey(new L2FibEntryKey(address));
- entry.setPhysAddress(address);
- entry.setStaticConfig(true);
- entry.setBridgedVirtualInterface(false);
- entry.setAction(L2FibFilter.class);
- entry.setOutgoingInterface(IFACE_NAME);
- return entry.build();
- }
-
- private void verifyL2FibAddDelWasInvoked(final L2FibAddDel expected) throws
- VppInvocationException {
- ArgumentCaptor<L2FibAddDel> argumentCaptor = ArgumentCaptor.forClass(L2FibAddDel.class);
- verify(api).l2FibAddDel(argumentCaptor.capture());
- final L2FibAddDel actual = argumentCaptor.getValue();
- assertEquals(expected.mac, actual.mac);
- assertEquals(expected.bdId, actual.bdId);
- assertEquals(expected.swIfIndex, actual.swIfIndex);
- assertEquals(expected.isAdd, actual.isAdd);
- assertEquals(expected.staticMac, actual.staticMac);
- assertEquals(expected.filterMac, actual.filterMac);
- }
-
- @Test
- public void testCreate() throws Exception {
- final long address_vpp = 0x0102030405060000L;
- final PhysAddress address = new PhysAddress("01:02:03:04:05:06");
- final L2FibEntry entry = generateL2FibEntry(address);
- final InstanceIdentifier<L2FibEntry> id = getL2FibEntryId(address);
-
- whenL2FibAddDelThenSuccess();
-
- customizer.writeCurrentAttributes(id, entry, writeContext);
-
- verifyL2FibAddDelWasInvoked(generateL2FibAddDelRequest(address_vpp, (byte) 1));
- }
-
- @Test
- public void testCreateFailed() throws Exception {
- final long address_vpp = 0x1122334455660000L;
- final PhysAddress address = new PhysAddress("11:22:33:44:55:66");
- final L2FibEntry entry = generateL2FibEntry(address);
- final InstanceIdentifier<L2FibEntry> id = getL2FibEntryId(address);
-
- whenL2FibAddDelThenFailure();
-
- try {
- customizer.writeCurrentAttributes(id, entry, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verifyL2FibAddDelWasInvoked(generateL2FibAddDelRequest(address_vpp, (byte) 1));
- return;
- }
- fail("WriteFailedException.CreateFailedException was expected");
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdate() throws Exception {
- customizer.updateCurrentAttributes(InstanceIdentifier.create(L2FibEntry.class), mock(L2FibEntry.class),
- mock(L2FibEntry.class), writeContext);
- }
-
- @Test
- public void testDelete() throws Exception {
- final long address_vpp = 0x1122334455660000L;
- final PhysAddress address = new PhysAddress("11:22:33:44:55:66");
- final L2FibEntry entry = generateL2FibEntry(address);
- final InstanceIdentifier<L2FibEntry> id = getL2FibEntryId(address);
-
- whenL2FibAddDelThenSuccess();
-
- customizer.deleteCurrentAttributes(id, entry, writeContext);
-
- verifyL2FibAddDelWasInvoked(generateL2FibAddDelRequest(address_vpp, (byte) 0));
- }
-
- @Test
- public void testDeleteFailed() throws Exception {
- final long address_vpp = 0x0102030405060000L;
- final PhysAddress address = new PhysAddress("01:02:03:04:05:06");
- final L2FibEntry entry = generateL2FibEntry(address);
- final InstanceIdentifier<L2FibEntry> id = getL2FibEntryId(address);
-
- whenL2FibAddDelThenFailure();
-
- try {
- customizer.deleteCurrentAttributes(id, entry, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verifyL2FibAddDelWasInvoked(generateL2FibAddDelRequest(address_vpp, (byte) 0));
- return;
- }
- fail("WriteFailedException.DeleteFailedException was expected");
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionReaderTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionReaderTest.java
deleted file mode 100644
index 3b93389e4..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionReaderTest.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.translate.v3po.vppclassifier;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.ModificationCache;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.HexString;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppClassifierState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.classify.table.base.attributes.ClassifySession;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.classify.table.base.attributes.ClassifySessionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.classify.table.base.attributes.ClassifySessionKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.state.ClassifyTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.state.ClassifyTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.state.ClassifyTableKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.ClassifySessionDetails;
-import io.fd.vpp.jvpp.core.dto.ClassifySessionDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.ClassifySessionDump;
-
-public class ClassifySessionReaderTest extends
- ListReaderCustomizerTest<ClassifySession, ClassifySessionKey, ClassifySessionBuilder> {
-
- private static final String MATCH_1 = "00:00:00:00:00:00:01:02:03:04:05:06:00:00:00:00";
- private static final String MATCH_2 = "00:00:00:00:00:00:01:02:03:04:05:07:00:00:00:00";
-
- private static final int TABLE_INDEX = 1;
- private static final String TABLE_NAME = "table1";
-
- @Mock
- private VppClassifierContextManager classifierContext;
-
- public ClassifySessionReaderTest() {
- super(ClassifySession.class, ClassifyTableBuilder.class);
- }
-
- @Override
- protected ReaderCustomizer<ClassifySession, ClassifySessionBuilder> initCustomizer() {
- return new ClassifySessionReader(api, classifierContext);
- }
-
- private static InstanceIdentifier<ClassifySession> getClassifySessionId(final String tableName,
- final String match) {
- return InstanceIdentifier.create(VppClassifierState.class)
- .child(ClassifyTable.class, new ClassifyTableKey(tableName))
- .child(ClassifySession.class, new ClassifySessionKey(new HexString(match)));
- }
-
- @Test
- public void testReadWithCache() throws ReadFailedException {
- final InstanceIdentifier<ClassifySession> id = getClassifySessionId(TABLE_NAME, MATCH_1);
- final ClassifySessionBuilder builder = mock(ClassifySessionBuilder.class);
- final ModificationCache cache = new ModificationCache();
- final ClassifySessionDetailsReplyDump dump = new ClassifySessionDetailsReplyDump();
- final ClassifySessionDetails details = new ClassifySessionDetails();
- details.match =
- new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
- (byte) 0x05, (byte) 0x06, 0x00, 0x00, 0x00, 0x00};
- dump.classifySessionDetails = Collections.singletonList(details);
- cache.put(ClassifySessionReader.CACHE_KEY + id.firstKeyOf(ClassifyTable.class), dump);
- when(ctx.getModificationCache()).thenReturn(cache);
-
- getCustomizer().readCurrentAttributes(id, builder, ctx);
- }
-
- @Test
- public void testGetAllIds() throws ReadFailedException {
- final InstanceIdentifier<ClassifySession> id = getClassifySessionId(TABLE_NAME, MATCH_1);
- final ClassifySessionDetailsReplyDump dump = new ClassifySessionDetailsReplyDump();
- final ClassifySessionDetails details1 = new ClassifySessionDetails();
- details1.match =
- new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
- (byte) 0x05, (byte) 0x06, 0x00, 0x00, 0x00, 0x00};
- final ClassifySessionDetails details2 = new ClassifySessionDetails();
- details2.match =
- new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
- (byte) 0x05, (byte) 0x07, 0x00, 0x00, 0x00, 0x00};
- dump.classifySessionDetails = Arrays.asList(details1, details2);
- doReturn(future(dump)).when(api).classifySessionDump(any(ClassifySessionDump.class));
-
- when(classifierContext.containsTable(TABLE_NAME, mappingContext)).thenReturn(true);
- when(classifierContext.getTableIndex(TABLE_NAME, mappingContext)).thenReturn(TABLE_INDEX);
-
- final List<ClassifySessionKey> allIds = getCustomizer().getAllIds(id, ctx);
- assertEquals(2, allIds.size());
- assertEquals(MATCH_1, allIds.get(0).getMatch().getValue());
- assertEquals(MATCH_2, allIds.get(1).getMatch().getValue());
- }
-
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriterTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriterTest.java
deleted file mode 100644
index 5aeab587c..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriterTest.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * 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.translate.v3po.vppclassifier;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSessionReply;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.HexString;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.OpaqueIndex;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.PacketHandlingAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppClassifier;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppNodeName;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.classify.table.base.attributes.ClassifySession;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.classify.table.base.attributes.ClassifySessionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.classify.table.base.attributes.ClassifySessionKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.ClassifyTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.ClassifyTableKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class ClassifySessionWriterTest extends WriterCustomizerTest {
-
- private static final int TABLE_INDEX = 123;
- private static final String TABLE_NAME = "table123";
-
- @Mock
- private VppClassifierContextManager classfierContext;
-
- private ClassifySessionWriter customizer;
- private static final int SESSION_INDEX = 456;
-
- @Override
- public void setUp() throws Exception {
- customizer = new ClassifySessionWriter(api, classfierContext);
-
- when(classfierContext.containsTable(TABLE_NAME, mappingContext)).thenReturn(true);
- when(classfierContext.getTableIndex(TABLE_NAME, mappingContext)).thenReturn(TABLE_INDEX);
-
- final ClassifyTable table = mock(ClassifyTable.class);
- when(table.getClassifierNode()).thenReturn(new VppNodeName("ip4-classifier"));
- when(writeContext.readAfter(any())).thenReturn(Optional.of(table));
- when(writeContext.readBefore(any())).thenReturn(Optional.of(table));
- }
-
- private static ClassifySession generateClassifySession(final long opaqueIndex, final String match) {
- final ClassifySessionBuilder builder = new ClassifySessionBuilder();
- builder.setOpaqueIndex(new OpaqueIndex(opaqueIndex));
- builder.setHitNext(new VppNode(PacketHandlingAction.Deny));
- builder.setAdvance(123);
- builder.setMatch(new HexString(match));
- return builder.build();
- }
-
- private static InstanceIdentifier<ClassifySession> getClassifySessionId(final String tableName,
- final String match) {
- return InstanceIdentifier.create(VppClassifier.class)
- .child(ClassifyTable.class, new ClassifyTableKey(tableName))
- .child(ClassifySession.class, new ClassifySessionKey(new HexString(match)));
- }
-
- private void whenClassifyAddDelSessionThenSuccess() {
- doReturn(future(new ClassifyAddDelSessionReply())).when(api)
- .classifyAddDelSession(any(ClassifyAddDelSession.class));
- }
-
- private void whenClassifyAddDelSessionThenFailure() {
- doReturn(failedFuture()).when(api).classifyAddDelSession(any(ClassifyAddDelSession.class));
- }
-
- private static ClassifyAddDelSession generateClassifyAddDelSession(final byte isAdd, final int tableIndex,
- final int sessionIndex) {
- final ClassifyAddDelSession request = new ClassifyAddDelSession();
- request.isAdd = isAdd;
- request.tableIndex = tableIndex;
- request.opaqueIndex = sessionIndex;
- request.hitNextIndex = 0;
- request.advance = 123;
- request.match =
- new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
- (byte) 0x05, (byte) 0x06, 0x00, 0x00, 0x00, 0x00};
- return request;
- }
-
- @Test
- public void testCreate() throws Exception {
- final String match = "00:00:00:00:00:00:01:02:03:04:05:06:00:00:00:00";
- final ClassifySession classifySession = generateClassifySession(SESSION_INDEX, match);
- final InstanceIdentifier<ClassifySession> id = getClassifySessionId(TABLE_NAME, match);
-
- whenClassifyAddDelSessionThenSuccess();
-
- customizer.writeCurrentAttributes(id, classifySession, writeContext);
-
- verify(api).classifyAddDelSession(generateClassifyAddDelSession((byte) 1, TABLE_INDEX, SESSION_INDEX));
- }
-
- @Test
- public void testCreateFailed() throws Exception {
- final String match = "00:00:00:00:00:00:01:02:03:04:05:06:00:00:00:00";
- final ClassifySession classifySession = generateClassifySession(SESSION_INDEX, match);
- final InstanceIdentifier<ClassifySession> id = getClassifySessionId(TABLE_NAME, match);
-
- whenClassifyAddDelSessionThenFailure();
-
- try {
- customizer.writeCurrentAttributes(id, classifySession, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).classifyAddDelSession(generateClassifyAddDelSession((byte) 1, TABLE_INDEX, SESSION_INDEX));
- return;
- }
- fail("WriteFailedException.CreateFailedException was expected");
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdate() throws Exception {
- customizer.updateCurrentAttributes(null, null, null, writeContext);
- }
-
- @Test
- public void testDelete() throws Exception {
- final String match = "00:00:00:00:00:00:01:02:03:04:05:06:00:00:00:00";
- final ClassifySession classifySession = generateClassifySession(SESSION_INDEX, match);
- final InstanceIdentifier<ClassifySession> id = getClassifySessionId(TABLE_NAME, match);
-
- whenClassifyAddDelSessionThenSuccess();
-
- customizer.deleteCurrentAttributes(id, classifySession, writeContext);
-
- verify(api).classifyAddDelSession(generateClassifyAddDelSession((byte) 0, TABLE_INDEX, SESSION_INDEX));
- }
-
- @Test
- public void testDeleteFailed() throws Exception {
- final String match = "00:00:00:00:00:00:01:02:03:04:05:06:00:00:00:00";
- final ClassifySession classifySession = generateClassifySession(SESSION_INDEX, match);
- final InstanceIdentifier<ClassifySession> id = getClassifySessionId(TABLE_NAME, match);
-
- whenClassifyAddDelSessionThenFailure();
-
- try {
- customizer.deleteCurrentAttributes(id, classifySession, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).classifyAddDelSession(generateClassifyAddDelSession((byte) 0, TABLE_INDEX, SESSION_INDEX));
- return;
- }
- fail("WriteFailedException.DeleteFailedException was expected");
-
- customizer.deleteCurrentAttributes(id, classifySession, writeContext);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableReaderTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableReaderTest.java
deleted file mode 100644
index c6085cc92..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableReaderTest.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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.translate.v3po.vppclassifier;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
-import java.util.List;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.HexString;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.PacketHandlingAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppClassifierState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppClassifierStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.state.ClassifyTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.state.ClassifyTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.state.ClassifyTableKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableIds;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableIdsReply;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableInfo;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableInfoReply;
-
-public class ClassifyTableReaderTest extends
- ListReaderCustomizerTest<ClassifyTable, ClassifyTableKey, ClassifyTableBuilder> {
-
- private static final int TABLE_INDEX_1 = 1;
- private static final String TABLE_NAME_1 = "table1";
- private static final int TABLE_INDEX_2 = 2;
- private static final String TABLE_NAME_2 = "table2";
-
- @Mock
- private VppClassifierContextManager classifierContext;
-
- public ClassifyTableReaderTest() {
- super(ClassifyTable.class, VppClassifierStateBuilder.class);
- }
-
- @Override
- protected ReaderCustomizer<ClassifyTable, ClassifyTableBuilder> initCustomizer() {
- return new ClassifyTableReader(api, classifierContext);
- }
-
- private static InstanceIdentifier<ClassifyTable> getClassifyTableId(final String name) {
- return InstanceIdentifier.create(VppClassifierState.class)
- .child(ClassifyTable.class, new ClassifyTableKey(name));
- }
-
- private static ClassifyTableInfoReply generateClassifyTableInfoReply() {
- final ClassifyTableInfoReply reply = new ClassifyTableInfoReply();
- reply.tableId = TABLE_INDEX_1;
- reply.nbuckets = 2;
- reply.skipNVectors = 0;
- reply.matchNVectors = 1;
- reply.nextTableIndex = ~0;
- reply.missNextIndex = ~0;
- reply.mask =
- new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
- (byte) 0x05, (byte) 0x06, 0x00, 0x00, 0x00, 0x00};
- return reply;
- }
-
- private void verifyClasifyTableRead(final ClassifyTableBuilder builder) {
- verify(builder).setName(TABLE_NAME_1);
- verify(builder).setNbuckets(2L);
- verify(builder, times(0)).setNextTable(anyString());
- verify(builder).setMissNext(new VppNode(PacketHandlingAction.Permit));
- verify(builder).setMask(new HexString("00:00:00:00:00:00:01:02:03:04:05:06:00:00:00:00"));
- verify(builder).setActiveSessions(0L);
- }
-
- @Test
- public void testRead() throws ReadFailedException {
- doReturn(future(generateClassifyTableInfoReply())).when(api).classifyTableInfo(any(ClassifyTableInfo.class));
-
- when(classifierContext.containsTable(TABLE_NAME_1, mappingContext)).thenReturn(true);
- when(classifierContext.getTableIndex(TABLE_NAME_1, mappingContext)).thenReturn(TABLE_INDEX_1);
- when(classifierContext.getTableBaseNode(TABLE_NAME_1, mappingContext)).thenReturn(Optional.absent());
-
- final ClassifyTableBuilder builder = mock(ClassifyTableBuilder.class);
- getCustomizer().readCurrentAttributes(getClassifyTableId(TABLE_NAME_1), builder, ctx);
-
- verifyClasifyTableRead(builder);
- }
-
- @Test
- public void testGetAllIds() throws ReadFailedException {
- final ClassifyTableIdsReply reply = new ClassifyTableIdsReply();
- reply.ids = new int[] {1, 2};
- doReturn(future(reply)).when(api).classifyTableIds(any(ClassifyTableIds.class));
-
- when(classifierContext.getTableName(TABLE_INDEX_1, mappingContext)).thenReturn(TABLE_NAME_1);
- when(classifierContext.getTableName(TABLE_INDEX_2, mappingContext)).thenReturn(TABLE_NAME_2);
-
- final List<ClassifyTableKey> allIds = getCustomizer().getAllIds(getClassifyTableId(TABLE_NAME_1), ctx);
-
- assertEquals(reply.ids.length, allIds.size());
- assertEquals(TABLE_NAME_1, allIds.get(0).getName());
- assertEquals(TABLE_NAME_2, allIds.get(1).getName());
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriterTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriterTest.java
deleted file mode 100644
index 0869986ee..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriterTest.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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.translate.v3po.vppclassifier;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTableReply;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.HexString;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.PacketHandlingAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppClassifier;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppNodeName;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.ClassifyTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.ClassifyTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.vpp.classifier.ClassifyTableKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class ClassifyTableWriterTest extends WriterCustomizerTest {
-
- private static final int TABLE_INDEX = 123;
- private static final String TABLE_NAME = "table123";
-
- @Mock
- private VppClassifierContextManager classifierContext;
-
- private ClassifyTableWriter customizer;
-
- @Override
- public void setUp() throws Exception {
- customizer = new ClassifyTableWriter(api, classifierContext);
- }
-
- private static ClassifyTable generateClassifyTable(final String name) {
- final ClassifyTableBuilder builder = new ClassifyTableBuilder();
- builder.setName(name);
- builder.setClassifierNode(new VppNodeName("ip4-classifier"));
- builder.setKey(new ClassifyTableKey(name));
- builder.setSkipNVectors(0L);
- builder.setNbuckets(2L);
- builder.setMemorySize(2L << 20);
- builder.setMissNext(new VppNode(PacketHandlingAction.Permit));
- builder.setMask(new HexString("00:00:00:00:00:00:01:02:03:04:05:06:00:00:00:00"));
- return builder.build();
- }
-
- private static InstanceIdentifier<ClassifyTable> getClassifyTableId(final String name) {
- return InstanceIdentifier.create(VppClassifier.class)
- .child(ClassifyTable.class, new ClassifyTableKey(name));
- }
-
- private void whenClassifyAddDelTableThenSuccess() {
- final ClassifyAddDelTableReply reply = new ClassifyAddDelTableReply();
- reply.newTableIndex = TABLE_INDEX;
- doReturn(future(reply)).when(api).classifyAddDelTable(any(ClassifyAddDelTable.class));
- }
-
- private void whenClassifyAddDelTableThenFailure() {
- doReturn(failedFuture()).when(api).classifyAddDelTable(any(ClassifyAddDelTable.class));
- }
-
- private static ClassifyAddDelTable generateClassifyAddDelTable(final byte isAdd) {
- return generateClassifyAddDelTable(isAdd, -1);
- }
-
- private static ClassifyAddDelTable generateClassifyAddDelTable(final byte isAdd, final int tableIndex) {
- final ClassifyAddDelTable request = new ClassifyAddDelTable();
- request.isAdd = isAdd;
- request.tableIndex = tableIndex;
- request.nbuckets = 2;
- request.memorySize = 2 << 20;
- request.skipNVectors = 0;
- request.matchNVectors = 1;
- request.nextTableIndex = ~0;
- request.missNextIndex = ~0;
- request.mask =
- new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
- (byte) 0x05, (byte) 0x06, 0x00, 0x00, 0x00, 0x00};
- return request;
- }
-
- @Test
- public void testCreate() throws Exception {
- final ClassifyTable classifyTable = generateClassifyTable(TABLE_NAME);
- final InstanceIdentifier<ClassifyTable> id = getClassifyTableId(TABLE_NAME);
-
- whenClassifyAddDelTableThenSuccess();
-
- customizer.writeCurrentAttributes(id, classifyTable, writeContext);
-
- verify(api).classifyAddDelTable(generateClassifyAddDelTable((byte) 1));
- verify(classifierContext)
- .addTable(TABLE_INDEX, classifyTable.getName(), classifyTable.getClassifierNode(), mappingContext);
- }
-
- @Test
- public void testCreateFailed() throws Exception {
- final ClassifyTable classifyTable = generateClassifyTable(TABLE_NAME);
- final InstanceIdentifier<ClassifyTable> id = getClassifyTableId(TABLE_NAME);
-
- whenClassifyAddDelTableThenFailure();
-
- try {
- customizer.writeCurrentAttributes(id, classifyTable, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).classifyAddDelTable(generateClassifyAddDelTable((byte) 1));
- verify(classifierContext, times(0))
- .addTable(TABLE_INDEX, classifyTable.getName(), classifyTable.getClassifierNode(), mappingContext);
- return;
- }
- fail("WriteFailedException.CreateFailedException was expected");
- }
-
- @Test
- public void testDelete() throws Exception {
- final ClassifyTable classifyTable = generateClassifyTable(TABLE_NAME);
- final InstanceIdentifier<ClassifyTable> id = getClassifyTableId(TABLE_NAME);
-
- when(classifierContext.containsTable(TABLE_NAME, mappingContext)).thenReturn(true);
- when(classifierContext.getTableIndex(TABLE_NAME, mappingContext)).thenReturn(TABLE_INDEX);
- whenClassifyAddDelTableThenSuccess();
-
- customizer.deleteCurrentAttributes(id, classifyTable, writeContext);
-
- verify(api).classifyAddDelTable(generateClassifyAddDelTable((byte) 0, TABLE_INDEX));
- }
-
- @Test
- public void testDeleteFailed() throws Exception {
- final ClassifyTable classifyTable = generateClassifyTable(TABLE_NAME);
- final InstanceIdentifier<ClassifyTable> id = getClassifyTableId(TABLE_NAME);
-
- when(classifierContext.containsTable(TABLE_NAME, mappingContext)).thenReturn(true);
- when(classifierContext.getTableIndex(TABLE_NAME, mappingContext)).thenReturn(TABLE_INDEX);
- whenClassifyAddDelTableThenFailure();
-
- try {
- customizer.deleteCurrentAttributes(id, classifyTable, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).classifyAddDelTable(generateClassifyAddDelTable((byte) 0, TABLE_INDEX));
- return;
- }
- fail("WriteFailedException.DeleteFailedException was expected");
-
- customizer.deleteCurrentAttributes(id, classifyTable, writeContext);
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdate() throws Exception {
- final ClassifyTable classifyTableBefore = generateClassifyTable(TABLE_NAME);
- final InstanceIdentifier<ClassifyTable> id = getClassifyTableId(TABLE_NAME);
- customizer.updateCurrentAttributes(id, classifyTableBefore, new ClassifyTableBuilder().build(), writeContext);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppClassifierContextManagerImplTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppClassifierContextManagerImplTest.java
deleted file mode 100644
index 667d06b6c..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppClassifierContextManagerImplTest.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * 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.translate.v3po.vppclassifier;
-
-import static io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManagerImpl.VPP_CLASSIFIER_CONTEXT_IID;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.MappingContext;
-import java.util.Arrays;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev161214.VppNodeName;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.VppClassifierContext;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.VppClassifierContextBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.ClassifyTableContext;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.ClassifyTableContextBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.ClassifyTableContextKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.classify.table.context.NodeContext;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.classify.table.context.NodeContextBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.classify.table.context.NodeContextKey;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-
-public class VppClassifierContextManagerImplTest {
-
- private static final int TABLE_ID_0 = 0;
- private static final String TABLE_NAME_0 = "table0";
- private static final KeyedInstanceIdentifier<ClassifyTableContext, ClassifyTableContextKey> TABLE_IID_0 =
- VPP_CLASSIFIER_CONTEXT_IID.child(ClassifyTableContext.class, new ClassifyTableContextKey(TABLE_NAME_0));
-
- private static final int TABLE_ID_1 = 1;
- private static final String TABLE_NAME_1 = "table1";
-
- private VppClassifierContextManagerImpl vppClassfierContext;
-
- @Mock
- private MappingContext ctx;
-
- @Before
- public void setUp() throws Exception {
- initMocks(this);
- vppClassfierContext = new VppClassifierContextManagerImpl("classify-table-");
- }
-
- @Test
- public void testAddTable() throws Exception {
- final String classfierNodeName = "node123";
- vppClassfierContext.addTable(TABLE_ID_0, TABLE_NAME_0, new VppNodeName(classfierNodeName), ctx);
- verify(ctx).put(TABLE_IID_0, table(TABLE_ID_0, TABLE_NAME_0, classfierNodeName));
- }
-
- @Test
- public void testContainsTable() throws Exception {
- when(ctx.read(TABLE_IID_0)).thenReturn(Optional.absent());
- assertFalse(vppClassfierContext.containsTable(TABLE_NAME_0, ctx));
- }
-
- @Test
- public void testGetTableIndex() throws Exception {
- when(ctx.read(TABLE_IID_0)).thenReturn(Optional.of(table(TABLE_ID_0, TABLE_NAME_0)));
- assertEquals(TABLE_ID_0, vppClassfierContext.getTableIndex(TABLE_NAME_0, ctx));
- }
-
- @Test
- public void testGetTableName() throws Exception {
- when(ctx.read(VPP_CLASSIFIER_CONTEXT_IID))
- .thenReturn(Optional.of(context(table(TABLE_ID_0, TABLE_NAME_0), table(TABLE_ID_1, TABLE_NAME_1))));
- assertEquals(TABLE_NAME_0, (vppClassfierContext.getTableName(TABLE_ID_0, ctx)));
- }
-
- @Test
- public void testGetTableBaseNode() throws Exception {
- final String classfierNodeName = "node123";
- when(ctx.read(TABLE_IID_0)).thenReturn(Optional.of(table(TABLE_ID_0, TABLE_NAME_0, classfierNodeName)));
- vppClassfierContext.getTableBaseNode(TABLE_NAME_0, ctx);
- assertEquals(Optional.of(classfierNodeName), (vppClassfierContext.getTableBaseNode(TABLE_NAME_0, ctx)));
- }
-
- @Test
- public void testRemoveTable() throws Exception {
- vppClassfierContext.removeTable(TABLE_NAME_0, ctx);
- verify(ctx).delete(TABLE_IID_0);
- }
-
- @Test
- public void testAddNodeName() throws Exception {
- final String nodeName = "node123";
- final int nodeIndex = 1;
-
- vppClassfierContext.addNodeName(TABLE_NAME_0, nodeIndex, nodeName, ctx);
- verify(ctx).put(
- TABLE_IID_0.child(NodeContext.class, new NodeContextKey(nodeName)),
- node(nodeName, nodeIndex)
- );
- }
-
- @Test
- public void testGetNonExistingNodeName() throws Exception {
- when(ctx.read(VPP_CLASSIFIER_CONTEXT_IID)).thenReturn(Optional.of(context(table(TABLE_ID_1, TABLE_NAME_1))));
- assertFalse(vppClassfierContext.getNodeName(TABLE_ID_0, 123, ctx).isPresent());
- }
-
- @Test
- public void testGetNodeNameMissingNodeCtx() throws Exception {
- final ClassifyTableContext tableCtx = table(TABLE_ID_0, TABLE_NAME_0, "aa");
- when(ctx.read(VPP_CLASSIFIER_CONTEXT_IID)).thenReturn(Optional.of(context(tableCtx)));
- when(ctx.read(TABLE_IID_0)).thenReturn(Optional.of(tableCtx));
- assertEquals(Optional.absent(), vppClassfierContext.getNodeName(TABLE_ID_0, 123, ctx));
- }
-
- @Test
- public void testGetNodeName() throws Exception {
- final ClassifyTableContext tableCtx = table(TABLE_ID_0, TABLE_NAME_0, "aa", node("node123", 123));
- when(ctx.read(VPP_CLASSIFIER_CONTEXT_IID)).thenReturn(Optional.of(context(tableCtx)));
- when(ctx.read(TABLE_IID_0)).thenReturn(Optional.of(tableCtx));
- assertEquals(Optional.of("node123"), vppClassfierContext.getNodeName(TABLE_ID_0, 123, ctx));
- }
-
- private VppClassifierContext context(ClassifyTableContext... tables) {
- VppClassifierContextBuilder context = new VppClassifierContextBuilder();
- context.setClassifyTableContext(Arrays.asList(tables));
- return context.build();
- }
-
- private static ClassifyTableContext table(final Integer id, final String name) {
- return table(id, name, null);
- }
-
- private static ClassifyTableContext table(final Integer id, final String name, final String classfierNodeName,
- final NodeContext... nodeContexts) {
- final ClassifyTableContextBuilder builder =
- new ClassifyTableContextBuilder().setIndex(id).setName(name).setClassifierNodeName(classfierNodeName);
-
- if (nodeContexts.length > 0) {
- builder.setNodeContext(Arrays.asList(nodeContexts));
- }
-
- return builder.build();
- }
-
- private NodeContext node(final String nodeName, final int nodeIndex) {
- return new NodeContextBuilder().setName(nodeName).setIndex(nodeIndex).build();
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/BridgeDomainCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/BridgeDomainCustomizerTest.java
deleted file mode 100644
index 2f31adddd..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/BridgeDomainCustomizerTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.translate.v3po.vppstate;
-
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.BridgeDomainsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomain;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainKey;
-
-public class BridgeDomainCustomizerTest
- extends ListReaderCustomizerTest<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> {
-
- private NamingContext bdContext;
- private NamingContext interfacesContext;
-
- public BridgeDomainCustomizerTest() {
- super(BridgeDomain.class, BridgeDomainsBuilder.class);
- }
-
- @Override
- public void setUp() {
- bdContext = new NamingContext("generatedBdName", "bd-test-instance");
- interfacesContext = new NamingContext("generatedIfaceName", "ifc-test-instance");
- }
-
- @Override
- protected ReaderCustomizer<BridgeDomain, BridgeDomainBuilder> initCustomizer() {
- return new BridgeDomainCustomizer(api, bdContext);
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizerTest.java
deleted file mode 100644
index a76baea60..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizerTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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.translate.v3po.vppstate;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.L2FibForward;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.L2FibTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.L2FibTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntryKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.BridgeDomains;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomain;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppInvocationException;
-import io.fd.vpp.jvpp.core.dto.L2FibTableDump;
-import io.fd.vpp.jvpp.core.dto.L2FibTableEntry;
-import io.fd.vpp.jvpp.core.dto.L2FibTableEntryReplyDump;
-
-public class L2FibEntryCustomizerTest extends ListReaderCustomizerTest<L2FibEntry, L2FibEntryKey, L2FibEntryBuilder> {
-
- private static final String BD_NAME = "testBD0";
- private static final int BD_ID = 111;
- private static final String IFACE_NAME = "eth0";
- private static final int IFACE_ID = 123;
- private static final String BD_CTX_NAME = "bd-test-instance";
- private static final String IFC_CTX_NAME = "ifc-test-instance";
- private NamingContext bdContext;
- private NamingContext interfacesContext;
-
- public L2FibEntryCustomizerTest() {
- super(L2FibEntry.class, L2FibTableBuilder.class);
- }
-
- @Override
- public void setUp() {
- bdContext = new NamingContext("generatedBdName", BD_CTX_NAME);
- defineMapping(mappingContext, BD_NAME, BD_ID, BD_CTX_NAME);
- interfacesContext = new NamingContext("generatedIfaceName", IFC_CTX_NAME);
- }
-
- @Override
- protected ReaderCustomizer<L2FibEntry, L2FibEntryBuilder> initCustomizer() {
- return new L2FibEntryCustomizer(api, bdContext, interfacesContext);
- }
-
- private static InstanceIdentifier<L2FibEntry> getL2FibEntryId(final String bdName, final PhysAddress address) {
- return InstanceIdentifier.create(BridgeDomains.class).child(BridgeDomain.class, new BridgeDomainKey(bdName))
- .child(L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(address));
- }
-
- private void whenL2FibTableDumpThenReturn(final List<L2FibTableEntry> l2FibTableEntryList)
- throws ExecutionException, InterruptedException, VppInvocationException {
- final L2FibTableEntryReplyDump reply = new L2FibTableEntryReplyDump();
- reply.l2FibTableEntry = l2FibTableEntryList;
- when(api.l2FibTableDump(any(L2FibTableDump.class))).thenReturn(future(reply));
- }
-
- @Test
- public void testRead() throws Exception {
- final long address_vpp = 0x0000010203040506L;
- final PhysAddress address = new PhysAddress("01:02:03:04:05:06");
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
-
- whenL2FibTableDumpThenReturn(Collections.singletonList(generateL2FibEntry(address_vpp)));
-
- final L2FibEntryBuilder builder = mock(L2FibEntryBuilder.class);
- getCustomizer().readCurrentAttributes(getL2FibEntryId(BD_NAME, address), builder, ctx);
-
- verify(builder).setAction(L2FibForward.class);
- verify(builder).setBridgedVirtualInterface(false);
- verify(builder).setOutgoingInterface(IFACE_NAME);
- verify(builder).setStaticConfig(false);
- verify(builder).setPhysAddress(address);
- verify(builder).setKey(new L2FibEntryKey(address));
- }
-
- private L2FibTableEntry generateL2FibEntry(final long mac) {
- final L2FibTableEntry entry = new L2FibTableEntry();
- entry.mac = mac;
- entry.swIfIndex = IFACE_ID;
- return entry;
- }
-
- @Test
- public void testGetAllIds() throws Exception {
- final long address_vpp = 0x0000112233445566L;
- final PhysAddress address = new PhysAddress("11:22:33:44:55:66");
-
- whenL2FibTableDumpThenReturn(Collections.singletonList(generateL2FibEntry(address_vpp)));
-
- final List<L2FibEntryKey> ids = getCustomizer().getAllIds(getL2FibEntryId(BD_NAME, address), ctx);
- assertEquals(1, ids.size());
- assertEquals(address, ids.get(0).getPhysAddress());
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizerTest.java
deleted file mode 100644
index ab35bb330..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizerTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.translate.v3po.vppstate;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.ShowVersion;
-import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
-import io.fd.vpp.jvpp.dto.ControlPing;
-import io.fd.vpp.jvpp.dto.ControlPingReply;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.Version;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.VersionBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class VersionCustomizerTest extends ReaderCustomizerTest<Version, VersionBuilder> {
-
- public VersionCustomizerTest() {
- super(Version.class, VppStateBuilder.class);
- }
-
- @Override
- protected ReaderCustomizer<Version, VersionBuilder> initCustomizer() {
- return new VersionCustomizer(api);
- }
-
- @Test
- public void testReadCurrentAttributes() throws Exception {
- final ShowVersionReply reply = new ShowVersionReply();
- reply.version = new byte[] {};
- reply.program = new byte[] {};
- reply.buildDate = new byte[] {};
- reply.buildDirectory = new byte[] {};
-
- when(api.showVersion(any(ShowVersion.class))).thenReturn(future(reply));
- when(api.send(any(ControlPing.class))).thenReturn(future(new ControlPingReply()));
- getCustomizer().readCurrentAttributes(InstanceIdentifier.create(Version.class), new VersionBuilder(), ctx);
- verify(api).showVersion(any(ShowVersion.class));
- verify(api).send(any(ControlPing.class));
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VppStateTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VppStateTest.java
deleted file mode 100644
index cdc352ac5..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VppStateTest.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * 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.translate.v3po.vppstate;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.when;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Multimap;
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.ModificationCache;
-import io.fd.honeycomb.translate.impl.read.GenericListReader;
-import io.fd.honeycomb.translate.impl.read.GenericReader;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.read.registry.ReaderRegistry;
-import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
-import io.fd.honeycomb.vpp.test.util.NamingContextHelper;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.vpp.test.util.FutureProducer;
-import io.fd.vpp.jvpp.dto.ControlPing;
-import io.fd.vpp.jvpp.dto.ControlPingReply;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import javax.annotation.Nonnull;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.L2FibTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntryKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.BridgeDomains;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.BridgeDomainsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.Version;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.VersionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomain;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainKey;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainDetails;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainDump;
-import io.fd.vpp.jvpp.core.dto.L2FibTableDump;
-import io.fd.vpp.jvpp.core.dto.L2FibTableEntry;
-import io.fd.vpp.jvpp.core.dto.L2FibTableEntryReplyDump;
-import io.fd.vpp.jvpp.core.dto.ShowVersion;
-import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-public class VppStateTest implements FutureProducer, NamingContextHelper {
-
- private static final String BD_CTX_NAME = "bd-test-instance";
- @Mock
- private FutureJVppCore api;
- @Mock
- private ReadContext ctx;
- @Mock
- private MappingContext mappingContext;
-
- private NamingContext bdContext;
-
- private ReaderRegistry readerRegistry;
-
- private static InstanceIdentifier<BridgeDomains> bridgeDomainsId;
-
- /**
- * Create root VppState reader with all its children wired.
- */
- private static ReaderRegistry getVppStateReader(@Nonnull final FutureJVppCore jVpp,
- @Nonnull final NamingContext bdContext) {
- final CompositeReaderRegistryBuilder registry = new CompositeReaderRegistryBuilder();
-
- // VppState(Structural)
- final InstanceIdentifier<VppState> vppStateId = InstanceIdentifier.create(VppState.class);
- registry.addStructuralReader(vppStateId, VppStateBuilder.class);
- // Version
- registry.add(new GenericReader<>(vppStateId.child(Version.class), new VersionCustomizer(jVpp)));
- // BridgeDomains(Structural)
- bridgeDomainsId = vppStateId.child(BridgeDomains.class);
- registry.addStructuralReader(bridgeDomainsId, BridgeDomainsBuilder.class);
- // BridgeDomain
- registry.add(getBridgeDomainReader(jVpp, bdContext));
- return registry.build();
- }
-
- private static GenericListReader<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> getBridgeDomainReader(
- final @Nonnull FutureJVppCore jVpp, final @Nonnull NamingContext bdContext) {
- final InstanceIdentifier<BridgeDomain> bridgeDomainId = bridgeDomainsId.child(BridgeDomain.class);
- return new GenericListReader<>(bridgeDomainId, new BridgeDomainCustomizer(jVpp, bdContext));
- }
-
- @Before
- public void setUp() throws Exception {
- initMocks(this);
- final ModificationCache cache = new ModificationCache();
- doReturn(cache).when(ctx).getModificationCache();
- doReturn(mappingContext).when(ctx).getMappingContext();
-
- bdContext = new NamingContext("generatedBdName", BD_CTX_NAME);
- readerRegistry = getVppStateReader(api, bdContext);
- }
-
- private static Version getVersion() {
- return new VersionBuilder()
- .setName("test")
- .setBuildDirectory("1")
- .setBranch("2")
- .setBuildDate("3")
- .setPid(0L)
- .build();
- }
-
- private void whenShowVersionThenReturn(final Version version) {
- final ShowVersionReply reply = new ShowVersionReply();
- reply.buildDate = version.getBuildDate().getBytes();
- reply.program = version.getName().getBytes();
- reply.version = version.getBranch().getBytes();
- reply.buildDirectory = version.getBuildDirectory().getBytes();
- when(api.showVersion(any(ShowVersion.class))).thenReturn(future(reply));
- // Version Customizer uses ControlPing to obtain PID
- when(api.send(any(ControlPing.class))).thenReturn(future(new ControlPingReply()));
- }
-
- private void whenL2FibTableDumpThenReturn(final List<L2FibTableEntry> entryList) {
- final L2FibTableEntryReplyDump reply = new L2FibTableEntryReplyDump();
- reply.l2FibTableEntry = entryList;
- when(api.l2FibTableDump(any(L2FibTableDump.class))).thenReturn(future(reply));
- }
-
- private void whenBridgeDomainDumpThenReturn(final List<BridgeDomainDetails> bdList) {
- final BridgeDomainDetailsReplyDump reply = new BridgeDomainDetailsReplyDump();
- reply.bridgeDomainDetails = bdList;
-
- doAnswer(invocation -> {
- BridgeDomainDump request = (BridgeDomainDump) invocation.getArguments()[0];
- if (request.bdId == -1) {
- reply.bridgeDomainDetails = bdList;
- } else {
- reply.bridgeDomainDetails = Collections.singletonList(bdList.get(request.bdId));
- }
- return future(reply);
- }).when(api).bridgeDomainDump(any(BridgeDomainDump.class));
- }
-
- @Test
- public void testReadAll() throws Exception {
- final Version version = getVersion();
- whenShowVersionThenReturn(version);
-
- final BridgeDomainDetails bridgeDomainDetails = new BridgeDomainDetails();
- final BridgeDomainDetails bridgeDomainDetails2 = new BridgeDomainDetails();
- bridgeDomainDetails2.bdId = 1;
-
- final List<BridgeDomainDetails> bdList = Arrays.asList(bridgeDomainDetails, bridgeDomainDetails2);
- mockBdMapping(bridgeDomainDetails, "bd1");
- mockBdMapping(bridgeDomainDetails2, "bd2");
-
- whenBridgeDomainDumpThenReturn(bdList);
-
- final Multimap<InstanceIdentifier<? extends DataObject>, ? extends DataObject> dataObjects =
- readerRegistry.readAll(ctx);
- assertEquals(dataObjects.size(), 1);
- final VppState dataObject =
- (VppState) Iterables.getOnlyElement(dataObjects.get(Iterables.getOnlyElement(dataObjects.keySet())));
- assertEquals(version, dataObject.getVersion());
- assertEquals(2, dataObject.getBridgeDomains().getBridgeDomain().size());
- }
-
- @Test
- public void testReadSpecific() throws Exception {
- final Version version = getVersion();
- whenShowVersionThenReturn(version);
- whenBridgeDomainDumpThenReturn(Collections.emptyList());
-
- final Optional<? extends DataObject> read = readerRegistry.read(InstanceIdentifier.create(VppState.class), ctx);
- assertTrue(read.isPresent());
- assertEquals(version, ((VppState) read.get()).getVersion());
- }
-
- @Test
- public void testReadBridgeDomains() throws Exception {
- final Version version = getVersion();
- whenShowVersionThenReturn(version);
- final BridgeDomainDetails details = new BridgeDomainDetails();
- whenBridgeDomainDumpThenReturn(Collections.singletonList(details));
-
- mockBdMapping(details, "bdn1");
- VppState readRoot = (VppState) readerRegistry.read(InstanceIdentifier.create(VppState.class), ctx).get();
-
- Optional<? extends DataObject> read =
- readerRegistry.read(InstanceIdentifier.create(VppState.class).child(BridgeDomains.class), ctx);
- assertTrue(read.isPresent());
- assertEquals(readRoot.getBridgeDomains(), read.get());
- }
-
- /**
- * L2fib does not have a dedicated reader, relying on auto filtering
- */
- @Test
- @Ignore("L2 FIB was moved to dedicated customizer. TODO: add infra test that covers such case")
- @SuppressWarnings("unchecked")
- public void testReadL2Fib() throws Exception {
- final BridgeDomainDetails bd = new BridgeDomainDetails();
- bd.bdId = 0;
- final String bdName = "bdn1";
- mockBdMapping(bd, bdName);
- defineMapping(mappingContext, "eth1", 0, "ifc-test-instance");
-
- whenBridgeDomainDumpThenReturn(Collections.singletonList(bd));
- final L2FibTableEntry l2FibEntry = new L2FibTableEntry();
- l2FibEntry.bdId = 0;
- l2FibEntry.mac = 0x0605040302010000L;
- whenL2FibTableDumpThenReturn(Collections.singletonList(l2FibEntry));
-
- // Deep child without a dedicated reader with specific l2fib key
- final InstanceIdentifier<? extends DataObject> idExisting =
- InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child(
- BridgeDomain.class, new BridgeDomainKey("bdn1")).child(L2FibTable.class)
- .child(L2FibEntry.class, new L2FibEntryKey(new PhysAddress("01:02:03:04:05:06")));
- Optional<? extends DataObject> read =
- readerRegistry.read(idExisting, ctx);
- assertTrue(read.isPresent());
-
- // non existing l2fib
- final InstanceIdentifier<? extends DataObject> idNonExisting =
- InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child(
- BridgeDomain.class, new BridgeDomainKey("bdn1")).child(L2FibTable.class)
- .child(L2FibEntry.class, new L2FibEntryKey(new PhysAddress("FF:FF:FF:04:05:06")));
- read = readerRegistry.read(idNonExisting, ctx);
- assertFalse(read.isPresent());
- }
-
- private void mockBdMapping(final BridgeDomainDetails bd, final String bdName) {
- defineMapping(mappingContext, bdName, bd.bdId, BD_CTX_NAME);
- }
-
- @Test
- public void testReadBridgeDomainAll() throws Exception {
- final Version version = getVersion();
- whenShowVersionThenReturn(version);
- final BridgeDomainDetails details = new BridgeDomainDetails();
- whenBridgeDomainDumpThenReturn(Collections.singletonList(details));
- mockBdMapping(details, "bd2");
-
- VppState readRoot = (VppState) readerRegistry.read(InstanceIdentifier.create(VppState.class), ctx).get();
-
- final GenericListReader<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> bridgeDomainReader =
- getBridgeDomainReader(api, bdContext);
-
- final List<BridgeDomain> read =
- bridgeDomainReader.readList(InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child(
- BridgeDomain.class), ctx);
-
- assertEquals(readRoot.getBridgeDomains().getBridgeDomain(), read);
- }
-
- @Test
- public void testReadBridgeDomain() throws Exception {
- final BridgeDomainDetails bd = new BridgeDomainDetails();
- bd.bdId = 0;
- final String bdName = "bdn1";
- mockBdMapping(bd, bdName);
-
- whenBridgeDomainDumpThenReturn(Collections.singletonList(bd));
- whenShowVersionThenReturn(getVersion());
-
- VppState readRoot = (VppState) readerRegistry.read(InstanceIdentifier.create(VppState.class), ctx).get();
-
- final Optional<? extends DataObject> read =
- readerRegistry.read(InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child(
- BridgeDomain.class, new BridgeDomainKey(bdName)), ctx);
-
- assertTrue(read.isPresent());
- assertEquals(readRoot.getBridgeDomains().getBridgeDomain().stream().filter(
- input -> input.getKey().getName().equals(bdName)).findFirst().get(),
- read.get());
- }
-
- @Test(expected = ReadFailedException.class)
- public void testReadBridgeDomainNotExisting() throws Exception {
- final String nonExistingBdName = "NOT EXISTING";
- noMappingDefined(mappingContext, nonExistingBdName, BD_CTX_NAME);
-
- readerRegistry.read(InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child(
- BridgeDomain.class, new BridgeDomainKey(nonExistingBdName)), ctx);
- }
-
- @Test
- public void testReadVersion() throws Exception {
- whenShowVersionThenReturn(getVersion());
- whenBridgeDomainDumpThenReturn(Collections.emptyList());
- VppState readRoot = (VppState) readerRegistry.read(InstanceIdentifier.create(VppState.class), ctx).get();
-
- Optional<? extends DataObject> read =
- readerRegistry.read(InstanceIdentifier.create(VppState.class).child(Version.class), ctx);
- assertTrue(read.isPresent());
- assertEquals(readRoot.getVersion(), read.get());
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/vpp/util/SubinterfaceUtilsTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/vpp/util/SubinterfaceUtilsTest.java
deleted file mode 100644
index da2a0427d..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/vpp/util/SubinterfaceUtilsTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-public class SubinterfaceUtilsTest {
-
- @Test
- public void testGetSubInterfaceName() throws Exception {
- final String superIfName = "GigabitEthernet0/9/0";
- final int subIfaceId = 123;
- final String expectedSubIfaceName = "GigabitEthernet0/9/0.123";
- assertEquals(expectedSubIfaceName, SubInterfaceUtils.getSubInterfaceName(superIfName, subIfaceId));
- }
-} \ No newline at end of file
diff --git a/vpp-common/asciidoc/Readme.adoc b/vpp-common/asciidoc/Readme.adoc
deleted file mode 100644
index fc5e6b489..000000000
--- a/vpp-common/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= vpp-common-aggregator
-
-Overview of vpp-common-aggregator \ No newline at end of file
diff --git a/vpp-common/naming-context-api/asciidoc/Readme.adoc b/vpp-common/naming-context-api/asciidoc/Readme.adoc
deleted file mode 100644
index 42eeb60c9..000000000
--- a/vpp-common/naming-context-api/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= naming-context-api
-
-Overview of naming-context-api \ No newline at end of file
diff --git a/vpp-common/naming-context-api/pom.xml b/vpp-common/naming-context-api/pom.xml
deleted file mode 100644
index f197daaff..000000000
--- a/vpp-common/naming-context-api/pom.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>api-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../../common/api-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>naming-context-api</artifactId>
- <name>${project.artifactId}</name>
- <version>1.16.12-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
-</project>
diff --git a/vpp-common/naming-context-api/src/main/yang/naming-context.yang b/vpp-common/naming-context-api/src/main/yang/naming-context.yang
deleted file mode 100644
index c101b5c26..000000000
--- a/vpp-common/naming-context-api/src/main/yang/naming-context.yang
+++ /dev/null
@@ -1,44 +0,0 @@
-module naming-context {
- yang-version 1;
- namespace "urn:honeycomb:params:xml:ns:yang:naming:context";
- prefix "nc";
-
- description
- "This module contains data definition for naming mapping context";
-
- revision "2016-05-13" {
- description
- "Initial revision.";
- }
-
- container contexts {
- config false;
- // context data
-
- list naming-context {
-
- key "name";
-
- leaf name {
- type string;
- }
-
- container mappings {
- list mapping {
-
- key "name";
- unique "index";
-
- leaf name {
- type string;
- }
-
- leaf index {
- type int32;
- }
- }
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/vpp-common/naming-context-impl/asciidoc/Readme.adoc b/vpp-common/naming-context-impl/asciidoc/Readme.adoc
deleted file mode 100644
index 93e3b75c4..000000000
--- a/vpp-common/naming-context-impl/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= naming-context-impl
-
-Overview of naming-context-impl \ No newline at end of file
diff --git a/vpp-common/naming-context-impl/pom.xml b/vpp-common/naming-context-impl/pom.xml
deleted file mode 100644
index 68a2bc74a..000000000
--- a/vpp-common/naming-context-impl/pom.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>impl-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../../common/impl-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>naming-context-impl</artifactId>
- <name>${project.artifactId}</name>
- <version>1.16.12-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <dependencies>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>translate-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>translate-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>naming-context-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/vpp-common/naming-context-impl/src/main/java/io/fd/honeycomb/vpp/context/ContextsReaderFactory.java b/vpp-common/naming-context-impl/src/main/java/io/fd/honeycomb/vpp/context/ContextsReaderFactory.java
deleted file mode 100644
index 0745475f7..000000000
--- a/vpp-common/naming-context-impl/src/main/java/io/fd/honeycomb/vpp/context/ContextsReaderFactory.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.vpp.context;
-
-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.naming.context.rev160513.Contexts;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.ContextsBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * {@link ReaderFactory} initiating reader providing data from context data store.
- * Making them available over RESTCONF/NETCONF.
- */
-public final 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/vpp-common/pom.xml b/vpp-common/pom.xml
deleted file mode 100644
index e7180aea2..000000000
--- a/vpp-common/pom.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>honeycomb-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../common/honeycomb-parent</relativePath>
- </parent>
-
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-common-aggregator</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <name>${project.artifactId}</name>
- <packaging>pom</packaging>
- <modelVersion>4.0.0</modelVersion>
- <description>Aggregator for Honeycomb common code used by Honeycomb plugins for VPP</description>
-
- <modules>
- <module>vpp-translate-utils</module>
- <module>naming-context-api</module>
- <module>naming-context-impl</module>
- <module>vpp-common-integration</module>
- <module>vpp-impl-parent</module>
- <module>vpp-translate-test</module>
- </modules>
-
- <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/vpp-common/vpp-common-integration/asciidoc/Readme.adoc b/vpp-common/vpp-common-integration/asciidoc/Readme.adoc
deleted file mode 100644
index 8c18a3eb2..000000000
--- a/vpp-common/vpp-common-integration/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= vpp-common-integration
-
-Overview of vpp-common-integration \ No newline at end of file
diff --git a/vpp-common/vpp-common-integration/pom.xml b/vpp-common/vpp-common-integration/pom.xml
deleted file mode 100644
index 2cb031ec8..000000000
--- a/vpp-common/vpp-common-integration/pom.xml
+++ /dev/null
@@ -1,116 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>impl-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../../common/impl-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-common-integration</artifactId>
- <version>1.16.12-SNAPSHOT</version>
-
- <properties>
- <honeycomb.min.distro.version>1.16.12-SNAPSHOT</honeycomb.min.distro.version>
- <jvpp.version>16.12-SNAPSHOT</jvpp.version>
- <hamcrest.version>1.3</hamcrest.version>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.codehaus.gmaven</groupId>
- <artifactId>groovy-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>minimal-distribution</artifactId>
- <version>${honeycomb.min.distro.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>naming-context-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>naming-context-impl</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.vpp</groupId>
- <artifactId>jvpp-registry</artifactId>
- <version>${jvpp.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.vpp</groupId>
- <artifactId>jvpp-core</artifactId>
- <version>${jvpp.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>vpp-translate-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- Testing Dependencies -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-testlib</artifactId>
- <version>${guice.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-all</artifactId>
- <version>${hamcrest.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/ContextsReaderFactoryProvider.java b/vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/ContextsReaderFactoryProvider.java
deleted file mode 100644
index d33b8b717..000000000
--- a/vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/ContextsReaderFactoryProvider.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.vpp.common.integration;
-
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import io.fd.honeycomb.infra.distro.ProviderTrait;
-import io.fd.honeycomb.infra.distro.data.context.ContextPipelineModule;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.vpp.context.ContextsReaderFactory;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-
-/**
- * Mirror of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.context.impl.rev141210.ContextReaderModule
- */
-public final class ContextsReaderFactoryProvider extends ProviderTrait<ReaderFactory> {
-
- @Inject
- @Named(ContextPipelineModule.HONEYCOMB_CONTEXT)
- private DataBroker contextDataBroker;
-
- @Override
- protected ContextsReaderFactory create() {
- return new ContextsReaderFactory(contextDataBroker);
- }
-}
diff --git a/vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/JVppCoreProvider.java b/vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/JVppCoreProvider.java
deleted file mode 100644
index bbd30fbfb..000000000
--- a/vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/JVppCoreProvider.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.vpp.common.integration;
-
-import com.google.inject.Inject;
-import io.fd.honeycomb.infra.distro.ProviderTrait;
-import java.io.IOException;
-import io.fd.vpp.jvpp.JVppRegistry;
-import io.fd.vpp.jvpp.core.JVppCoreImpl;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import io.fd.vpp.jvpp.core.future.FutureJVppCoreFacade;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Provides future API for jvpp-core plugin. Must be a singleton due to shutdown hook usage. Registers shutdown hook to
- * free plugin's resources on shutdown.
- */
-public final class JVppCoreProvider extends ProviderTrait<FutureJVppCore> {
-
- private static final Logger LOG = LoggerFactory.getLogger(JVppCoreProvider.class);
-
- @Inject
- private JVppRegistry registry;
-
- @Override
- protected FutureJVppCoreFacade create() {
- try {
- final JVppCoreImpl jVpp = new JVppCoreImpl();
- // Free jvpp-core plugin's resources on shutdown
- Runtime.getRuntime().addShutdownHook(new Thread() {
-
- @Override
- public void run() {
- LOG.info("Unloading jvpp-core plugin");
- jVpp.close();
- LOG.info("Successfully unloaded jvpp-core plugin");
- }
- });
-
- LOG.info("Successfully loaded jvpp-core plugin");
- return new FutureJVppCoreFacade(registry, jVpp);
- } catch (IOException e) {
- throw new IllegalStateException("Unable to open VPP management connection", e);
- }
- }
-}
diff --git a/vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/JVppRegistryProvider.java b/vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/JVppRegistryProvider.java
deleted file mode 100644
index fa1d47480..000000000
--- a/vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/JVppRegistryProvider.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.vpp.common.integration;
-
-import com.google.inject.Inject;
-import io.fd.honeycomb.infra.distro.ProviderTrait;
-import io.fd.honeycomb.translate.vpp.util.VppStatusListener;
-import java.io.IOException;
-import io.fd.vpp.jvpp.JVppRegistry;
-import io.fd.vpp.jvpp.JVppRegistryImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Provides JVppRegistry. Must be a singleton due to shutdown hook usage. Registers shutdown hook to disconnect from
- * VPP.
- */
-public final class JVppRegistryProvider extends ProviderTrait<JVppRegistry> {
-
- private static final Logger LOG = LoggerFactory.getLogger(JVppRegistryProvider.class);
-
- @Inject
- private VppConfigAttributes config;
- @Inject
- private VppStatusListener vppStatus;
-
- @Override
- protected JVppRegistryImpl create() {
- try {
- final JVppRegistryImpl registry = new JVppRegistryImpl(config.jvppConnectionName);
-
- // Closing JVpp connection with shutdown hook to erase the connection from VPP so HC will be able
- // to connect next time. If JVM is force closed, this will not be executed and VPP connection
- // with name from config will stay open and prevent next startup of HC to success
- Runtime.getRuntime().addShutdownHook(new Thread() {
- @Override
- public void run() {
- LOG.info("Disconnecting from VPP");
- if (vppStatus.isDown()) {
- LOG.info("VPP is down. JVppRegistry cleanup is not needed. Exiting");
- return;
- }
- try {
- registry.close();
- LOG.info("Successfully disconnected from VPP as {}", config.jvppConnectionName);
- } catch (Exception e) {
- LOG.warn("Unable to properly close jvpp registry", e);
- }
- }
- });
-
- LOG.info("JVpp connection opened successfully as: {}", config.jvppConnectionName);
- return registry;
- } catch (IOException e) {
- throw new IllegalStateException("Unable to open VPP management connection", e);
- }
- }
-}
diff --git a/vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/VppCommonModule.java b/vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/VppCommonModule.java
deleted file mode 100644
index 9bdba1b14..000000000
--- a/vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/VppCommonModule.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.vpp.common.integration;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Singleton;
-import com.google.inject.multibindings.Multibinder;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.vpp.util.VppStatusListener;
-import net.jmob.guice.conf.core.ConfigurationModule;
-import io.fd.vpp.jvpp.JVppRegistry;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-public final class VppCommonModule extends AbstractModule {
- protected void configure() {
-
- install(ConfigurationModule.create());
- // Inject non-dependency configuration
- requestInjection(VppConfigAttributes.class);
-
- bind(VppStatusListener.class).toInstance(new VppStatusListener());
- bind(JVppRegistry.class).toProvider(JVppRegistryProvider.class).in(Singleton.class);
- bind(FutureJVppCore.class).toProvider(JVppCoreProvider.class).in(Singleton.class);
-
- // Naming contexts reader exposing context storage over REST/HONEYCOMB_NETCONF
- final Multibinder<ReaderFactory> readerBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class);
- readerBinder.addBinding().toProvider(ContextsReaderFactoryProvider.class).in(Singleton.class);
- }
-
-}
diff --git a/vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/VppConfigAttributes.java b/vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/VppConfigAttributes.java
deleted file mode 100644
index af06e05db..000000000
--- a/vpp-common/vpp-common-integration/src/main/java/io/fd/honeycomb/vpp/common/integration/VppConfigAttributes.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.vpp.common.integration;
-
-import net.jmob.guice.conf.core.BindConfig;
-import net.jmob.guice.conf.core.InjectConfig;
-import net.jmob.guice.conf.core.Syntax;
-
-@BindConfig(value = "jvpp", syntax = Syntax.JSON)
-public class VppConfigAttributes {
-
- @InjectConfig("jvpp-connection-name")
- public String jvppConnectionName;
-}
diff --git a/vpp-common/vpp-common-integration/src/main/resources/honeycomb-minimal-resources/config/jvpp.json b/vpp-common/vpp-common-integration/src/main/resources/honeycomb-minimal-resources/config/jvpp.json
deleted file mode 100644
index 1d411872e..000000000
--- a/vpp-common/vpp-common-integration/src/main/resources/honeycomb-minimal-resources/config/jvpp.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "jvpp-connection-name": "honeycomb"
-} \ No newline at end of file
diff --git a/vpp-common/vpp-common-integration/src/test/java/io/fd/honeycomb/vpp/common/integration/VppCommonModuleTest.java b/vpp-common/vpp-common-integration/src/test/java/io/fd/honeycomb/vpp/common/integration/VppCommonModuleTest.java
deleted file mode 100644
index 476e15919..000000000
--- a/vpp-common/vpp-common-integration/src/test/java/io/fd/honeycomb/vpp/common/integration/VppCommonModuleTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.vpp.common.integration;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.Matchers.empty;
-import static org.junit.Assert.assertThat;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import com.google.inject.Guice;
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import com.google.inject.testing.fieldbinder.Bind;
-import com.google.inject.testing.fieldbinder.BoundFieldModule;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import java.util.HashSet;
-import java.util.Set;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-
-public class VppCommonModuleTest {
-
- @Named("honeycomb-context")
- @Bind
- @Mock
- private DataBroker honeycombContext;
-
- @Inject
- private Set<ReaderFactory> readerFactories = new HashSet<>();
-
- @Test
- public void testConfigure() throws Exception {
- initMocks(this);
- Guice.createInjector(new VppCommonModule(), BoundFieldModule.of(this)).injectMembers(this);
- assertThat(readerFactories, is(not(empty())));
- }
-} \ No newline at end of file
diff --git a/vpp-common/vpp-common-integration/src/test/resources/jvpp.json b/vpp-common/vpp-common-integration/src/test/resources/jvpp.json
deleted file mode 100644
index 1d411872e..000000000
--- a/vpp-common/vpp-common-integration/src/test/resources/jvpp.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "jvpp-connection-name": "honeycomb"
-} \ No newline at end of file
diff --git a/vpp-common/vpp-impl-parent/asciidoc/Readme.adoc b/vpp-common/vpp-impl-parent/asciidoc/Readme.adoc
deleted file mode 100644
index 2dfc0b9a8..000000000
--- a/vpp-common/vpp-impl-parent/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= vpp-impl-parent
-
-Overview of vpp-impl-parent \ No newline at end of file
diff --git a/vpp-common/vpp-impl-parent/pom.xml b/vpp-common/vpp-impl-parent/pom.xml
deleted file mode 100644
index 83be57ba8..000000000
--- a/vpp-common/vpp-impl-parent/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>impl-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../../common/impl-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-impl-parent</artifactId>
- <name>${project.artifactId}</name>
- <version>1.16.12-SNAPSHOT</version>
- <packaging>pom</packaging>
-
- <properties>
- <jvpp.version>16.12-SNAPSHOT</jvpp.version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>io.fd.vpp</groupId>
- <artifactId>jvpp-core</artifactId>
- <version>${jvpp.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.vpp</groupId>
- <artifactId>jvpp-registry</artifactId>
- <version>${jvpp.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-translate-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-</project>
diff --git a/vpp-common/vpp-translate-test/asciidoc/Readme.adoc b/vpp-common/vpp-translate-test/asciidoc/Readme.adoc
deleted file mode 100644
index bed1891b4..000000000
--- a/vpp-common/vpp-translate-test/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= vpp-translate-test
-
-Overview of vpp-translate-test \ No newline at end of file
diff --git a/vpp-common/vpp-translate-test/pom.xml b/vpp-common/vpp-translate-test/pom.xml
deleted file mode 100644
index 4dff6183d..000000000
--- a/vpp-common/vpp-translate-test/pom.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <parent>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-impl-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../../vpp-common/vpp-impl-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-translate-test</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <properties>
- <sonar.skip>true</sonar.skip>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>naming-context-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>translate-spi</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.vpp</groupId>
- <artifactId>jvpp-registry</artifactId>
- </dependency>
- <dependency>
- <groupId>io.fd.vpp</groupId>
- <artifactId>jvpp-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>1.9.5</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>translate-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/read/JvppDumpExecutorTest.java b/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/read/JvppDumpExecutorTest.java
deleted file mode 100644
index 500c31387..000000000
--- a/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/read/JvppDumpExecutorTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.vpp.test.read;
-
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.vpp.test.util.FutureProducer;
-import io.fd.vpp.jvpp.VppInvocationException;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-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.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-/**
- * Generic test for implementation of {@link EntityDumpExecutor}
- *
- * @param <T> implementation of {@link EntityDumpExecutor}
- */
-public abstract class JvppDumpExecutorTest<T extends EntityDumpExecutor<?, ?>> implements FutureProducer {
-
- @Mock
- protected FutureJVppCore api;
-
- private T executor;
-
- @Before
- public void setUpParent() {
- MockitoAnnotations.initMocks(this);
- this.executor = initExecutor();
- }
-
- protected abstract T initExecutor();
-
- protected T getExecutor() {
- return this.executor;
- }
-
- /**
- * Return pre-stubed mock that will throw {@link TimeoutException},
- * while performing desired method
- */
- protected FutureJVppCore doThrowTimeoutExceptionWhen()
- throws InterruptedException, ExecutionException, TimeoutException {
-
- CompletableFuture failedFuture = mock(CompletableFuture.class);
- when(failedFuture.toCompletableFuture()).thenReturn(failedFuture);
- when(failedFuture.get(anyLong(), eq(TimeUnit.SECONDS)))
- .thenThrow(new TimeoutException("Exception invoked by " + JvppDumpExecutorTest.class.getName()));
-
- return doReturn(failedFuture).when(api);
- }
-
- /**
- * Return pre-stubed mock that will throw {@link VppInvocationException},
- * while performing desired method
- */
- protected FutureJVppCore doThrowFailExceptionWhen() {
- return doReturn(failedFuture()).when(api);
- }
-
- /**
- * Return pre-stubed mock that will return specified result
- * while performing desired method
- */
- protected <U> FutureJVppCore doReturnResponseWhen(U replyDump) {
- return doReturn(future(replyDump)).when(api);
- }
-}
diff --git a/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/read/ListReaderCustomizerTest.java b/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/read/ListReaderCustomizerTest.java
deleted file mode 100644
index 8917c02db..000000000
--- a/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/read/ListReaderCustomizerTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.vpp.test.read;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
-import java.lang.reflect.Method;
-import java.util.List;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.Identifiable;
-import org.opendaylight.yangtools.yang.binding.Identifier;
-
-/**
- * Generic test for classes implementing {@link ListReaderCustomizer} interface.
- *
- * @param <D> Specific DataObject derived type (Identifiable), that is handled by this customizer
- * @param <K> Specific Identifier for handled type (D)
- * @param <B> Specific Builder for handled type (D)
- */
-public abstract class ListReaderCustomizerTest<D extends DataObject & Identifiable<K>, K extends Identifier<D>, B extends Builder<D>> extends
- ReaderCustomizerTest<D, B> {
-
- protected ListReaderCustomizerTest(
- final Class<D> dataObjectClass,
- final Class<? extends Builder<? extends DataObject>> parentBuilderClass) {
- super(dataObjectClass, parentBuilderClass);
- }
-
- @Override
- protected ListReaderCustomizer<D, K, B> getCustomizer() {
- return ListReaderCustomizer.class.cast(super.getCustomizer());
- }
-
- @Override
- public void testMerge() throws Exception {
- final Builder<? extends DataObject> parentBuilder = mock(parentBuilderClass);
- final List<D> value = (List<D>) mock(List.class);
- getCustomizer().merge(parentBuilder, value);
-
- final Method method = parentBuilderClass.getMethod("set" + dataObjectClass.getSimpleName(), List.class);
- method.invoke(verify(parentBuilder), value);
- }
-}
diff --git a/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/read/ReaderCustomizerTest.java b/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/read/ReaderCustomizerTest.java
deleted file mode 100644
index d4cb385c6..000000000
--- a/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/read/ReaderCustomizerTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.vpp.test.read;
-
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.ModificationCache;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.vpp.test.util.FutureProducer;
-import io.fd.honeycomb.vpp.test.util.NamingContextHelper;
-import java.lang.reflect.Method;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-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.future.FutureJVppCore;
-
-/**
- * Generic test for classes implementing {@link ReaderCustomizer} interface.
- *
- * @param <D> Specific DataObject derived type (Identifiable), that is handled by this customizer
- * @param <B> Specific Builder for handled type (D)
- */
-public abstract class ReaderCustomizerTest<D extends DataObject, B extends Builder<D>> implements FutureProducer,
- NamingContextHelper {
-
- @Mock
- protected FutureJVppCore api;
- @Mock
- protected ReadContext ctx;
- @Mock
- protected MappingContext mappingContext;
-
- protected final Class<? extends Builder<? extends DataObject>> parentBuilderClass;
- protected final Class<D> dataObjectClass;
- protected ModificationCache cache;
- protected ReaderCustomizer<D, B> customizer;
-
- public ReaderCustomizerTest(
- final Class<D> dataObjectClass,
- final Class<? extends Builder<? extends DataObject>> parentBuilderClass) {
- this.dataObjectClass = dataObjectClass;
- this.parentBuilderClass = parentBuilderClass;
- }
-
- @Before
- public final void setUpParent() throws Exception {
- MockitoAnnotations.initMocks(this);
- cache = new ModificationCache();
- Mockito.doReturn(cache).when(ctx).getModificationCache();
- Mockito.doReturn(mappingContext).when(ctx).getMappingContext();
- setUp();
- customizer = initCustomizer();
- }
-
- /**
- * Optional setup for subclasses. Invoked before customizer is initialized.
- */
- protected void setUp() throws Exception {
- }
-
- protected abstract ReaderCustomizer<D, B> initCustomizer();
-
- protected ReaderCustomizer<D, B> getCustomizer() {
- return customizer;
- }
-
- @Test
- public void testGetBuilder() throws Exception {
- assertNotNull(customizer.getBuilder(InstanceIdentifier.create(dataObjectClass)));
- }
-
- @Test
- public void testMerge() throws Exception {
- final Builder<? extends DataObject> parentBuilder = mock(parentBuilderClass);
- final D value = mock(dataObjectClass);
- getCustomizer().merge(parentBuilder, value);
-
- final Method method = parentBuilderClass.getMethod("set" + dataObjectClass.getSimpleName(), dataObjectClass);
- method.invoke(verify(parentBuilder), value);
- }
-}
diff --git a/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/util/FutureProducer.java b/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/util/FutureProducer.java
deleted file mode 100644
index a75b3c0ab..000000000
--- a/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/util/FutureProducer.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.vpp.test.util;
-
-import java.util.concurrent.CompletableFuture;
-import javax.annotation.Nonnull;
-import io.fd.vpp.jvpp.VppCallbackException;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-/**
- * <p>VPP translation test helper, that produces instances of {@link CompletableFuture} with desired results.</p>
- * <p>Useful when stubbing {@link FutureJVppCore} methods: <br>{@code when(api.showVersion(any())).thenReturn(future(new
- * ShowVersionReply()));}</p>
- */
-public interface FutureProducer {
-
- /**
- * Returns {@link CompletableFuture} with desired result.
- *
- * @param result returned when {@link CompletableFuture#get()} is invoked
- * @param <T> the result type of returned future
- */
- default <T> CompletableFuture<T> future(@Nonnull final T result) {
- final CompletableFuture<T> future = new CompletableFuture<>();
- future.complete(result);
- return future;
- }
-
- /**
- * Returns {@link CompletableFuture} with provided {@link Exception} as a result.
- *
- * @param exception to be thrown when {@link CompletableFuture#get()} is invoked
- * @param <T> the result type of returned future
- */
- default <T> CompletableFuture<T> failedFuture(@Nonnull final Exception exception) {
- final CompletableFuture<T> future = new CompletableFuture<>();
- future.completeExceptionally(exception);
- return future;
- }
-
- /**
- * Returns {@link CompletableFuture} with VppCallbackException(retval = -1) as a cause.
- *
- * @param <T> the result type of returned future
- */
- default <T> CompletableFuture<T> failedFuture() {
- return failedFuture(new VppCallbackException("test-call", 1 /* ctxId */, -1 /* retval */));
- }
-}
diff --git a/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/util/InterfaceDumpHelper.java b/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/util/InterfaceDumpHelper.java
deleted file mode 100644
index c88ad3f44..000000000
--- a/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/util/InterfaceDumpHelper.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.vpp.test.util;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.when;
-
-import java.util.Collections;
-import javax.annotation.Nonnull;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-/**
- * VPP translation test helper, that helps stubbing {@link FutureJVppCore#swInterfaceDump}.
- */
-public interface InterfaceDumpHelper extends FutureProducer {
-
- /**
- * Stubs swInterfaceDump to return given list of interfaces.
- *
- * @param api vppApi reference
- * @param interfaces list of interface details to be returned
- */
- default void whenSwInterfaceDumpThenReturn(@Nonnull final FutureJVppCore api,
- final SwInterfaceDetails... interfaces) {
- final SwInterfaceDetailsReplyDump reply = new SwInterfaceDetailsReplyDump();
- Collections.addAll(reply.swInterfaceDetails, interfaces);
- when(api.swInterfaceDump(any())).thenReturn(future(reply));
- }
-}
diff --git a/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/util/NamingContextHelper.java b/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/util/NamingContextHelper.java
deleted file mode 100644
index 9fc9cd457..000000000
--- a/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/util/NamingContextHelper.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.vpp.test.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.naming.context.rev160513.Contexts;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.NamingContext;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.NamingContextKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.naming.context.Mappings;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.naming.context.MappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.naming.context.mappings.Mapping;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.naming.context.mappings.MappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.naming.context.mappings.MappingKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-
-/**
- * Utility that helps stubbing {@link io.fd.honeycomb.translate.vpp.util.NamingContext} methods.
- */
-// TODO(HONEYCOMB-226): the class needs to be refactored or even removed after extracting interface from NamingContext
-public interface NamingContextHelper {
-
- /**
- * Creates {@link Mapping} for given data.
- *
- * @param name to be mapped
- * @param index to be mapped
- * @return name to index mapping
- */
- default Optional<Mapping> mapping(@Nonnull final String name, final int index) {
- return Optional.of(new MappingBuilder().setName(name).setIndex(index).build());
- }
-
- /**
- * Creates {@link KeyedInstanceIdentifier} for {@link Mapping} in {@link NamingContext}.
- *
- * @param name name of the mapping
- * @param namingContextName name of the naming context
- * @return identifier for the mapping
- */
- default KeyedInstanceIdentifier<Mapping, MappingKey> mappingIid(@Nonnull final String name,
- @Nonnull final String namingContextName) {
- return InstanceIdentifier.create(Contexts.class).child(NamingContext.class,
- new NamingContextKey(namingContextName)).child(Mappings.class).child(Mapping.class, new MappingKey(name));
- }
-
- /**
- * Stubs {@link MappingContext#read} to include given mapping in {@link NamingContext}.
- *
- * @param mappingContext mock instance of {@link MappingContext}
- * @param name name of the mapping
- * @param index index to be mapped
- * @param namingContextName name of the naming context
- */
- default void defineMapping(@Nonnull final MappingContext mappingContext, @Nonnull final String name,
- final int index, @Nonnull final String namingContextName) {
- final KeyedInstanceIdentifier<Mapping, MappingKey> mappingIid = mappingIid(name, namingContextName);
- final InstanceIdentifier<Mappings> mappingsIid = mappingIid.firstIdentifierOf(Mappings.class);
-
- final Optional<Mapping> singleMapping = mapping(name, index);
- 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);
- }
-
- /**
- * Stubs {@link MappingContext#read} for given {@link NamingContext} to return {@link Optional#absent} for provided
- * name.
- *
- * @param mappingContext mock instance of {@link MappingContext}
- * @param name name of the mapping
- * @param namingContextName name of the naming context
- */
- default void noMappingDefined(@Nonnull final MappingContext mappingContext, @Nonnull final String name,
- @Nonnull final String namingContextName) {
- final InstanceIdentifier<Mappings> iid = mappingIid(name, namingContextName).firstIdentifierOf(Mappings.class);
- final List<Mapping> list = Common.getMappingList(mappingContext, iid);
-
- doReturn(Optional.of(new MappingsBuilder().setMapping(list).build())).when(mappingContext).read(iid);
- doReturn(Optional.absent()).when(mappingContext).read(mappingIid(name, namingContextName));
- }
-
- 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/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/write/WriterCustomizerTest.java b/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/write/WriterCustomizerTest.java
deleted file mode 100644
index 900418c4c..000000000
--- a/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/write/WriterCustomizerTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.vpp.test.write;
-
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.ModificationCache;
-import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.vpp.test.util.FutureProducer;
-import io.fd.honeycomb.vpp.test.util.NamingContextHelper;
-import org.junit.Before;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-/**
- * Generic test for classes implementing {@link WriterCustomizer} interface.
- */
-public abstract class WriterCustomizerTest implements FutureProducer,
- NamingContextHelper {
-
- @Mock
- protected FutureJVppCore api;
- @Mock
- protected WriteContext writeContext;
- @Mock
- protected MappingContext mappingContext;
-
- protected ModificationCache cache;
-
- protected WriterCustomizerTest() {
- }
-
- @Before
- public final void setUpParent() throws Exception {
- MockitoAnnotations.initMocks(this);
- cache = new ModificationCache();
- Mockito.doReturn(cache).when(writeContext).getModificationCache();
- Mockito.doReturn(mappingContext).when(writeContext).getMappingContext();
- setUp();
- }
-
- /**
- * Optional setup for subclasses. Invoked after parent initialization.
- */
- protected void setUp() throws Exception {
- }
-}
diff --git a/vpp-common/vpp-translate-utils/asciidoc/Readme.adoc b/vpp-common/vpp-translate-utils/asciidoc/Readme.adoc
deleted file mode 100644
index 1aaaea181..000000000
--- a/vpp-common/vpp-translate-utils/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= Honeycomb. VPP translation layer utils
-
-Provides utility classes useful in translation layer implementation for the VPP. \ No newline at end of file
diff --git a/vpp-common/vpp-translate-utils/pom.xml b/vpp-common/vpp-translate-utils/pom.xml
deleted file mode 100644
index 85994feb3..000000000
--- a/vpp-common/vpp-translate-utils/pom.xml
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-impl-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../../vpp-common/vpp-impl-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>vpp-translate-utils</artifactId>
- <name>${project.artifactId}</name>
- <version>1.16.12-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <properties>
- <commons.codec.version>1.9</commons.codec.version>
- <system.rules.version>1.16.0</system.rules.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>translate-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>naming-context-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.vpp</groupId>
- <artifactId>jvpp-registry</artifactId>
- </dependency>
- <dependency>
- <groupId>io.fd.vpp</groupId>
- <artifactId>jvpp-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-inet-types-2013-07-15</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-interfaces</artifactId>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb</groupId>
- <artifactId>data-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>${commons.codec.version}</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.skinny-framework</groupId>
- <artifactId>skinny-logback</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.github.stefanbirkner</groupId>
- <artifactId>system-rules</artifactId>
- <version>${system.rules.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/AbstractInterfaceTypeCustomizer.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/AbstractInterfaceTypeCustomizer.java
deleted file mode 100644
index faf9be5d8..000000000
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/AbstractInterfaceTypeCustomizer.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.translate.vpp.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.translate.spi.write.WriterCustomizer;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-/**
- * Validation WriteCustomizers for Interface subnodes.
- * Validates the type of interface.
- */
-public abstract class AbstractInterfaceTypeCustomizer<D extends DataObject>
- extends FutureJVppCustomizer implements WriterCustomizer<D> {
-
- protected AbstractInterfaceTypeCustomizer(final FutureJVppCore futureJVppCore) {
- super(futureJVppCore);
- }
-
- private void checkProperInterfaceType(@Nonnull final WriteContext writeContext,
- @Nonnull final InstanceIdentifier<D> id) {
- final InstanceIdentifier<Interface> ifcTypeFromIid = id.firstIdentifierOf(Interface.class);
- checkArgument(ifcTypeFromIid != null, "Instance identifier does not contain {} type", Interface.class);
- checkArgument(id.firstKeyOf(Interface.class) != null, "Instance identifier does not contain keyed {} type",
- Interface.class);
- final Optional<Interface> interfaceConfig = writeContext.readAfter(ifcTypeFromIid);
- checkState(interfaceConfig.isPresent(),
- "Unable to get Interface configuration for an interface: %s currently being updated", ifcTypeFromIid);
-
- IllegalInterfaceTypeException
- .checkInterfaceType(interfaceConfig.get(), getExpectedInterfaceType());
- }
-
- protected abstract Class<? extends InterfaceType> getExpectedInterfaceType();
-
- /**
- * Validate expected interface type
- */
- @Override
- public final void writeCurrentAttributes(@Nonnull final InstanceIdentifier<D> id, @Nonnull final D dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- checkProperInterfaceType(writeContext, id);
- writeInterface(id, dataAfter, writeContext);
- }
-
- protected abstract void writeInterface(final InstanceIdentifier<D> id, final D dataAfter,
- final WriteContext writeContext)
- throws WriteFailedException;
-
- // Validation for update and delete is not necessary
-
- /**
- * Indicates unexpected interface type
- */
- protected static final class IllegalInterfaceTypeException extends IllegalArgumentException {
-
- private IllegalInterfaceTypeException(final String msg) {
- super(msg);
- }
-
- /**
- * Check the type of interface equals expected type
- *
- * @throws IllegalInterfaceTypeException if type of interface is null or not expected
- */
- static void checkInterfaceType(@Nonnull final Interface ifc,
- @Nonnull final Class<? extends InterfaceType> expectedType) {
- if (ifc.getType() == null || !expectedType.equals(ifc.getType())) {
- throw new IllegalInterfaceTypeException(String.format(
- "Unexpected interface type: %s for interface: %s. Expected interface is: %s", ifc.getType(),
- ifc.getName(), expectedType));
- }
- }
-
- }
-}
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
deleted file mode 100644
index bfcb41e3c..000000000
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/AddressTranslator.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-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.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-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.Ipv6Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
-
-/**
- * Aggregation trait providing logic for converting address based data
- */
-public interface AddressTranslator extends Ipv4Translator, Ipv6Translator, MacTranslator {
-
- default byte[] ipAddressToArray(IpAddress address) {
- checkNotNull(address, "Cannot resolve null adddress");
-
- if (isIpv6(address)) {
- return ipv6AddressNoZoneToArray(new Ipv6AddressNoZone(address.getIpv6Address()));
- } else {
- return ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(address.getIpv4Address()));
- }
- }
-
-
- /**
- * Converts {@link IpAddress} to array representing {@link Ipv4Address} or {@link Ipv6Address}
- */
- default byte[] ipAddressToArray(boolean isIpv6, @Nonnull IpAddress address) {
- checkNotNull(address, "Cannot convert null Address");
-
- if (isIpv6) {
- return ipv6AddressNoZoneToArray(new Ipv6AddressNoZone(address.getIpv6Address()));
- } else {
- return ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(address.getIpv4Address()));
- }
- }
-
- /**
- * Converts array bytes to {@link IpAddress}.
- */
- @Nonnull
- default IpAddress arrayToIpAddress(boolean isIpv6, byte[] ip) {
- if (isIpv6) {
- return new IpAddress(arrayToIpv6AddressNoZone(ip));
- } else {
- return new IpAddress(arrayToIpv4AddressNoZone(ip));
- }
- }
-
- /**
- * 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/ByteDataTranslator.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/ByteDataTranslator.java
deleted file mode 100644
index b7df219aa..000000000
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/ByteDataTranslator.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-/**
- * Trait providing logic for working with binary-based data
- */
-public interface ByteDataTranslator {
-
- /**
- * Returns 0 if argument is null or false, 1 otherwise.
- *
- * @param value Boolean value to be converted
- * @return byte value equal to 0 or 1
- */
- default byte booleanToByte(@Nullable final Boolean value) {
- return value != null && value
- ? (byte) 1
- : (byte) 0;
- }
-
- /**
- * Returns Boolean.TRUE if argument is 0, Boolean.FALSE otherwise.
- *
- * @param value byte value to be converted
- * @return Boolean value
- * @throws IllegalArgumentException if argument is neither 0 nor 1
- */
- @Nonnull
- default Boolean byteToBoolean(final byte value) {
- if (value == 0) {
- return Boolean.FALSE;
- } else if (value == 1) {
- return Boolean.TRUE;
- }
- throw new IllegalArgumentException(String.format("0 or 1 was expected but was %d", value));
- }
-
- /**
- * Reverses bytes in the byte array
- *
- * @param bytes input array
- * @return reversed array
- */
- default byte[] reverseBytes(final byte[] bytes) {
- final byte[] reversed = new byte[bytes.length];
- int i = 1;
- for (byte aByte : bytes) {
- reversed[bytes.length - i++] = aByte;
- }
-
- return reversed;
- }
-
- /**
- * Return (interned) string from byte array while removing \u0000. Strings represented as fixed length byte[] from
- * vpp contain \u0000.
- */
- default String toString(final byte[] cString) {
- return new String(cString).replaceAll("\\u0000", "").intern();
- }
-}
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/FutureJVppCustomizer.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/FutureJVppCustomizer.java
deleted file mode 100644
index 2a43ab503..000000000
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/FutureJVppCustomizer.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-/**
- * Abstract utility to hold the vppApi reference.
- */
-@Beta
-public abstract class FutureJVppCustomizer {
-
- private final FutureJVppCore futureJVppCore;
-
- public FutureJVppCustomizer(@Nonnull final FutureJVppCore futureJVppCore) {
- this.futureJVppCore = Preconditions.checkNotNull(futureJVppCore, "futureJVppCore should not be null");
- }
-
- /**
- * Get vppApi reference
- *
- * @return vppApi reference
- */
- public FutureJVppCore getFutureJVpp() {
- return futureJVppCore;
- }
-}
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/Ipv4AddressRange.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/Ipv4AddressRange.java
deleted file mode 100644
index 7528c5464..000000000
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/Ipv4AddressRange.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import java.util.Objects;
-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.Ipv4Prefix;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * IPv4 address range representation.
- */
-public final class Ipv4AddressRange {
-
- private static final Logger LOG = LoggerFactory.getLogger(Ipv4AddressRange.class);
-
- private final Ipv4AddressNoZone start;
- private final Ipv4AddressNoZone end;
-
- private Ipv4AddressRange(
- @Nonnull final Ipv4AddressNoZone start,
- @Nonnull final Ipv4AddressNoZone end) {
- this.start = start;
- this.end = end;
- }
-
- public Ipv4AddressNoZone getStart() {
- return start;
- }
-
- public Ipv4AddressNoZone getEnd() {
- return end;
- }
-
- @Override
- public boolean equals(final Object other) {
- if (this == other) {
- return true;
- }
- if (other == null || getClass() != other.getClass()) {
- return false;
- }
- final Ipv4AddressRange that = (Ipv4AddressRange) other;
- return Objects.equals(start, that.start)
- && Objects.equals(end, that.end);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(start, end);
- }
-
- @Override
- public String toString() {
- return "Ipv4AddressRange{"
- + "start=" + start
- + ", end=" + end
- + '}';
- }
-
- /**
- * Create address range from prefix.
- */
- public static Ipv4AddressRange fromPrefix(@Nonnull final Ipv4Prefix prefix) {
- final String addressString = prefix.getValue().split("/")[0];
- byte prefixLength = Ipv4Translator.INSTANCE.extractPrefix(prefix);
-
- if (prefixLength == 32) {
- // 32 Prefix can be handled instantly
- return new Ipv4AddressRange(new Ipv4AddressNoZone(addressString), new Ipv4AddressNoZone(addressString));
- }
-
- final byte[] prefixAddrBytes = Ipv4Translator.INSTANCE.ipv4AddressNoZoneToArray(addressString);
- final byte[] prefixAddrBytes0 = new byte[prefixAddrBytes.length];
- final byte[] prefixAddrBytesF = new byte[prefixAddrBytes.length];
-
- byte index = 0;
- while (prefixLength >= 8) {
- prefixAddrBytes0[index] = prefixAddrBytes[index];
- prefixAddrBytesF[index] = prefixAddrBytes[index];
- index++;
- prefixLength -= 8;
- }
-
- // Take care of the rest
- if (prefixLength != 0) {
- final int mask0 = (byte) (Math.pow(2, prefixLength) - 1) << (8 - prefixLength);
- prefixAddrBytes0[index] = (byte) (prefixAddrBytes[index] & mask0);
-
- final int maskF = (byte) (Math.pow(2, 8 - prefixLength) - 1);
- prefixAddrBytesF[index] = (byte) (prefixAddrBytes[index] | maskF);
-
- index++;
- }
-
- for (int i = index; i < 4; i++) {
- prefixAddrBytes0[i] = 0;
- prefixAddrBytesF[i] = (byte) 255;
- }
-
- return new Ipv4AddressRange(
- Ipv4Translator.INSTANCE.arrayToIpv4AddressNoZoneReversed(prefixAddrBytes0),
- Ipv4Translator.INSTANCE.arrayToIpv4AddressNoZoneReversed(prefixAddrBytesF));
- }
-}
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/Ipv4Translator.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/Ipv4Translator.java
deleted file mode 100644
index b5f93dfba..000000000
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/Ipv4Translator.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.net.InetAddresses;
-import java.net.UnknownHostException;
-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.Ipv4Prefix;
-
-/**
- * Trait providing logic for translation of ipv4-related data.
- */
-public interface Ipv4Translator extends ByteDataTranslator {
-
- /**
- * Make available also from static context.
- */
- Ipv4Translator INSTANCE = new Ipv4Translator() {};
-
- /**
- * Creates address array from address part of {@link Ipv4Prefix}
- */
- default byte[] ipv4AddressPrefixToArray(@Nonnull final Ipv4Prefix ipv4Prefix) {
- checkNotNull(ipv4Prefix, "Cannot convert null prefix");
-
- byte[] retval = new byte[4];
- String[] address = ipv4Prefix.getValue().substring(0, ipv4Prefix.getValue().indexOf('/')).split("\\.");
-
- for (int d = 0; d < 4; d++) {
- retval[d] = (byte) (Short.parseShort(address[d]) & 0xff);
- }
- return retval;
- }
-
- /**
- * Extracts {@link Ipv4Prefix} prefix
- */
- default byte extractPrefix(Ipv4Prefix data) {
- checkNotNull(data, "Cannot extract from null");
-
- return Byte.valueOf(data.getValue().substring(data.getValue().indexOf('/') + 1));
- }
-
- /**
- * Converts byte array to {@link Ipv4Prefix} with specified prefixLength
- */
- default Ipv4Prefix arrayToIpv4Prefix(final byte[] address, byte prefixLength) {
- Ipv4AddressNoZone addressPart = arrayToIpv4AddressNoZone(address);
-
- return new Ipv4Prefix(addressPart.getValue().concat("/").concat(String.valueOf(prefixLength)));
- }
-
- /**
- * Parse byte array returned by VPP representing an Ipv4 address. Vpp returns IP byte arrays in reversed order.
- *
- * @return Ipv4AddressNoZone containing string representation of IPv4 address constructed from submitted bytes. No
- * change in order.
- */
- @Nonnull
- default Ipv4AddressNoZone arrayToIpv4AddressNoZone(@Nonnull byte[] ip) {
- // VPP sends ipv4 in a 16 byte array
- if (ip.length == 16) {
- ip = Arrays.copyOfRange(ip, 0, 4);
- }
- try {
- // Not reversing the byte array here!! because the IP coming from VPP is in reversed byte order
- // compared to byte order it was submitted
- return new Ipv4AddressNoZone(InetAddresses.toAddrString(InetAddresses.fromLittleEndianByteArray(ip)));
- } catch (UnknownHostException e) {
- throw new IllegalArgumentException("Unable to parse ipv4", e);
- }
- }
-
- /**
- * Parse byte array returned by VPP representing an Ipv4 address. Vpp returns IP byte arrays in reversed order.
- *
- * @return Ipv4AddressNoZone containing string representation of IPv4 address constructed from submitted bytes. No
- * change in order.
- */
- @Nonnull
- default Ipv4AddressNoZone arrayToIpv4AddressNoZoneReversed(@Nonnull byte[] ip) {
- // VPP sends ipv4 in a 16 byte array
-
- if (ip.length == 16) {
- ip = Arrays.copyOfRange(ip, 0, 4);
- }
-
- ip = reverseBytes(ip);
-
- try {
- // Not reversing the byte array here!! because the IP coming from VPP is in reversed byte order
- // compared to byte order it was submitted
- return new Ipv4AddressNoZone(InetAddresses.toAddrString(InetAddresses.fromLittleEndianByteArray(ip)));
- } catch (UnknownHostException e) {
- throw new IllegalArgumentException("Unable to parse ipv4", e);
- }
- }
-
-
- /**
- * Transform Ipv4 address to a byte array acceptable by VPP. VPP expects incoming byte array to be in the same order
- * as the address.
- *
- * @return byte array with address bytes
- */
- default byte[] ipv4AddressNoZoneToArray(final Ipv4AddressNoZone ipv4Addr) {
- return ipv4AddressNoZoneToArray(ipv4Addr.getValue());
- }
-
- default byte[] ipv4AddressNoZoneToArray(final String ipv4Addr) {
- byte[] retval = new byte[4];
- String[] dots = ipv4Addr.split("\\.");
-
- for (int d = 0; d < 4; d++) {
- retval[d] = (byte) (Short.parseShort(dots[d]) & 0xff);
- }
- return retval;
- }
-}
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/Ipv6Translator.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/Ipv6Translator.java
deleted file mode 100644
index 6197b38ef..000000000
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/Ipv6Translator.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import com.google.common.net.InetAddresses;
-import java.net.UnknownHostException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-import org.apache.commons.lang3.StringUtils;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
-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.inet.types.rev130715.Ipv6Prefix;
-
-/**
- * Trait providing logic for translation of ipv6-related data
- */
-public interface Ipv6Translator extends ByteDataTranslator {
-
- /**
- * Transform Ipv6 address to a byte array acceptable by VPP. VPP expects incoming byte array to be in the same order
- * as the address.
- *
- * @return byte array with address bytes
- */
- default byte[] ipv6AddressNoZoneToArray(@Nonnull final Ipv6AddressNoZone ipv6Addr) {
- byte[] retval = new byte[16];
-
- //splits address and add ommited zeros for easier parsing
- List<String> segments = Arrays.asList(ipv6Addr.getValue().split(":"))
- .stream()
- .map(segment -> StringUtils.repeat('0', 4 - segment.length()) + segment)
- .collect(Collectors.toList());
-
- byte index = 0;
- for (String segment : segments) {
-
- String firstPart = segment.substring(0, 2);
- String secondPart = segment.substring(2);
-
- //first part should be ommited
- if ("00".equals(firstPart)) {
- index++;
- } else {
- retval[index++] = ((byte) Short.parseShort(firstPart, 16));
- }
-
- retval[index++] = ((byte) Short.parseShort(secondPart, 16));
- }
-
- return retval;
- }
-
- /**
- * Creates address array from address part of {@link Ipv6Prefix}
- */
- default byte[] ipv6AddressPrefixToArray(@Nonnull final Ipv6Prefix ipv4Prefix) {
- checkNotNull(ipv4Prefix, "Cannot convert null prefix");
-
- return ipv6AddressNoZoneToArray(new Ipv6AddressNoZone(
- new Ipv6Address(ipv4Prefix.getValue().substring(0, ipv4Prefix.getValue().indexOf('/')))));
- }
-
- /**
- * Extracts {@link Ipv6Prefix} prefix
- */
- default byte extractPrefix(Ipv6Prefix data) {
- checkNotNull(data, "Cannot extract from null");
-
- return Byte.valueOf(data.getValue().substring(data.getValue().indexOf('/') + 1));
- }
-
- /**
- * Converts byte array to {@link Ipv6Prefix} with specified prefixLength
- */
- default Ipv6Prefix arrayToIpv6Prefix(final byte[] address, byte prefixLength) {
- Ipv6AddressNoZone addressPart = arrayToIpv6AddressNoZone(address);
-
- return new Ipv6Prefix(addressPart.getValue().concat("/").concat(String.valueOf(prefixLength)));
- }
-
- /**
- * Parse byte array returned by VPP representing an Ipv6 address. Vpp returns IP byte arrays in reversed order.
- *
- * @return Ipv46ddressNoZone containing string representation of IPv6 address constructed from submitted bytes. No
- * change in order.
- */
- @Nonnull
- default Ipv6AddressNoZone arrayToIpv6AddressNoZone(@Nonnull byte[] ip) {
- checkArgument(ip.length == 16, "Illegal array length");
-
- try {
- return new Ipv6AddressNoZone(InetAddresses.toAddrString(InetAddresses.fromLittleEndianByteArray(ip)));
- } catch (UnknownHostException e) {
- throw new IllegalArgumentException("Unable to parse ipv6", e);
- }
- }
-
- /**
- * Detects whether {@code IpAddress} is ipv6
- */
- default boolean isIpv6(IpAddress address) {
- checkNotNull(address, "Address cannot be null");
-
- checkState(!(address.getIpv4Address() == null && address.getIpv6Address() == null), "Invalid address");
- return address.getIpv6Address() != null;
- }
-
- /**
- * Parse byte array returned by VPP representing an Ipv6 address. Vpp returns IP byte arrays in natural order.
- *
- * @return Ipv46ddressNoZone containing string representation of IPv6 address constructed from submitted bytes. No
- * change in order.
- */
- @Nonnull
- default Ipv6AddressNoZone arrayToIpv6AddressNoZoneReversed(@Nonnull byte[] ip) {
- checkArgument(ip.length == 16, "Illegal array length");
-
- ip = reverseBytes(ip);
-
- try {
- return new Ipv6AddressNoZone(InetAddresses.toAddrString(InetAddresses.fromLittleEndianByteArray(ip)));
- } catch (UnknownHostException e) {
- throw new IllegalArgumentException("Unable to parse ipv6", e);
- }
- }
-
-
- /**
- * Detects whether {@code IpPrefix} is ipv6
- */
- default boolean isIpv6(IpPrefix address) {
- checkNotNull(address, "Address cannot be null");
- checkState(!(address.getIpv4Prefix() == null && address.getIpv6Prefix() == null), "Invalid address");
- return address.getIpv6Prefix() != null;
- }
-}
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/JvppReplyConsumer.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/JvppReplyConsumer.java
deleted file mode 100644
index 9e85c5d8b..000000000
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/JvppReplyConsumer.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.dto.JVppReply;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnegative;
-import javax.annotation.Nonnull;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * Trait providing logic for consuming reply's to jvpp api calls
- */
-public interface JvppReplyConsumer {
-
- int DEFAULT_TIMEOUT_IN_SECONDS = 5;
-
- /**
- * Consumes reply for jvpp call representing any write operation
- * Should be used in case of calls where it's not clear which write crud operation respective
- * call represents, for ex. setRouting
- */
- default <REP extends JVppReply<?>> REP getReplyForWrite(@Nonnull Future<REP> future,
- @Nonnull final InstanceIdentifier<?> replyType)
- throws WriteFailedException {
- return getReplyForWrite(future, replyType, DEFAULT_TIMEOUT_IN_SECONDS);
- }
-
- /**
- * Consumes reply for jvpp call representing any write operation
- * Should be used in case of calls where it's not clear which write crud operation respective
- * call represents, for ex. setRouting
- */
- default <REP extends JVppReply<?>> REP getReplyForWrite(@Nonnull Future<REP> future,
- @Nonnull final InstanceIdentifier<?> replyType,
- @Nonnegative final int timeoutInSeconds)
- throws WriteFailedException {
- try {
- return getReply(future, timeoutInSeconds);
- } catch (TimeoutException e) {
- throw new WriteTimeoutException(replyType, e);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException(replyType, e);
- }
-
- }
-
- /**
- * Consumes reply for jvpp call representing create operation
- */
- default <REP extends JVppReply<?>> REP getReplyForCreate(@Nonnull Future<REP> future,
- @Nonnull final InstanceIdentifier<?> replyType,
- @Nonnull final DataObject data)
- throws WriteFailedException {
- return getReplyForCreate(future, replyType, data, DEFAULT_TIMEOUT_IN_SECONDS);
- }
-
- /**
- * Consumes reply for jvpp call representing create operation
- */
- default <REP extends JVppReply<?>> REP getReplyForCreate(@Nonnull Future<REP> future,
- @Nonnull final InstanceIdentifier<?> replyType,
- @Nonnull final DataObject data,
- @Nonnegative final int timeoutInSeconds)
- throws WriteFailedException {
- try {
- return getReply(future, timeoutInSeconds);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(replyType, data, e);
- } catch (TimeoutException e) {
- throw new WriteTimeoutException(replyType, e);
- }
- }
-
- /**
- * Consumes reply for jvpp call representing update operation
- */
- default <REP extends JVppReply<?>> REP getReplyForUpdate(@Nonnull Future<REP> future,
- @Nonnull final InstanceIdentifier<?> replyType,
- @Nonnull final DataObject dataBefore,
- @Nonnull final DataObject dataAfter)
- throws WriteFailedException {
- return getReplyForUpdate(future, replyType, dataBefore, dataAfter, DEFAULT_TIMEOUT_IN_SECONDS);
- }
-
- /**
- * Consumes reply for jvpp call representing update operation
- */
- default <REP extends JVppReply<?>> REP getReplyForUpdate(@Nonnull Future<REP> future,
- @Nonnull final InstanceIdentifier<?> replyType,
- @Nonnull final DataObject dataBefore,
- @Nonnull final DataObject dataAfter,
- @Nonnegative final int timeoutInSeconds)
- throws WriteFailedException {
- try {
- return getReply(future, timeoutInSeconds);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.UpdateFailedException(replyType, dataBefore, dataAfter, e);
- } catch (TimeoutException e) {
- throw new WriteTimeoutException(replyType, e);
- }
- }
-
- /**
- * Consumes reply for jvpp call representing delete operation
- */
- default <REP extends JVppReply<?>> REP getReplyForDelete(@Nonnull Future<REP> future,
- @Nonnull final InstanceIdentifier<?> replyType)
- throws WriteFailedException {
- return getReplyForDelete(future, replyType, DEFAULT_TIMEOUT_IN_SECONDS);
- }
-
- /**
- * Consumes reply for jvpp call representing delete operation
- */
- default <REP extends JVppReply<?>> REP getReplyForDelete(@Nonnull Future<REP> future,
- @Nonnull final InstanceIdentifier<?> replyType,
- @Nonnegative final int timeoutInSeconds)
- throws WriteFailedException {
- try {
- return getReply(future, timeoutInSeconds);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.DeleteFailedException(replyType, e);
- } catch (TimeoutException e) {
- throw new WriteTimeoutException(replyType, e);
- }
- }
-
- default <REP extends JVppReply<?>> REP getReplyForRead(@Nonnull Future<REP> future,
- @Nonnull final InstanceIdentifier<?> replyType)
- throws ReadFailedException {
- return getReplyForRead(future, replyType, DEFAULT_TIMEOUT_IN_SECONDS);
- }
-
- default <REP extends JVppReply<?>> REP getReplyForRead(@Nonnull Future<REP> future,
- @Nonnull final InstanceIdentifier<?> replyType,
- @Nonnegative final int timeoutInSeconds)
- throws ReadFailedException {
- try {
- return getReply(future, timeoutInSeconds);
- } catch (TimeoutException e) {
- throw new ReadTimeoutException(replyType, e);
- } catch (VppBaseCallException e) {
- throw new ReadFailedException(replyType, e);
- }
- }
-
- default <REP extends JVppReply<?>> REP getReply(@Nonnull Future<REP> future)
- throws TimeoutException, VppBaseCallException {
- return getReply(future, DEFAULT_TIMEOUT_IN_SECONDS);
- }
-
- default <REP extends JVppReply<?>> REP getReply(@Nonnull Future<REP> future,
- @Nonnegative final int timeoutInSeconds)
- throws TimeoutException, VppBaseCallException {
- try {
- checkArgument(timeoutInSeconds > 0, "Timeout cannot be < 0");
- return future.get(timeoutInSeconds, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new IllegalStateException("Interrupted", e);
- } catch (ExecutionException e) {
- // Execution exception could generally contains any exception
- // when using exceptions instead of return codes just rethrow it for processing on corresponding place
- if (e instanceof ExecutionException && (e.getCause() instanceof VppBaseCallException)) {
- throw (VppBaseCallException) (e.getCause());
- }
- throw new IllegalStateException(e);
- }
- }
-}
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
deleted file mode 100644
index 14cc28909..000000000
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/MacTranslator.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-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;
-import org.apache.commons.codec.DecoderException;
-import org.apache.commons.codec.binary.Hex;
-
-/**
- * Trait providing logic for translation of MAC address data
- */
-public interface MacTranslator {
-
- Splitter COLON_SPLITTER = Splitter.on(':');
-
- /**
- * Parse string represented mac address (using ":" as separator) into a byte array
- */
- @Nonnull
- default byte[] parseMac(@Nonnull final String macAddress) {
- final List<String> parts = COLON_SPLITTER.splitToList(macAddress);
- checkArgument(parts.size() == 6, "Mac address is expected to have 6 parts but was: %s", macAddress);
- return parseMacLikeString(parts);
- }
-
- default byte[] parseMacLikeString(final List<String> strings) {
- return strings.stream().limit(6).map(this::parseHexByte).collect(
- () -> new byte[strings.size()],
- new BiConsumer<byte[], Byte>() {
-
- private int i = -1;
-
- @Override
- public void accept(final byte[] bytes, final Byte aByte) {
- bytes[++i] = aByte;
- }
- },
- (bytes, bytes2) -> {
- throw new UnsupportedOperationException("Parallel collect not supported");
- });
- }
-
- /**
- * Converts byte array to address string ,not separated with ":"
- */
- default String byteArrayToMacUnseparated(byte[] 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");
-
- String unseparatedAddress = Hex.encodeHexString(Arrays.copyOf(address, 6));
- String separated = "";
-
- for (int i = 0; i < unseparatedAddress.length(); i = i + 2) {
- if (i == (unseparatedAddress.length() - 2)) {
- separated = separated + unseparatedAddress.substring(0 + i, 2 + i);
- } else {
- separated = separated + unseparatedAddress.substring(0 + i, 2 + i) + ":";
- }
- }
-
- return separated;
- }
-
- /**
- * Converts MAC string to byte array
- */
- default byte[] macToByteArray(String mac) {
- checkNotNull(mac, "MAC cannot be null");
-
- mac = mac.replace(":", "");
-
- try {
- return Hex.decodeHex(mac.toCharArray());
- } catch (DecoderException e) {
- throw new IllegalArgumentException("Unable to convert mac", e);
- }
- }
-
- default byte parseHexByte(final String aByte) {
- return (byte) Integer.parseInt(aByte, 16);
- }
-}
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/NamingContext.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/NamingContext.java
deleted file mode 100644
index 467ac5161..000000000
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/NamingContext.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * 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.translate.vpp.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.translate.MappingContext;
-import io.fd.honeycomb.translate.util.RWUtils;
-import java.util.stream.Collector;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.Contexts;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.NamingContextKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.naming.context.Mappings;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.naming.context.mappings.Mapping;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.naming.context.mappings.MappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.naming.context.mappings.MappingKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-
-/**
- * Utility adapter on top of {@link MappingContext} storing integer to string mappings according to naming-context yang
- * model.
- */
-public final class NamingContext implements AutoCloseable {
-
- private static final Collector<Mapping, ?, Mapping> SINGLE_ITEM_COLLECTOR = RWUtils.singleItemCollector();
- private final String artificialNamePrefix;
- private final KeyedInstanceIdentifier<org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.NamingContext, NamingContextKey>
- namingContextIid;
-
- /**
- * Create new naming context
- *
- * @param artificialNamePrefix artificial name to be used for items without a name in VPP (or not provided)
- * @param instanceName name of this context instance. Will be used as list item identifier within context
- * data tree
- */
- public NamingContext(@Nonnull final String artificialNamePrefix, @Nonnull final String instanceName) {
- this.artificialNamePrefix = artificialNamePrefix;
- namingContextIid = InstanceIdentifier.create(Contexts.class).child(
- org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.NamingContext.class,
- new NamingContextKey(instanceName));
- }
-
- /**
- * Retrieve name for mapping stored provided mappingContext instance. If not present, artificial name will be
- * generated.
- *
- * @param index index of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- * @return name mapped to provided index
- */
- @Nonnull
- public synchronized String getName(final int index, @Nonnull final MappingContext mappingContext) {
- if (!containsName(index, mappingContext)) {
- final String artificialName = getArtificialName(index);
- addName(index, artificialName, mappingContext);
- }
-
- final Optional<Mappings> read = mappingContext.read(namingContextIid.child(Mappings.class));
- checkState(read.isPresent(), "Mapping for index: %s is not present. But should be", index);
-
- return read.get().getMapping().stream()
- .filter(mapping -> mapping.getIndex().equals(index))
- .collect(SINGLE_ITEM_COLLECTOR).getName();
- }
-
- /**
- * Retrieve name for mapping stored provided mappingContext instance. if present
- *
- * @param index index of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- * @return name mapped to provided index
- */
- @Nonnull
- public synchronized Optional<String> getNameIfPresent(final int index,
- @Nonnull final MappingContext mappingContext) {
- final Optional<Mappings> read = mappingContext.read(namingContextIid.child(Mappings.class));
-
- return read.isPresent()
- ? Optional.of(read.get().getMapping().stream()
- .filter(mapping -> mapping.getIndex().equals(index))
- .collect(SINGLE_ITEM_COLLECTOR)
- .getName())
- : Optional.absent();
- }
-
- /**
- * Check whether mapping is present for index.
- *
- * @param index index of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- * @return true if present, false otherwise
- */
- public synchronized boolean containsName(final int index, @Nonnull final MappingContext mappingContext) {
- final Optional<Mappings> read = mappingContext.read(namingContextIid.child(Mappings.class));
- return read.isPresent()
- ? read.get().getMapping().stream().anyMatch(mapping -> mapping.getIndex().equals(index))
- : false;
- }
-
-
- /**
- * Add mapping to current context
- *
- * @param index index of a mapped item
- * @param name name of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- */
- public synchronized void addName(final int index, final String name, final MappingContext mappingContext) {
- final KeyedInstanceIdentifier<Mapping, MappingKey> mappingIid = getMappingIid(name);
- mappingContext.put(mappingIid, new MappingBuilder().setIndex(index).setName(name).build());
- }
-
- private KeyedInstanceIdentifier<Mapping, MappingKey> getMappingIid(final String name) {
- return namingContextIid.child(Mappings.class).child(Mapping.class, new MappingKey(name));
- }
-
- /**
- * Remove mapping from current context
- *
- * @param name name of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- */
- public synchronized void removeName(final String name, final MappingContext mappingContext) {
- mappingContext.delete(getMappingIid(name));
- }
-
- /**
- * Returns index value associated with the given name.
- *
- * @param name the name whose associated index value is to be returned
- * @param mappingContext mapping context providing context data for current transaction
- * @return integer index value matching supplied name
- * @throws IllegalArgumentException if name was not found
- */
- public synchronized int getIndex(final String name, final MappingContext mappingContext) {
- final Optional<Mapping> read = mappingContext.read(getMappingIid(name));
- checkArgument(read.isPresent(), "No mapping stored for name: %s", name);
- return read.get().getIndex();
-
- }
-
- /**
- * Check whether mapping is present for name.
- *
- * @param name name of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- * @return true if present, false otherwise
- */
- public synchronized boolean containsIndex(final String name, final MappingContext mappingContext) {
- return mappingContext.read(getMappingIid(name)).isPresent();
- }
-
- private String getArtificialName(final int index) {
- return artificialNamePrefix + index;
- }
-
- @Override
- public void close() throws Exception {
- /// Not removing the mapping from backing storage
- }
-}
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/ReadTimeoutException.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/ReadTimeoutException.java
deleted file mode 100644
index cacca39f5..000000000
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/ReadTimeoutException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import com.google.common.annotations.Beta;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * Thrown when read method invocation times out.
- */
-@Beta
-public class ReadTimeoutException extends ReadFailedException {
-
- public ReadTimeoutException(final InstanceIdentifier<?> id, final Throwable cause) {
- super(id, cause);
- }
-
-}
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/TagRewriteOperation.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/TagRewriteOperation.java
deleted file mode 100644
index 0bfd28587..000000000
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/TagRewriteOperation.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import com.google.common.base.Preconditions;
-import com.google.common.primitives.UnsignedBytes;
-import javax.annotation.Nonnegative;
-import javax.annotation.Nullable;
-
-/**
- * Defines vlan tag rewrite config options for VPP.
- * <p/>
- * TODO HONEYCOMB-184 corresponding enum (defined in l2_vtr.h) should be defined in vpe.api
- * (does vpp's IDL support enum type definition?)
- * which would allow to generate this class in jvpp
- */
-public enum TagRewriteOperation {
- disabled(0),
- push_1(0),
- push_2(0),
- pop_1(1),
- pop_2(2),
- translate_1_to_1(1),
- translate_1_to_2(1),
- translate_2_to_1(2),
- translate_2_to_2(2);
-
- private static final int MAX_INDEX = 3;
- private static TagRewriteOperation[][] translation = new TagRewriteOperation[][]{
- {disabled, push_1, push_2},
- {pop_1, translate_1_to_1, translate_1_to_2},
- {pop_2, translate_2_to_1, translate_2_to_2}
- };
- private final int code;
- private final byte popTags;
-
- TagRewriteOperation(final int popTags) {
- this.code = this.ordinal();
- this.popTags = UnsignedBytes.checkedCast(popTags);
- }
-
- /**
- * Returns VPP tag rewrite operation for given number of tags to pop and tags to push.
- *
- * @param toPop number of tags to pop (0..2)
- * @param toPush number of tags to push (0..2)
- * @return vpp tag rewrite operation for given input parameters
- */
- public static TagRewriteOperation get(@Nonnegative final int toPop, @Nonnegative final int toPush) {
- Preconditions.checkElementIndex(toPop, MAX_INDEX, "Illegal number of tags to pop");
- Preconditions.checkElementIndex(toPush, MAX_INDEX, "Illegal number of tags to push");
- return translation[toPop][toPush];
- }
-
- /**
- * Returns VPP tag rewrite operation for given operation code.
- *
- * @param code VPP tag rewrite operation code
- * @return vpp tag rewrite operation for given input parameter
- */
- @Nullable
- public static TagRewriteOperation get(@Nonnegative final int code) {
- for (TagRewriteOperation operation : TagRewriteOperation.values()) {
- if (code == operation.code) {
- return operation;
- }
- }
- return null;
- }
-
- public byte getPopTags() {
- return popTags;
- }
-}
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/VppStatusListener.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/VppStatusListener.java
deleted file mode 100644
index 1ea196651..000000000
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/VppStatusListener.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import io.fd.honeycomb.translate.util.read.KeepaliveReaderWrapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Listens to vpp status changes. Restarts honeycomb if vpp is down.
- */
-public final class VppStatusListener implements KeepaliveReaderWrapper.KeepaliveFailureListener {
-
- /**
- * Value picked up by honeycomb start script, tigers honeycomb restart when returned by the java process
- */
- public static final int RESTART_ERROR_CODE = 100;
- private static final Logger LOG = LoggerFactory.getLogger(VppStatusListener.class);
-
- private volatile boolean down;
-
- public boolean isDown() {
- return down;
- }
-
- @Override
- public void onKeepaliveFailure() {
- LOG.error("Keepalive failed. VPP is probably DOWN! Restarting Honeycomb");
- this.down = true;
- System.exit(RESTART_ERROR_CODE);
- }
-}
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/WriteTimeoutException.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/WriteTimeoutException.java
deleted file mode 100644
index 7d5bac3d0..000000000
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/WriteTimeoutException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import com.google.common.annotations.Beta;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * Thrown when write method invocation times out.
- */
-@Beta
-public class WriteTimeoutException extends WriteFailedException {
-
- public WriteTimeoutException(final InstanceIdentifier<?> id, final Throwable cause) {
- super(id, cause);
- }
-
-}
diff --git a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/AddressTranslatorTest.java b/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/AddressTranslatorTest.java
deleted file mode 100644
index 71a41dd5e..000000000
--- a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/AddressTranslatorTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-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.inet.types.rev130715.Ipv6Address;
-
-public class AddressTranslatorTest implements AddressTranslator {
-
- @Test
- public void testRevertAddress() {
- assertEquals("1.2.168.192",
- reverseAddress(new IpAddress(new Ipv4Address("192.168.2.1"))).getIpv4Address().getValue());
- assertEquals("3473:7003:2e8a::a385:b80d:120",
- reverseAddress(new IpAddress(new Ipv6Address("2001:db8:85a3:0:0:8a2e:370:7334"))).getIpv6Address()
- .getValue());
- }
-} \ No newline at end of file
diff --git a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/ByteDataTranslatorTest.java b/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/ByteDataTranslatorTest.java
deleted file mode 100644
index 3462b4cf8..000000000
--- a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/ByteDataTranslatorTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-public class ByteDataTranslatorTest implements ByteDataTranslator {
-
- @Test
- public void testBooleanToByte() {
- assertEquals(0, booleanToByte(null));
- assertEquals(0, booleanToByte(false));
- assertEquals(1, booleanToByte(true));
- }
-
- @Test
- public void testByteToBoolean() {
- assertEquals(Boolean.FALSE, byteToBoolean((byte) 0));
- assertEquals(Boolean.TRUE, byteToBoolean((byte) 1));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testByteToBooleanFailed() {
- byteToBoolean((byte) 123);
- }
-
- @Test
- public void testToString() {
- final byte[] expected = "test".getBytes();
- final byte[] cString = new byte[expected.length + 10];
- System.arraycopy(expected, 0, cString, 0, expected.length);
- final String jString = toString(cString);
- assertArrayEquals(expected, jString.getBytes());
- }
-} \ No newline at end of file
diff --git a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/Ipv4AddressRangeTest.java b/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/Ipv4AddressRangeTest.java
deleted file mode 100644
index aef81fce6..000000000
--- a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/Ipv4AddressRangeTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Arrays;
-import java.util.Collection;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
-
-@RunWith(Parameterized.class)
-public class Ipv4AddressRangeTest {
-
- private final String prefix;
- private final String start;
- private final String end;
-
- public Ipv4AddressRangeTest(String prefix, String start, String end) {
- this.prefix = prefix;
- this.start = start;
- this.end = end;
- }
-
- @Parameterized.Parameters
- public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][] {
- { "1.1.1.1/0", "0.0.0.0", "255.255.255.255"},
- { "1.1.1.1/32", "1.1.1.1", "1.1.1.1"},
- { "192.168.1.5/8", "192.0.0.0", "192.255.255.255"},
- { "192.168.1.5/10", "192.128.0.0", "192.191.255.255"}
- });
- }
-
- @Test
- public void test() throws Exception {
- final Ipv4AddressRange range = Ipv4AddressRange.fromPrefix(new Ipv4Prefix(prefix));
- assertEquals(start, range.getStart().getValue());
- assertEquals(end, range.getEnd().getValue());
- }
-} \ No newline at end of file
diff --git a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/Ipv4TranslatorTest.java b/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/Ipv4TranslatorTest.java
deleted file mode 100644
index 39fc620b2..000000000
--- a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/Ipv4TranslatorTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-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.Ipv4Prefix;
-
-public class Ipv4TranslatorTest implements Ipv4Translator {
-
- @Test
- public void testIpv4NoZone() throws Exception {
- final Ipv4AddressNoZone ipv4Addr = new Ipv4AddressNoZone("192.168.1.1");
- byte[] bytes = ipv4AddressNoZoneToArray(ipv4Addr);
- assertEquals((byte) 192, bytes[0]);
- // Simulating the magic of VPP
- bytes = reverseBytes(bytes);
- final Ipv4AddressNoZone ipv4AddressNoZone = arrayToIpv4AddressNoZone(bytes);
- assertEquals(ipv4Addr, ipv4AddressNoZone);
- }
-
- @Test
- public void testIpv4AddressPrefixToArray() {
- byte[] ip = ipv4AddressPrefixToArray(new Ipv4Prefix("192.168.2.1/24"));
-
- assertEquals("1.2.168.192", arrayToIpv4AddressNoZone(ip).getValue());
- }
-
- @Test
- public void testExtractPrefix() {
- assertEquals(24, extractPrefix(new Ipv4Prefix("192.168.2.1/24")));
- }
-} \ No newline at end of file
diff --git a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/Ipv6TranslatorTest.java b/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/Ipv6TranslatorTest.java
deleted file mode 100644
index 6a5d13613..000000000
--- a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/Ipv6TranslatorTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-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.inet.types.rev130715.Ipv6Prefix;
-
-public class Ipv6TranslatorTest implements Ipv6Translator {
-
- @Test
- public void testIpv6NoZone() {
- final Ipv6AddressNoZone ipv6Addr = new Ipv6AddressNoZone("3ffe:1900:4545:3:200:f8ff:fe21:67cf");
- byte[] bytes = ipv6AddressNoZoneToArray(ipv6Addr);
- assertEquals((byte) 63, bytes[0]);
-
- bytes = reverseBytes(bytes);
- final Ipv6AddressNoZone ivp6AddressNoZone = arrayToIpv6AddressNoZone(bytes);
- assertEquals(ipv6Addr, ivp6AddressNoZone);
- }
-
- @Test
- public void testIpv6AddressPrefixToArray() {
- byte[] ip = ipv6AddressPrefixToArray(new Ipv6Prefix("3ffe:1900:4545:3:200:f8ff:fe21:67cf/48"));
-
- assertEquals("cf67:21fe:fff8:2:300:4545:19:fe3f", arrayToIpv6AddressNoZone(ip).getValue());
- }
-
- @Test
- public void testIpv4AddressPrefixToArray() {
- byte[] ip = ipv6AddressPrefixToArray(new Ipv6Prefix("2001:0db8:0a0b:12f0:0000:0000:0000:0001/128"));
-
- assertEquals("100::f012:b0a:b80d:120", arrayToIpv6AddressNoZone(ip).getValue());
- }
-
- @Test
- public void testExtractPrefix() {
- assertEquals(48, extractPrefix(new Ipv6Prefix("3ffe:1900:4545:3:200:f8ff:fe21:67cf/48")));
- }
-} \ No newline at end of file
diff --git a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/JvppReplyConsumerTest.java b/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/JvppReplyConsumerTest.java
deleted file mode 100644
index 9b1cecf38..000000000
--- a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/JvppReplyConsumerTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.dto.JVppReply;
-
-public class JvppReplyConsumerTest implements JvppReplyConsumer {
-
- private static class AnDataObject implements DataObject {
- @Override
- public Class<? extends DataContainer> getImplementedInterface() {
- return null;
- }
- }
-
- @Test
- public void testGetReplyForWriteTimeout() throws Exception {
- final Future<JVppReply<?>> future = mock(Future.class);
- when(future.get(anyLong(), eq(TimeUnit.SECONDS))).thenThrow(TimeoutException.class);
- final InstanceIdentifier<AnDataObject>
- replyType = InstanceIdentifier.create(AnDataObject.class);
- try {
- getReplyForWrite(future, replyType);
- } catch (WriteTimeoutException e) {
- assertTrue(e.getCause() instanceof TimeoutException);
- assertEquals(replyType, e.getFailedId());
- return;
- }
- fail("WriteTimeoutException was expected");
- }
-
- @Test
- public void testGetReplyForReadTimeout() throws Exception {
- final Future<JVppReply<?>> future = mock(Future.class);
- final InstanceIdentifier<AnDataObject> replyType =
- InstanceIdentifier.create(AnDataObject.class);
- when(future.get(anyLong(), eq(TimeUnit.SECONDS))).thenThrow(TimeoutException.class);
- try {
- getReplyForRead(future, replyType);
- } catch (ReadTimeoutException e) {
- assertTrue(e.getCause() instanceof TimeoutException);
- assertEquals(replyType, e.getFailedId());
- return;
- }
- fail("ReadTimeoutException was expected");
- }
-} \ No newline at end of file
diff --git a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/MacTranslatorTest.java b/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/MacTranslatorTest.java
deleted file mode 100644
index 2b5df66fd..000000000
--- a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/MacTranslatorTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-public class MacTranslatorTest implements MacTranslator {
-
- @Test
- public void testParseMac() throws Exception {
- byte[] bytes = parseMac("00:fF:7f:15:5e:A9");
- assertMac(bytes);
- }
-
- private void assertMac(final byte[] bytes) {
- assertEquals(6, bytes.length);
- assertEquals((byte) 0, bytes[0]);
- assertEquals((byte) 255, bytes[1]);
- assertEquals((byte) 127, bytes[2]);
- assertEquals((byte) 21, bytes[3]);
- assertEquals((byte) 94, bytes[4]);
- assertEquals((byte) 169, bytes[5]);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testParseMacLonger() throws Exception {
- byte[] bytes = parseMac("00:fF:7f:15:5e:A9:88:77");
- assertMac(bytes);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testParseMacShorter() throws Exception {
- parseMac("00:fF:7f");
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testParseRandomString() throws Exception {
- parseMac("random{}}@$*&*!");
- }
-
- @Test(expected = NumberFormatException.class)
- public void testParseMacNumberFormatEx() throws Exception {
- parseMac("00:XX:7f:15:5e:77\"");
- }
-
- @Test
- public void testByteArrayToMacUnseparated() {
- byte[] address = parseMac("aa:bb:cc:dd:ee:ff");
-
- String converted = byteArrayToMacUnseparated(address);
-
- assertEquals("aabbccddeeff", converted);
- }
-
- @Test
- public void testByteArrayToMacSeparated() {
- byte[] address = parseMac("aa:bb:cc:dd:ee:ff");
-
- String converted = byteArrayToMacSeparated(address);
-
- assertEquals("aa:bb:cc:dd:ee:ff", converted);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testByteArrayToMacUnseparatedIllegal() {
- byteArrayToMacUnseparated(new byte[]{54, 26, 87, 32, 14});
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testByteArrayToMacSeparatedIllegal() {
- byteArrayToMacSeparated(new byte[]{54, 26, 87, 32, 14});
- }
-} \ No newline at end of file
diff --git a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/VppStatusListenerTest.java b/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/VppStatusListenerTest.java
deleted file mode 100644
index 93ee8ef06..000000000
--- a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/VppStatusListenerTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.translate.vpp.util;
-
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.contrib.java.lang.system.ExpectedSystemExit;
-
-public class VppStatusListenerTest {
-
- @Rule
- public final ExpectedSystemExit exit = ExpectedSystemExit.none();
-
- @Test
- public void testOnKeepaliveFailure() throws Exception {
- final VppStatusListener vppStatus = new VppStatusListener();
- exit.expectSystemExitWithStatus(VppStatusListener.RESTART_ERROR_CODE);
- exit.checkAssertionAfterwards(() -> assertTrue(vppStatus.isDown()));
- vppStatus.onKeepaliveFailure();
- }
-} \ No newline at end of file
diff --git a/vpp-integration/asciidoc/Readme.adoc b/vpp-integration/asciidoc/Readme.adoc
deleted file mode 100644
index cba82974b..000000000
--- a/vpp-integration/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= VPP-integration
-
-This is an integration project building HC distribution for VPP, including all available HC plugins for VPP
diff --git a/vpp-integration/minimal-distribution/asciidoc/Readme.adoc b/vpp-integration/minimal-distribution/asciidoc/Readme.adoc
deleted file mode 100644
index 420ac7210..000000000
--- a/vpp-integration/minimal-distribution/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= vpp-integration-distribution
-
-Overview of vpp-integration-distribution \ No newline at end of file
diff --git a/vpp-integration/minimal-distribution/pom.xml b/vpp-integration/minimal-distribution/pom.xml
deleted file mode 100644
index 83fee5689..000000000
--- a/vpp-integration/minimal-distribution/pom.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>minimal-distribution-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../../common/minimal-distribution-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.vpp.integration</groupId>
- <artifactId>vpp-integration-distribution</artifactId>
- <name>${project.artifactId}</name>
- <version>1.16.12-SNAPSHOT</version>
-
- <properties>
- <main.class>io.fd.honeycomb.infra.distro.Main</main.class>
- <v3po.version>1.16.12-SNAPSHOT</v3po.version>
- <lisp.version>1.16.12-SNAPSHOT</lisp.version>
- <vpp.common.integration.version>1.16.12-SNAPSHOT</vpp.common.integration.version>
- <vppnsh.version>1.16.12-SNAPSHOT</vppnsh.version>
- <nat.version>1.16.12-SNAPSHOT</nat.version>
- <ioam.version>1.16.12-SNAPSHOT</ioam.version>
-
- <distribution.modules>
- io.fd.honeycomb.vpp.common.integration.VppCommonModule,
- io.fd.honeycomb.lisp.LispModule,
- io.fd.honeycomb.translate.v3po.V3poModule,
- io.fd.honeycomb.nat.NatModule,
- // io.fd.honeycomb.vppnsh.impl.VppNshModule,
- <!-- Nsh module by default disabled, because it needs vpp-nsh plugin, which is not part of vpp codebase.-->
- //io.fd.honeycomb.vppioam.impl.VppIoamModule
- <!-- iOAM module by default disabled, because it needs ioam plugin (not part of vpp codebase.)-->
- </distribution.modules>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.codehaus.gmaven</groupId>
- <artifactId>groovy-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-common-integration</artifactId>
- <version>${vpp.common.integration.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.v3po</groupId>
- <artifactId>v3po2vpp</artifactId>
- <version>${v3po.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.lisp</groupId>
- <artifactId>lisp2vpp</artifactId>
- <version>${lisp.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.vppnsh</groupId>
- <artifactId>vppnsh-impl</artifactId>
- <version>${vppnsh.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.nat</groupId>
- <artifactId>nat2vpp</artifactId>
- <version>${nat.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.vppioam</groupId>
- <artifactId>vppioam-impl</artifactId>
- <version>${ioam.version}</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/vpp-integration/pom.xml b/vpp-integration/pom.xml
deleted file mode 100644
index 3cd5c09f4..000000000
--- a/vpp-integration/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <parent>
- <groupId>io.fd.honeycomb.common</groupId>
- <artifactId>honeycomb-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../common/honeycomb-parent</relativePath>
- </parent>
-
- <groupId>io.fd.honeycomb.vpp.integration</groupId>
- <artifactId>vpp-integration</artifactId>
- <name>${project.artifactId}</name>
- <version>1.16.12-SNAPSHOT</version>
- <packaging>pom</packaging>
- <modelVersion>4.0.0</modelVersion>
- <description>Aggregator for Honeycomb's VPP distribution. Aggregating all VPP plugins.</description>
-
- <modules>
- <module>minimal-distribution</module>
- </modules>
-
- <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>