/**
* Put a entry into the DAO.
- *
+ *
* @param key
* The entry's key.
* @param values
/**
* Get a specific value from the DAO.
- *
+ *
* @param key
* The key of the value to fetch
* @param valueKey
/**
* Get the entries from the DAO
- *
+ *
* @param key
* The key.
* @return The value from the DAO.
/**
* Enumerate all the entries from the DAO
- *
+ *
* @param visitor
*/
public void getAll(IRowVisitor visitor);
/**
* Remove an entry from the DAO
- *
+ *
* @param key
* The key of the entry
* @param valueKey
/**
* A mapping service entry in the DAO
- *
+ *
* @param <V>
* The type of the mapping key.
*/
/**
* A value in the mapping service DAO
- *
+ *
* @param <V>
* The value type.
*/
/**
* This method returns the authentication key of the address.
- *
+ *
* @param address
* @param maskLen
* @return The correct key.
/**
* This method removes the given authentication key from the map server.
- *
+ *
* @param address
* @param maskLen
* @return
/**
* This method adds an authentication key to the address.
- *
+ *
* @param address
* @param maskLen
* @param key
/**
* EID-Prefix-AFI: This is the address family of the EID-Prefix according to
* [AFI].
- *
+ *
* EID-Prefix: This prefix is 4 octets for an IPv4 address family and 16
* octets for an IPv6 address family. When a Map-Request is sent by an ITR
* because a data packet is received for a destination where there is no
* | \| Locator |
* +-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* </pre>
- *
+ *
* @author gmainzer
- *
+ *
*/
@XmlRootElement
/**
* EID-Prefix-AFI: Address family of the EID-Prefix according to [AFI].
- *
+ *
* EID-Prefix: This prefix is 4 octets for an IPv4 address family and 16
* octets for an IPv6 address family.
*/
* Locator Count: This is the number of Locator entries. A Locator entry
* comprises what is labeled above as 'Loc'. The Locator count can be 0,
* indicating that there are no Locators for the EID-Prefix.
- *
+ *
* private byte locatorCount;
*/
@XmlElement
* | \| Locator |
* +-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* </pre>
- *
+ *
* @author gmainzer
- *
+ *
*/
@XmlRootElement
public LocatorRecord setPriority(short priority) {
if (priority != 0) {
boolean isValidRange = false;
- List<Range<Short>> rangeConstraints = new ArrayList<>();
+ List<Range<Short>> rangeConstraints = new ArrayList<>();
rangeConstraints.add(Range.closed(new Short("0"), new Short("255")));
for (Range<Short> r : rangeConstraints) {
if (r.contains(priority)) {
if (!isValidRange) {
throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", priority, rangeConstraints));
}
- }
+ }
this.priority = priority;
return this;
}
public LocatorRecord setMulticastPriority(short value) {
if (value != 0) {
boolean isValidRange = false;
- List<Range<Short>> rangeConstraints = new ArrayList<>();
+ List<Range<Short>> rangeConstraints = new ArrayList<>();
rangeConstraints.add(Range.closed(new Short("0"), new Short("255")));
for (Range<Short> r : rangeConstraints) {
if (r.contains(value)) {
if (!isValidRange) {
throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, rangeConstraints));
}
- }
+ }
this.multicastPriority = value;
return this;
}
* | \| Locator |
* +-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* </pre>
- *
+ *
* @author gmainzer
- *
+ *
*/
public class MapNotify {
* Record Count: This is the number of records in this Map-Register message.
* A record is comprised of that portion of the packet labeled 'Record'
* above and occurs the number of times equal to Record Count.
- *
+ *
* private byte recordCount;
*/
private List<EidToLocatorRecord> eidToLocatorRecords;
eidToLocatorRecords.add(record);
}
-
+
public void setFromMapRegister(MapRegister mapRegister) {
setNonce(mapRegister.getNonce());
* | \| Locator |
* +-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* </pre>
- *
+ *
* @author gmainzer
- *
+ *
*/
@XmlRootElement
* Record Count: This is the number of records in this Map-Register message.
* A record is comprised of that portion of the packet labeled 'Record'
* above and occurs the number of times equal to Record Count.
- *
+ *
* private byte recordCount;
*/
@XmlElement
* | \| Locator |
* +-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* </pre>
- *
+ *
* @author gmainzer
- *
+ *
*/
public class MapReply {
/**
* S: This is the Security bit. When set to 1, the following authentication
* information will be appended to the end of the Map-Reply. The detailed
* format of the Authentication Data Content is for further study.
- *
+ *
* <pre>
* 0 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* Record Count: This is the number of records in this reply message. A
* record is comprised of that portion of the packet labeled 'Record' above
* and occurs the number of times equal to Record Count.
- *
+ *
* private byte recordCount;
*/
private List<EidToLocatorRecord> eidToLocatorRecords;
this.eidToLocatorRecords = eidToLocatorRecords;
}
-
+
}
* | Map-Reply RecMapReplyord ... |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* </pre>
- *
+ *
* @author gmainzer
- *
+ *
*/
public class MapRequest {
/**
/**
* Source-EID-AFI: This is the address family of the 'Source EID Address'
* field.
- *
+ *
* Source EID Address: This is the EID of the source host that originated
* the packet that caused the Map-Request. When Map-Requests are used for
* refreshing a Map-Cache entry or for RLOC-Probing, an AFI value 0 is used
/**
* ITR-RLOC-AFI: This is the address family of the 'ITR-RLOC Address' field
* that follows this field.
- *
+ *
* ITR-RLOC Address: This is used to give the ETR the option of selecting
* the destination address from any address family for the Map-Reply
* message. This address MUST be a routable RLOC address of the sender of
* value ranges from 0 to 31. For a value of 0, there is 1 ITR-RLOC address
* encoded; for a value of 1, there are 2 ITR-RLOC addresses encoded, and so
* on up to 31, which encodes a total of 32 ITR-RLOC addresses.
- *
+ *
* private byte itrRlocCount;
*/
private List<LispAddress> itrRlocs;
/**
* EID mask-len: This is the mask length for the EID-Prefix.
- *
+ *
* EID-Prefix-AFI: This is the address family of the EID-Prefix according to
* [AFI].
- *
+ *
* EID-Prefix: This prefix is 4 octets for an IPv4 address family and 16
* octets for an IPv6 address family. When a Map-Request is sent by an ITR
* because a data packet is received for a destination where there is no
* Map-Requests containing one record. Support for requesting multiple EIDs
* in a single Map-Request message will be specified in a future version of
* the protocol.
- *
+ *
* private byte recordCount;
*/
private List<EidRecord> eids;
public AddressFamilyNumberEnum getAfi() {
return afi;
}
-
+
@Override
public int hashCode() {
final int prime = 31;
@XmlElement
int afi;
-
+
@XmlElement
String ipAddress;
-
+
@XmlElement
byte[] mac;
-
+
@XmlElement
int instanceId;
-
+
@XmlElement
int asNum;
-
+
@XmlElement
int lcafType;
-
+
@XmlElement
byte protocol;
-
+
@XmlElement
int ipTos;
-
+
@XmlElement
short localPort;
-
+
@XmlElement
short remotePort;
-
+
@XmlElement
LispAddressGeneric address;
-
+
@XmlElement
LispAddressGeneric srcAddress;
-
+
@XmlElement
LispAddressGeneric dstAddress;
-
+
@XmlElement
byte srcMaskLength;
-
+
@XmlElement
byte dstMaskLength;
-
+
@XmlElement
boolean lookup;
-
+
@XmlElement
boolean RLOCProbe;
-
+
@XmlElement
boolean strict;
-
+
@XmlElement
List<LispAddressGeneric> hops;
-
+
@XmlElement
List<LispAddressGeneric> addresses;
-
+
@XmlElement
String distinguishedName;
-
-
+
+
public LispAddressGeneric(){}
-
-
+
+
public LispAddressGeneric(int afi) {
this.afi = afi;
}
-
+
public LispAddressGeneric(int afi, String address) {
this.afi = afi;
-
+
AddressFamilyNumberEnum afiEnum = AddressFamilyNumberEnum.valueOf((short) afi);
-
+
switch (afiEnum) {
case AS:
asNum = Integer.valueOf(address);
case IP:
case IP6:
ipAddress = address;
- break;
+ break;
default:
- throw new IllegalArgumentException("AFI " + afi +
+ throw new IllegalArgumentException("AFI " + afi +
" not supported by this constructor: LispAddressGeneric(int afi, String address)");
}
}
-
+
public LispAddressGeneric(int afi, LispAddressGeneric address) {
this.afi = afi;
this.address = address;
}
-
-
-
+
+
+
public LispAddressGeneric(LispAddress lispAddress) {
-
+
afi = lispAddress.getAfi().getIanaCode();
-
+
switch (lispAddress.getAfi()){
case IP:
LispIpv4Address ipv4Address = (LispIpv4Address) lispAddress;
case LCAF:
LispLCAFAddress lcafAddress = (LispLCAFAddress) lispAddress;
lcafType = lcafAddress.getType().getLispCode();
-
+
switch (lcafAddress.getType()){
case APPLICATION_DATA:
applicationDataGeneric(lcafAddress);
trafficEngineeringGeneric(lcafAddress);
break;
default:
- throw new IllegalArgumentException("LCAF type " + lcafAddress.getType() +
+ throw new IllegalArgumentException("LCAF type " + lcafAddress.getType() +
" not supported by this constructor: LispAddressGeneric(LispAddress lispAddress)");
}
break;
default:
- throw new IllegalArgumentException("AFI " + afi +
+ throw new IllegalArgumentException("AFI " + afi +
" not supported by this constructor: LispAddressGeneric(LispAddress lispAddress)");
}
}
-
+
private void applicationDataGeneric(LispLCAFAddress lcafAddress){
- LispApplicationDataLCAFAddress appDataAddress = (LispApplicationDataLCAFAddress) lcafAddress;
+ LispApplicationDataLCAFAddress appDataAddress = (LispApplicationDataLCAFAddress) lcafAddress;
protocol = appDataAddress.getProtocol();
ipTos = appDataAddress.getIPTos();
localPort = appDataAddress.getLocalPort();
remotePort = appDataAddress.getLocalPort();
address = new LispAddressGeneric(appDataAddress.getAddress());
}
-
+
private void listGeneric(LispLCAFAddress lcafAddress){
LispListLCAFAddress listAddress = (LispListLCAFAddress) lcafAddress;
addresses = new ArrayList<LispAddressGeneric>();
addresses.add(new LispAddressGeneric(listAddress.getAddresses().get(i)));
}
}
-
+
private void segmentGeneric(LispLCAFAddress lcafAddress){
LispSegmentLCAFAddress segmentAddress = (LispSegmentLCAFAddress) lcafAddress;
instanceId = segmentAddress.getInstanceId();
address = new LispAddressGeneric(segmentAddress.getAddress());
}
-
+
private void srcDstGeneric(LispLCAFAddress lcafAddress){
LispSourceDestLCAFAddress srcDstAddress = (LispSourceDestLCAFAddress) lcafAddress;
srcAddress = new LispAddressGeneric(srcDstAddress.getSrcAddress());
srcMaskLength = srcDstAddress.getSrcMaskLength();
dstMaskLength = srcDstAddress.getDstMaskLength();
}
-
+
private void trafficEngineeringGeneric(LispLCAFAddress lcafAddress){
LispTrafficEngineeringLCAFAddress teAddress = (LispTrafficEngineeringLCAFAddress) lcafAddress;
-
+
hops = new ArrayList<LispAddressGeneric>();
for(int i=0;i<teAddress.getHops().size();i++){
LispAddressGeneric hop = new LispAddressGeneric(AddressFamilyNumberEnum.UNKNOWN.getIanaCode());
}
}
-
-
-
-
+
+
+
+
public String getIpAddress() {
return ipAddress;
}
public void setAfi(int afi) {
this.afi = afi;
}
-
+
public int getInstanceId() {
return instanceId;
}
public void setHops(List<LispAddressGeneric> hops) {
this.hops = hops;
}
-
+
public LispAddressGeneric getAddress() {
return address;
}
this.distinguishedName = distinguishedName;
}
-
+
}
import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
public class LispMACAddress extends LispAddress {
-
+
private byte[] mac = new byte[6];
public LispMACAddress(byte[] mac) {
private boolean lookup;
private boolean RLOCProbe;
private boolean strict;
-
+
public ReencapHop(LispAddress hop, short resv3, boolean lookup, boolean RLOCProbe, boolean strict) {
super(hop.getAfi());
this.hop = hop;
public void setStrict(boolean strict) {
this.strict = strict;
}
-
+
@Override
public String toString() {
return "ReencapHop#[hop=" + hop + "]" + super.toString();
}
-
-
+
+
}
/**
* Main application activator class for registering the dependencies and
* initialising the Mapping Service application.
- *
+ *
*/
public class Activator extends ComponentActivatorAbstractBase {
/**
* Function called when the activator starts just after some initializations
* are done by the ComponentActivatorAbstractBase.
- *
+ *
*/
@Override
public void init() {
/**
* Function called when the activator stops just before the cleanup done by
* ComponentActivatorAbstractBase
- *
+ *
*/
@Override
public void destroy() {
/**
* Function that is used to communicate to dependency manager the list of
* known implementations for services inside a container
- *
- *
+ *
+ *
* @return An array containing all the CLASS objects that will be
* instantiated in order to get an fully working implementation
* Object
/**
* Function that is called when configuration of the dependencies is
* required.
- *
+ *
* @param c
* dependency manager Component object, used for configuring the
* dependencies exported and imported
* destroyed only at time of bundle destruction, this is the major
* difference with the implementation retrieved via getImplementations where
* all of them are assumed to be in a container !
- *
- *
+ *
+ *
* @return The list of implementations the bundle will support, in Global
* version
*/
/**
* Configure the dependency for a given instance Global
- *
+ *
* @param c
* Component assigned for this instance, this will be what will
* be used for configuration
augment "/config:modules/config:module/config:configuration" {
case lispconfig {
when "/config:modules/config:module/config:type = 'lispconfig'";
-
+
leaf bind-address {
- type string;
+ type string;
mandatory true;
}
}
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam</artifactId>
<version>${exam.version}</version>
- <!-- Compile scope here is intentional, it is used in TestHelper class
+ <!-- Compile scope here is intentional, it is used in TestHelper class
which could be downloaded via nexus and reused in other integration tests. -->
<scope>compile</scope>
</dependency>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<includes>
- <include>org.opendaylight.org.opendaylight.lispflowmapping.*.*</include>
+ <include>org.opendaylight.org.opendaylight.lispflowmapping.*.*</include>
</includes>
</configuration>
<executions>
augment "/config:modules/config:module/config:configuration" {
case lfm-ncc-provider-impl {
when "/config:modules/config:module/config:type = 'lfm-ncc-provider-impl'";
-
+
container rpc-registry {
uses config:service-ref {
refine type {
import config { prefix config; revision-date 2013-04-05; }
import ietf-inet-types {prefix inet; revision-date "2010-09-24";}
-
+
organization "Cisco Systems, Inc.";
contact
description
"Data model for lispflowmapping netconf connector";
}
-
+
container nc-connector {
presence
"Indicates the netconf connector service is available";
-
+
description
"Top-level container for all connector database objects.";
}
-
+
rpc build-connector {
description
"Build netconf connector";
type inet:host;
description "Device address";
}
-
+
leaf port {
type inet:port-number;
description "Device port";
}
-
+
leaf username {
type string;
description "Username for netconf connection";
}
-
+
leaf password {
type string;
description "Password for netconf connection";
}
}
}
-
+
rpc remove-connector {
description
"Removes a given netconf connector";
org.opendaylight.lispflowmapping.interfaces.lisp,
org.opendaylight.yang.gen.v1.lispflowmapping.rev131031,
org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress,
- org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer,
- org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address,
+ org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer,
+ org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address,
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924,
org.slf4j,
org.apache.catalina.filters,
/**
* Main application activator class for registering the dependencies and
* initialising the Mapping Service application.
- *
+ *
*/
public class Activator extends ComponentActivatorAbstractBase {
/**
* Function called when the activator starts just after some initializations
* are done by the ComponentActivatorAbstractBase.
- *
+ *
*/
@Override
public void init() {
/**
* Function called when the activator stops just before the cleanup done by
* ComponentActivatorAbstractBase
- *
+ *
*/
@Override
public void destroy() {
/**
* Function that is used to communicate to dependency manager the list of
* known implementations for services inside a container
- *
- *
+ *
+ *
* @return An array containing all the CLASS objects that will be
* instantiated in order to get an fully working implementation
* Object
/**
* Function that is called when configuration of the dependencies is
* required.
- *
+ *
* @param c
* dependency manager Component object, used for configuring the
* dependencies exported and imported
* destroyed only at time of bundle destruction, this is the major
* difference with the implementation retrieved via getImplementations where
* all of them are assumed to be in a container !
- *
- *
+ *
+ *
* @return The list of implementations the bundle will support, in Global
* version
*/
/**
* Configure the dependency for a given instance Global
- *
+ *
* @param c
* Component assigned for this instance, this will be what will
* be used for configuration
@XmlAccessorType(XmlAccessType.NONE)
public class AuthKeyNB {
-
-
+
+
@XmlElement
String key;
-
+
@XmlElement
int maskLength;
-
+
@XmlElement
LispAddressGeneric address;
public void setKey(String key) {
this.key = key;
}
-
+
public int getMaskLength() {
return maskLength;
}
-
-
-
+
+
+
}
\ No newline at end of file
import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
public interface ILispmappingNorthbound {
-
+
public IFlowMapping getMappingService();
}
@XmlAccessorType(XmlAccessType.NONE)
public class MapRegisterNB {
-
-
+
+
@XmlElement
String key;
-
+
@XmlElement
MapRegister mapregister;
public MapRegister getMapRegister() {
return mapregister;
}
-
-
-
+
+
+
}
\ No newline at end of file
public void before() throws Exception {
super.before();
}
-
+
@Test
public void convertToLispAddress__ipv4() throws Exception {
-
+
LispAddress lispAddress = new LispIpv4Address("10.0.0.1");
-
+
LispAddressGeneric lispAddressGeneric = new LispAddressGeneric(lispAddress);
-
+
//assertEquals(lispAddress, new LispIpv4Address("10.0.0.1"));
-
+
assertEquals(lispAddress, LispAddressConvertorNB.convertToLispAddress(lispAddressGeneric));
-
+
}
@Test
public void transformLispAddressGeneric__ipv4() throws Exception {
-
- LispAddressGeneric lispAddressGenericIn
+
+ LispAddressGeneric lispAddressGenericIn
= new LispAddressGeneric(AddressFamilyNumberEnum.IP.getIanaCode(),"10.0.0.1");
-
- LispAddressContainer lispAddressContainer =
+
+ LispAddressContainer lispAddressContainer =
YangTransformerNB.transformLispAddress(
LispAddressConvertorNB.convertToLispAddress(lispAddressGenericIn));
-
- LispAddressGeneric lispAddressGenericOut
+
+ LispAddressGeneric lispAddressGenericOut
= new LispAddressGeneric(YangTransformerNB.transformToLispAddress(lispAddressContainer));
-
+
assertEquals(lispAddressGenericIn.getIpAddress(),lispAddressGenericOut.getIpAddress());
-
- }
+
+ }
@Test
public void transformLispAddressGeneric__srcdst() throws Exception {
-
+
LispAddressGeneric lispAddressGenericIn = new LispAddressGeneric();
-
- LispAddressGeneric lispAddressGenericSrc
+
+ LispAddressGeneric lispAddressGenericSrc
= new LispAddressGeneric(AddressFamilyNumberEnum.IP.getIanaCode(),"10.0.0.1");
-
- LispAddressGeneric lispAddressGenericDst
+
+ LispAddressGeneric lispAddressGenericDst
= new LispAddressGeneric(AddressFamilyNumberEnum.IP.getIanaCode(),"20.0.0.2");
-
+
lispAddressGenericIn.setAfi(AddressFamilyNumberEnum.LCAF.getIanaCode());
lispAddressGenericIn.setLcafType(LispCanonicalAddressFormatEnum.SOURCE_DEST.getLispCode());
-
+
lispAddressGenericIn.setSrcAddress(lispAddressGenericSrc);
lispAddressGenericIn.setDstAddress(lispAddressGenericDst);
-
+
lispAddressGenericIn.setSrcMaskLength((byte) 32);
lispAddressGenericIn.setDstMaskLength((byte) 32);
-
-
- LispAddressContainer lispAddressContainer =
+
+
+ LispAddressContainer lispAddressContainer =
YangTransformerNB.transformLispAddress(
LispAddressConvertorNB.convertToLispAddress(lispAddressGenericIn));
-
- LispAddressGeneric lispAddressGenericOut
+
+ LispAddressGeneric lispAddressGenericOut
= new LispAddressGeneric(YangTransformerNB.transformToLispAddress(lispAddressContainer));
-
+
assertEquals(lispAddressGenericIn.getSrcAddress().getIpAddress(),
lispAddressGenericOut.getSrcAddress().getIpAddress());
-
+
assertEquals(lispAddressGenericIn.getDstAddress().getIpAddress(),
lispAddressGenericOut.getDstAddress().getIpAddress());
-
- }
-
-
+
+ }
+
+
@Test
public void transformLispAddressContainer__ipv4() throws Exception {
-
+
Ipv4Address ipv4AddressIn = new Ipv4Address("10.0.0.1");
LispAFIAddress lispAFIAddressIn = new Ipv4Builder()
.setIpv4Address(ipv4AddressIn)
.setAfi(AddressFamilyNumberEnum.IP.getIanaCode())
.build();
-
+
LispAddressContainer lispAddressContainerIn = YangTransformerNB.toContainer(lispAFIAddressIn);
-
- LispAddressGeneric lispAddressGeneric
+
+ LispAddressGeneric lispAddressGeneric
= new LispAddressGeneric(YangTransformerNB.transformToLispAddress(lispAddressContainerIn));
-
- LispAddressContainer lispAddressContainerOut
+
+ LispAddressContainer lispAddressContainerOut
= YangTransformerNB.transformLispAddress(LispAddressConvertorNB.convertToLispAddress(lispAddressGeneric));
-
+
LispAFIAddress lispAFIAddressOut = (LispAFIAddress) lispAddressContainerOut.getAddress();
-
+
org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LispIpv4Address lispIpv4AddressOut;
lispIpv4AddressOut = (org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LispIpv4Address) lispAFIAddressOut;
-
-
+
+
assertEquals(ipv4AddressIn.getValue(),
lispIpv4AddressOut.getIpv4Address().getValue());
-
+
}
-
-
+
+
@Test
public void transformLispAddressContainer__srcdst() throws Exception {
-
+
Ipv4Address ipv4AddressSrcIn = new Ipv4Address("10.0.0.1");
LispAFIAddress lispAFIAddressSrc = new Ipv4Builder()
.setIpv4Address(ipv4AddressSrcIn)
.setAfi(AddressFamilyNumberEnum.IP.getIanaCode())
.build();
-
+
Ipv4Address ipv4AddressDstIn = new Ipv4Address("20.0.0.2");
LispAFIAddress lispAFIAddressDst = new Ipv4Builder()
.setIpv4Address(ipv4AddressDstIn)
.setAfi(AddressFamilyNumberEnum.IP.getIanaCode())
.build();
-
+
SrcAddress srcAddress = new SrcAddressBuilder()
.setPrimitiveAddress(YangTransformerNB.toPrimitive(lispAFIAddressSrc))
.build();
-
+
DstAddress dstAddress = new DstAddressBuilder()
.setPrimitiveAddress(YangTransformerNB.toPrimitive(lispAFIAddressDst))
.build();
-
+
LispAFIAddress lispAFIAddressIn = new LcafSourceDestBuilder()
.setAfi(AddressFamilyNumberEnum.LCAF.getIanaCode())
.setLcafType((short) LispCanonicalAddressFormatEnum.SOURCE_DEST.getLispCode())
.setSrcAddress(srcAddress)
.setDstAddress(dstAddress)
.build();
-
+
LispAddressContainer lispAddressContainerIn = YangTransformerNB.toContainer(lispAFIAddressIn);
-
- LispAddressGeneric lispAddressGeneric
+
+ LispAddressGeneric lispAddressGeneric
= new LispAddressGeneric(YangTransformerNB.transformToLispAddress(lispAddressContainerIn));
-
- LispAddressContainer lispAddressContainerOut
+
+ LispAddressContainer lispAddressContainerOut
= YangTransformerNB.transformLispAddress(LispAddressConvertorNB.convertToLispAddress(lispAddressGeneric));
-
+
LispAFIAddress lispAFIAddressOut = (LispAFIAddress) lispAddressContainerOut.getAddress();
-
+
org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LcafSourceDestAddress lcafSourceDestAddressOut;
lcafSourceDestAddressOut = (org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LcafSourceDestAddress) lispAFIAddressOut;
-
- Ipv4Address ipv4AddressSrcOut
- = ((org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Ipv4)
+
+ Ipv4Address ipv4AddressSrcOut
+ = ((org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Ipv4)
lcafSourceDestAddressOut.getSrcAddress().getPrimitiveAddress())
.getIpv4Address();
-
- Ipv4Address ipv4AddressDstOut
- = ((org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Ipv4)
+
+ Ipv4Address ipv4AddressDstOut
+ = ((org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispsimpleaddress.primitiveaddress.Ipv4)
lcafSourceDestAddressOut.getDstAddress().getPrimitiveAddress())
.getIpv4Address();
-
-
+
+
assertEquals(ipv4AddressSrcIn.getValue(),ipv4AddressSrcOut.getValue());
-
+
assertEquals(ipv4AddressDstIn.getValue(),ipv4AddressDstOut.getValue());
-
+
}
-
-
+
+
}
XtrReplyMappingBuilder replyMappingBuilder = new XtrReplyMappingBuilder();
replyMappingBuilder.setMapReply(LispNotificationHelper.convertMapReply(reply));
-
+
if (notificationProvider != null) {
notificationProvider.publish(replyMappingBuilder.build());
logger.trace("MapReply was published!");
module lispflowmapping {
-
+
namespace
"lispflowmapping";
prefix lispflowmapping;
-
+
import ietf-inet-types {
prefix inet;
revision-date 2010-09-24;
}
-
+
import ietf-yang-types {
prefix yang;
revision-date 2010-09-24;
description
"mapping service";
}
-
+
grouping TransportAddress{
- container TransportAddress {
- leaf ipAddress {
- type inet:ip-address;
- reference "http://www.iana.org/assignments/safi-namespace/safi-namespace.xhtml";
- }
- leaf port {
- type inet:port-number;
- }
+ container TransportAddress {
+ leaf ipAddress {
+ type inet:ip-address;
+ reference "http://www.iana.org/assignments/safi-namespace/safi-namespace.xhtml";
+ }
+ leaf port {
+ type inet:port-number;
+ }
}
}
reference "http://www.iana.org/assignments/safi-namespace/safi-namespace.xhtml";
}
}
-
+
grouping LispNoAddress {
uses LispAFIAddress {
refine afi {
}
}
}
-
+
grouping LispIpv4Address {
uses LispAFIAddress {
refine afi {
reference "https://tools.ietf.org/html/rfc3209#section-4.6.2.1";
}
}
-
+
grouping LispIpv6Address {
uses LispAFIAddress{
refine afi {
type inet:ipv6-address;
}
}
-
+
grouping LispMacAddress {
uses LispAFIAddress{
refine afi {
type yang:mac-address;
}
}
-
+
grouping LispDistinguishedNameAddress {
uses LispAFIAddress{
refine afi {
type string;
}
}
-
-
+
+
grouping LispASAddress {
uses LispAFIAddress{
refine afi {
type int32;
}
}
-
+
grouping LispSimpleAddress {
choice primitiveAddress {
case No {
}
}
}
-
+
grouping ReencapHop {
container hop {
uses LispSimpleAddress;
type boolean;
}
}
-
-
-
-
+
+
+
+
grouping LispLcafAddress {
uses LispAFIAddress{
refine afi {
reference "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-03";
}
}
-
+
grouping LcafSegmentAddress {
reference http://tools.ietf.org/html/draft-ietf-lisp-lcaf-03#section-4.1;
uses LispLcafAddress{
uses ReencapHop;
}
}
-
+
grouping LcafListAddress {
reference http://tools.ietf.org/html/draft-ietf-lisp-lcaf-03#section-4.1;
uses LispLcafAddress{
uses LispSimpleAddress;
}
}
-
+
grouping LcafSourceDestAddress {
reference "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-03#section-4.11";
uses LispLcafAddress{
type uint8;
}
}
-
+
grouping LcafKeyValueAddress {
reference "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-04#section-4.14";
uses LispLcafAddress{
uses LispSimpleAddress;
}
}
-
+
grouping LcafApplicationDataAddress {
reference "http://tools.ietf.org/html/draft-ietf-lisp-lcaf-03#section-4.11";
uses LispLcafAddress{
leaf ipTos {
type int32;
}
- leaf localPort {
- type inet:port-number;
- }
- leaf remotePort {
- type inet:port-number;
- }
+ leaf localPort {
+ type inet:port-number;
+ }
+ leaf remotePort {
+ type inet:port-number;
+ }
}
-
+
grouping LispAddress {
container LispAddressContainer{
choice Address {
case LcafTrafficEngineering {
uses LcafTrafficEngineeringAddress;
}
- }
+ }
}
}
-
-
+
+
grouping EidRecords {
list EidRecord {
-
+
// EID
- uses LispAddress;
-
+ uses LispAddress;
+
leaf mask {
type uint8;
}
}
}
-
+
grouping LocatorRecords {
list LocatorRecord {
leaf priority {
leaf routed {
type boolean;
}
-
+
//locator address
- uses LispAddress;
- }
+ uses LispAddress;
+ }
}
-
- grouping EidToLocatorRecord {
+
+ grouping EidToLocatorRecord {
leaf recordTtl {
type int32;
}
type boolean;
}
// EID prefix
- uses LispAddress;
-
+ uses LispAddress;
+
// locator record list
uses LocatorRecords;
}
-
+
grouping EidToLocatorRecords {
list eidToLocatorRecord {
uses EidToLocatorRecord;
}
}
-
+
grouping xtrSiteId {
leaf xtrId {
type binary;
uses EidToLocatorRecords;
uses xtrSiteId;
}
-
+
grouping MapNotify {
reference "http://tools.ietf.org/html/rfc6830#section-6.1.7";
reference "http://tools.ietf.org/html/draft-ermagan-lisp-nat-traversal-05#section-4.3";
uses EidToLocatorRecords;
uses xtrSiteId;
}
-
+
grouping MapRequest {
reference "http://tools.ietf.org/html/rfc6830#section-6.1.2";
leaf authoritative {
type int64;
}
container SourceEid {
- uses LispAddress;
+ uses LispAddress;
}
list itrRloc {
- uses LispAddress;
+ uses LispAddress;
}
uses EidRecords;
- container MapReply{
+ container MapReply{
uses EidToLocatorRecord;
}
}
-
+
grouping MapReply {
reference "http://tools.ietf.org/html/rfc6830#section-6.1.4";
leaf probe {
}
uses EidToLocatorRecords;
}
-
+
grouping MapRegisterNotification {
container MapRegister {
uses MapRegister;
}
uses TransportAddress;
-
+
}
-
+
grouping MapNotifyMessage {
container MapNotify {
uses MapNotify;
}
uses TransportAddress;
-
+
}
-
+
grouping MapRequestMessage {
container MapRequest {
uses MapRequest;
}
uses TransportAddress;
-
+
}
-
+
grouping MapRequestNotification {
container MapRequest {
uses MapRequest;
}
uses TransportAddress;
-
+
}
-
-
+
+
grouping MapReplyMessage {
container MapReply {
uses MapReply;
}
uses TransportAddress;
-
+
}
-
+
grouping MapReplyNotification {
container MapReply {
uses MapReply;
}
-
+
}
-
-
+
+
rpc sendMapNotify {
input {
uses MapNotifyMessage;
}
}
-
+
rpc sendMapRequest {
input {
uses MapRequestMessage;
}
}
-
+
rpc sendMapReply {
input {
uses MapReplyMessage;
}
}
-
+
notification addMapping {
uses MapRegisterNotification;
}
-
+
notification requestMapping {
uses MapRequestNotification;
}
-
+
notification xtrRequestMapping {
uses MapRequestNotification;
}
-
+
notification xtrReplyMapping {
uses MapReplyNotification;
}
}
-
-
+
+