<artifactId>mappingservice.neutron</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>mappingservice.northbound</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mappingservice.shell</artifactId>
<artifactId>clustering.services</artifactId>
<version>0.7.0-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>commons.northbound</artifactId>
- <version>0.6.0-SNAPSHOT</version>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>config-api</artifactId>
<artifactId>config-util</artifactId>
<version>0.4.0-SNAPSHOT</version>
</dependency>
+ <!--
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>containermanager</artifactId>
<version>0.7.0-SNAPSHOT</version>
</dependency>
+ -->
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>features-adsal</artifactId>
<javadocDir>target/apidocs</javadocDir>
</configuration>
</plugin>
- <plugin>
- <groupId>org.codehaus.enunciate</groupId>
- <artifactId>maven-enunciate-plugin</artifactId>
- <configuration>
- <configFile>enunciate.xml</configFile>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>docs</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
<plugin>
<!-- TODO: This should be in ODL parent -->
<groupId>org.codehaus.mojo</groupId>
<ignore></ignore>
</action>
</pluginExecution>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.codehaus.enunciate</groupId>
- <artifactId>maven-enunciate-plugin</artifactId>
- <versionRange>[0.0,)</versionRange>
- <goals>
- <goal>docs</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore></ignore>
- </action>
- </pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.jacoco</groupId>
<groupId>org.opendaylight.lispflowmapping</groupId>
<artifactId>mappingservice.neutron</artifactId>
</dependency>
- <dependency>
- <groupId>org.opendaylight.lispflowmapping</groupId>
- <artifactId>mappingservice.northbound</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.lispflowmapping</groupId>
<artifactId>mappingservice.shell</artifactId>
<feature name="odl-lispflowmapping-all" description="OpenDaylight :: LISP Flow Mapping :: All" version='${lispflowmapping.version}'>
<feature version="${lispflowmapping.version}">odl-lispflowmapping-mappingservice</feature>
<feature version="${lispflowmapping.version}">odl-lispflowmapping-southbound</feature>
- <feature version="${lispflowmapping.version}">odl-lispflowmapping-northbound</feature>
<feature version="${lispflowmapping.version}">odl-lispflowmapping-netconf</feature>
<feature version="${lispflowmapping.version}">odl-lispflowmapping-neutron</feature>
</feature>
<bundle>mvn:org.opendaylight.lispflowmapping/mappingservice.southbound/${lispflowmapping.version}</bundle>
</feature>
- <feature name="odl-lispflowmapping-northbound" description="OpenDaylight :: LISP Flow Mapping :: Northbound" version='${lispflowmapping.version}'>
- <feature version="${nsf.version}">odl-adsal-northbound</feature>
- <feature version="${lispflowmapping.version}">odl-lispflowmapping-mappingservice</feature>
- <bundle>mvn:org.opendaylight.lispflowmapping/mappingservice.northbound/${lispflowmapping.version}</bundle>
- </feature>
-
<feature name="odl-lispflowmapping-netconf" description="OpenDaylight :: LISP Flow Mapping :: NETCONF" version='${lispflowmapping.version}'>
<feature version="${mdsal.version}">odl-netconf-connector-ssh</feature>
<feature version="${lispflowmapping.version}">odl-lispflowmapping-mappingservice</feature>
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.type.lisp;
-
-import org.opendaylight.lispflowmapping.type.lisp.address.LispAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispNoAddress;
-
-public class EidRecord {
- /**
- * EID mask-len: This is the mask length for the EID-Prefix.
- */
- private byte maskLength;
- /**
- * 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
- * mapping entry, the EID-Prefix is set to the destination IP address of the
- * data packet, and the 'EID mask-len' is set to 32 or 128 for IPv4 or IPv6,
- * respectively. When an xTR wants to query a site about the status of a
- * mapping it already has cached, the EID-Prefix used in the Map-Request has
- * the same mask length as the EID-Prefix returned from the site when it
- * sent a Map-Reply message.
- */
- private LispAddress prefix;
-
- public EidRecord(byte maskLength, LispAddress prefix) {
- setMaskLength(maskLength);
- setPrefix(prefix);
- }
-
- public int getMaskLength() {
- return maskLength & 0xFF;
- }
-
- public void setMaskLength(int maskLength) {
- this.maskLength = (byte) maskLength;
- }
-
- public LispAddress getPrefix() {
- return prefix;
- }
-
- public void setPrefix(LispAddress prefix) {
- this.prefix = (prefix != null) ? prefix : NO_PREFIX;
- }
-
- private static LispAddress NO_PREFIX = new LispNoAddress();
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.type.lisp;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.opendaylight.lispflowmapping.type.lisp.address.LispAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispAddressGeneric;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispNoAddress;
-
-/**
- * <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 TTL |
- * | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * R | Locator Count | EID mask-len | ACT |A| Reserved |
- * e +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * c | Rsvd | Map-Version Number | EID-Prefix-AFI |
- * o +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * r | EID-Prefix |
- * d +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | /| Priority | Weight | M Priority | M Weight |
- * | L +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | o | Unused Flags |L|p|R| Loc-AFI |
- * | c +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | \| Locator |
- * +-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * </pre>
- *
- * @author gmainzer
- *
- */
-
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.NONE)
-public class EidToLocatorRecord {
- /**
- * Record TTL: This is the time in minutes the recipient of the Map-Reply
- * will store the mapping. If the TTL is 0, the entry SHOULD be removed from
- * the cache immediately. If the value is 0xffffffff, the recipient can
- * decide locally how long to store the mapping.
- */
- @XmlElement
- private int recordTtl;
-
- /**
- * EID mask-len: This is the mask length for the EID-Prefix.
- */
- @XmlElement
- private byte maskLength;
-
- /**
- * ACT: This 3-bit field describes Negative Map-Reply actions. In any other
- * message type, these bits are set to 0 and ignored on receipt. These bits
- * are used only when the 'Locator Count' field is set to 0. The action bits
- * are encoded only in Map-Reply messages. The actions defined are used by
- * an ITR or PITR when a destination EID matches a negative Map-Cache entry.
- * Unassigned values should cause a Map-Cache entry to be created, and when
- * packets match this negative cache entry, they will be dropped. The
- * current assigned values are:
- */
- @XmlElement
- private MapReplyAction action;
- /**
- * A: The Authoritative bit, when sent, is always set to 1 by an ETR. When a
- * Map-Server is proxy Map-Replying [RFC6833] for a LISP site, the
- * Authoritative bit is set to 0. This indicates to requesting ITRs that the
- * Map-Reply was not originated by a LISP node managed at the site that owns
- * the EID-Prefix.
- */
- @XmlElement
- private boolean authoritative;
- /**
- * Map-Version Number: When this 12-bit value is non-zero, the Map-Reply
- * sender is informing the ITR what the version number is for the EID record
- * contained in the Map-Reply. The ETR can allocate this number internally
- * but MUST coordinate this value with other ETRs for the site. When this
- * value is 0, there is no versioning information conveyed. The Map-Version
- * Number can be included in Map-Request and Map-Register messages. See
- * Section 6.6.3 for more details.
- */
- @XmlElement
- private short mapVersion;
-
- /**
- * 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.
- */
-
- private LispAddress prefix;
-
- /**
- * To be used on the NB interface, prior to parse and convert it into a
- * specific LISP address type
- */
- @XmlElement
- private LispAddressGeneric prefixGeneric;
-
- public void setPrefixGeneric(LispAddressGeneric prefixGeneric) {
- this.prefixGeneric = prefixGeneric;
- }
-
- public LispAddressGeneric getPrefixGeneric() {
- return prefixGeneric;
- }
-
- /**
- * 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
- private List<LocatorRecord> locators;
-
- public EidToLocatorRecord() {
- locators = new ArrayList<LocatorRecord>();
- setAction(null);
- setPrefix(null);
- }
-
- public EidToLocatorRecord setMaskLength(int maskLength) {
- this.maskLength = (byte) maskLength;
- return this;
- }
-
- public int getMaskLength() {
- return maskLength;
- }
-
- public LispAddress getPrefix() {
- return prefix;
- }
-
- public EidToLocatorRecord setPrefix(LispAddress prefix) {
- this.prefix = (prefix != null) ? prefix : NO_PREFIX;
- return this;
- }
-
- public List<LocatorRecord> getLocators() {
- return locators;
- }
-
- public void addLocator(LocatorRecord record) {
- locators.add(record);
- }
-
- public int getRecordTtl() {
- return recordTtl;
- }
-
- public EidToLocatorRecord setRecordTtl(int recordTtl) {
- this.recordTtl = recordTtl;
- return this;
- }
-
- public MapReplyAction getAction() {
- return action;
- }
-
- public EidToLocatorRecord setAction(MapReplyAction action) {
- this.action = (action != null) ? action : MapReplyAction.NoAction;
- return this;
- }
-
- public boolean isAuthoritative() {
- return authoritative;
- }
-
- public EidToLocatorRecord setAuthoritative(boolean authoritative) {
- this.authoritative = authoritative;
- return this;
- }
-
- public short getMapVersion() {
- return mapVersion;
- }
-
- public EidToLocatorRecord setMapVersion(short mapVersion) {
- this.mapVersion = mapVersion;
- return this;
- }
-
- public EidToLocatorRecord clone() {
- EidToLocatorRecord cloned = new EidToLocatorRecord();
- cloned.setAction(getAction());
- cloned.setAuthoritative(isAuthoritative());
- cloned.setMapVersion(getMapVersion());
- cloned.setMaskLength(getMaskLength());
- cloned.setPrefix(getPrefix());
- cloned.setRecordTtl(getRecordTtl());
- for (LocatorRecord record : getLocators()) {
- cloned.addLocator(record.clone());
- }
- return cloned;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((action == null) ? 0 : action.hashCode());
- result = prime * result + (authoritative ? 1231 : 1237);
- result = prime * result + ((locators == null) ? 0 : locators.hashCode());
- result = prime * result + mapVersion;
- result = prime * result + maskLength;
- result = prime * result + ((prefix == null) ? 0 : prefix.hashCode());
- result = prime * result + recordTtl;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- EidToLocatorRecord other = (EidToLocatorRecord) obj;
- if (action != other.action)
- return false;
- if (authoritative != other.authoritative)
- return false;
- if (locators == null) {
- if (other.locators != null)
- return false;
- } else if (!locators.equals(other.locators))
- return false;
- if (mapVersion != other.mapVersion)
- return false;
- if (maskLength != other.maskLength)
- return false;
- if (prefix == null) {
- if (other.prefix != null)
- return false;
- } else if (!prefix.equals(other.prefix))
- return false;
- if (recordTtl != other.recordTtl)
- return false;
- return true;
- }
-
- private static LispNoAddress NO_PREFIX = new LispNoAddress();
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.type.lisp;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.opendaylight.lispflowmapping.type.lisp.address.LispAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispAddressGeneric;
-
-import com.google.common.collect.Range;
-
-/**
- * <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 TTL |
- * | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * R | Locator Count | EID mask-len | ACT |A| Reserved |
- * e +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * c | Rsvd | Map-Version Number | EID-Prefix-AFI |
- * o +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * r | EID-Prefix |
- * d +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | /| Priority | Weight | M Priority | M Weight |
- * | L +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | o | Unused Flags |L|p|R| Loc-AFI |
- * | c +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | \| Locator |
- * +-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * </pre>
- *
- * @author gmainzer
- *
- */
-
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.NONE)
-public class LocatorRecord {
- /**
- * Priority: Each RLOC is assigned a unicast Priority. Lower values are more
- * preferable. When multiple RLOCs have the same Priority, they MAY be used
- * in a load-split fashion. A value of 255 means the RLOC MUST NOT be used
- * for unicast forwarding.
- */
- @XmlElement
- private short priority;
- /**
- * Weight: When priorities are the same for multiple RLOCs, the Weight
- * indicates how to balance unicast traffic between them. Weight is encoded
- * as a relative weight of total unicast packets that match the mapping
- * entry. For example, if there are 4 Locators in a Locator-Set, where the
- * Weights assigned are 30, 20, 20, and 10, the first Locator will get 37.5%
- * of the traffic, the 2nd and 3rd Locators will get 25% of the traffic, and
- * the 4th Locator will get 12.5% of the traffic. If all Weights for a
- * Locator-Set are equal, the receiver of the Map-Reply will decide how to
- * load-split the traffic. See Section 6.5 for a suggested hash algorithm to
- * distribute the load across Locators with the same Priority and equal
- * Weight values.
- */
- @XmlElement
- private short weight;
- /**
- * M Priority: Each RLOC is assigned a multicast Priority used by an ETR in
- * a receiver multicast site to select an ITR in a source multicast site for
- * building multicast distribution trees. A value of 255 means the RLOC MUST
- * NOT be used for joining a multicast distribution tree. For more details,
- * see [RFC6831].
- */
- @XmlElement
- private short multicastPriority;
- /**
- * M Weight: When priorities are the same for multiple RLOCs, the Weight
- * indicates how to balance building multicast distribution trees across
- * multiple ITRs. The Weight is encoded as a relative weight (similar to the
- * unicast Weights) of the total number of trees built to the source site
- * identified by the EID-Prefix. If all Weights for a Locator-Set are equal,
- * the receiver of the Map-Reply will decide how to distribute multicast
- * state across ITRs. For more details, see [RFC6831].
- */
- @XmlElement
- private short multicastWeight;
- /**
- * L: When this bit is set, the Locator is flagged as a local Locator to the
- * ETR that is sending the Map-Reply. When a Map-Server is doing proxy
- * Map-Replying [RFC6833] for a LISP site, the L-bit is set to 0 for all
- * Locators in this Locator-Set.
- */
- @XmlElement
- private boolean localLocator;
- /**
- * p: When this bit is set, an ETR informs the RLOC-Probing ITR that the
- * locator address for which this bit is set is the one being RLOC-probed
- * and MAY be different from the source address of the Map-Reply. An ITR
- * that RLOC-probes a particular Locator MUST use this Locator for
- * retrieving the data structure used to store the fact that the Locator is
- * reachable. The p-bit is set for a single Locator in the same Locator-Set.
- * If an implementation sets more than one p-bit erroneously, the receiver
- * of the Map-Reply MUST select the first Locator. The p-bit MUST NOT be set
- * for Locator-Set records sent in Map-Request and Map-Register messages.
- */
- @XmlElement
- private boolean rlocProbed;
- /**
- * R: This is set when the sender of a Map-Reply has a route to the Locator
- * in the Locator data record. This receiver may find this useful to know if
- * the Locator is up but not necessarily reachable from the receiver's point
- * of view. See also Section 6.4 for another way the R-bit may be used.
- */
- @XmlElement
- private boolean routed;
- /**
- * Locator: This is an IPv4 or IPv6 address (as encoded by the 'Loc-AFI'
- * field) assigned to an ETR. Note that the destination RLOC address MAY be
- * an anycast address. A source RLOC can be an anycast address as well. The
- * source or destination RLOC MUST NOT be the broadcast address
- * (255.255.255.255 or any subnet broadcast address known to the router) and
- * MUST NOT be a link-local multicast address. The source RLOC MUST NOT be a
- * multicast address. The destination RLOC SHOULD be a multicast address if
- * it is being mapped from a multicast destination EID.
- */
-
- private LispAddress locator;
-
- /**
- * To be used on the NB interface, prior to parse and convert it into a
- * specific LISP address type
- */
- @XmlElement
- private LispAddressGeneric locatorGeneric;
-
- public void setLocatorGeneric(LispAddressGeneric locatorGeneric) {
- this.locatorGeneric = locatorGeneric;
- }
-
- public LispAddressGeneric getLocatorGeneric() {
- return locatorGeneric;
- }
-
- public short getPriority() {
- return priority;
- }
-
- public LocatorRecord setPriority(short priority) {
- if (priority != 0) {
- boolean isValidRange = false;
- List<Range<Short>> rangeConstraints = new ArrayList<>();
- rangeConstraints.add(Range.closed((short)0, (short)255));
- for (Range<Short> r : rangeConstraints) {
- if (r.contains(priority)) {
- isValidRange = true;
- }
- }
- if (!isValidRange) {
- throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", priority, rangeConstraints));
- }
- }
- this.priority = priority;
- return this;
- }
-
- public short getWeight() {
- return weight;
- }
-
- public LocatorRecord setWeight(short weight) {
- this.weight = weight;
- return this;
- }
-
- public short getMulticastPriority() {
- return multicastPriority;
- }
-
- public LocatorRecord setMulticastPriority(short value) {
- if (value != 0) {
- boolean isValidRange = false;
- List<Range<Short>> rangeConstraints = new ArrayList<>();
- rangeConstraints.add(Range.closed((short) 0, (short)255));
- for (Range<Short> r : rangeConstraints) {
- if (r.contains(value)) {
- isValidRange = true;
- }
- }
- if (!isValidRange) {
- throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, rangeConstraints));
- }
- }
- this.multicastPriority = value;
- return this;
- }
-
- public short getMulticastWeight() {
- return multicastWeight;
- }
-
- public LocatorRecord setMulticastWeight(short multicastWeight) {
- this.multicastWeight = multicastWeight;
- return this;
- }
-
- public boolean isLocalLocator() {
- return localLocator;
- }
-
- public LocatorRecord setLocalLocator(boolean localLocator) {
- this.localLocator = localLocator;
- return this;
- }
-
- public boolean isRlocProbed() {
- return rlocProbed;
- }
-
- public LocatorRecord setRlocProbed(boolean rlocProbed) {
- this.rlocProbed = rlocProbed;
- return this;
- }
-
- public LocatorRecord setLocator(LispAddress locator) {
- this.locator = locator;
- return this;
- }
-
- public LispAddress getLocator() {
- return locator;
- }
-
- public boolean isRouted() {
- return routed;
- }
-
- public LocatorRecord setRouted(boolean routed) {
- this.routed = routed;
- return this;
- }
-
- public LocatorRecord clone() {
- LocatorRecord cloned = new LocatorRecord();
- cloned.setLocalLocator(isLocalLocator());
- cloned.setLocator(getLocator());
- cloned.setMulticastPriority(getMulticastPriority());
- cloned.setMulticastWeight(getMulticastWeight());
- cloned.setPriority(getPriority());
- cloned.setRlocProbed(isRlocProbed());
- cloned.setRouted(isRouted());
- cloned.setWeight(getWeight());
- return cloned;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (localLocator ? 1231 : 1237);
- result = prime * result + ((locator == null) ? 0 : locator.hashCode());
- result = prime * result + multicastPriority;
- result = prime * result + multicastWeight;
- result = prime * result + priority;
- result = prime * result + (rlocProbed ? 1231 : 1237);
- result = prime * result + (routed ? 1231 : 1237);
- result = prime * result + weight;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- LocatorRecord other = (LocatorRecord) obj;
- if (localLocator != other.localLocator)
- return false;
- if (locator == null) {
- if (other.locator != null)
- return false;
- } else if (!locator.equals(other.locator))
- return false;
- if (multicastPriority != other.multicastPriority)
- return false;
- if (multicastWeight != other.multicastWeight)
- return false;
- if (priority != other.priority)
- return false;
- if (rlocProbed != other.rlocProbed)
- return false;
- if (routed != other.routed)
- return false;
- if (weight != other.weight)
- return false;
- return true;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.type.lisp;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * <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
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |Type=4 | Reserved | Record Count |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Nonce . . . |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | . . . Nonce |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Key ID | Authentication Data Length |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * ~ Authentication Data ~
- * +-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | | Record TTL |
- * | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * R | Locator Count | EID mask-len | ACT |A| Reserved |
- * e +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * c | Rsvd | Map-Version Number | EID-Prefix-AFI |
- * o +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * r | EID-Prefix |
- * d +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | /| Priority | Weight | M Priority | M Weight |
- * | L +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | o | Unused Flags |L|p|R| Loc-AFI |
- * | c +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | \| Locator |
- * +-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * </pre>
- *
- * @author gmainzer
- *
- */
-public class MapNotify {
-
- /**
- * P: This is the proxy Map-Reply bit. When set to 1, an ETR sends a
- * Map-Register message requesting the Map-Server to proxy a Map-Reply. The
- * Map-Server will send non-authoritative Map-Replies on behalf of the ETR.
- * Details on this usage can be found in [RFC6833].
- */
- private boolean proxyMapReply;
- /**
- * M: This is the want-map-notify bit. When set to 1, an ETR is requesting a
- * Map-Notify message to be returned in response to sending a Map-Register
- * message. The Map-Notify message sent by a Map-Server is used to
- * acknowledge receipt of a Map-Register message.
- */
- private boolean wantMapNotify;
-
- /**
- * Nonce: This 8-octet 'Nonce' field is set to 0 in Map-Register messages.
- * Since the Map-Register message is authenticated, the 'Nonce' field is not
- * currently used for any security function but may be in the future as part
- * of an anti-replay solution.
- */
- private long nonce;
-
- /**
- * Key ID: This is a configured ID to find the configured Message
- * Authentication Code (MAC) algorithm and key value used for the
- * authentication function. See Section 14.4 for codepoint assignments.
- */
- private short keyId;
-
- /**
- * Authentication Data Length: This is the length in octets of the
- * 'Authentication Data' field that follows this field. The length of the
- * 'Authentication Data' field is dependent on the MAC algorithm used. The
- * length field allows a device that doesn't know the MAC algorithm to
- * correctly parse the packet. private short authenticationLength;
- */
-
- /**
- * Authentication Data: This is the message digest used from the output of
- * the MAC algorithm. The entire Map-Register payload is authenticated with
- * this field preset to 0. After the MAC is computed, it is placed in this
- * field. Implementations of this specification MUST include support for
- * HMAC-SHA-1-96 [RFC2404], and support for HMAC-SHA-256-128 [RFC4868] is
- * RECOMMENDED.
- */
- private byte[] authenticationData;
- /**
- * 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;
-
- public MapNotify() {
- eidToLocatorRecords = new ArrayList<EidToLocatorRecord>();
- setAuthenticationData(null);
- }
-
- public boolean isProxyMapReply() {
- return proxyMapReply;
- }
-
- public MapNotify setProxyMapReply(boolean proxyMapReply) {
- this.proxyMapReply = proxyMapReply;
- return this;
- }
-
- public boolean isWantMapNotify() {
- return wantMapNotify;
- }
-
- public MapNotify setWantMapNotify(boolean wantMapNotify) {
- this.wantMapNotify = wantMapNotify;
- return this;
- }
-
- public long getNonce() {
- return nonce;
- }
-
- public MapNotify setNonce(long nonce) {
- this.nonce = nonce;
- return this;
- }
-
- public short getKeyId() {
- return keyId;
- }
-
- public MapNotify setKeyId(short keyId) {
- this.keyId = keyId;
- return this;
- }
-
- public byte[] getAuthenticationData() {
- return authenticationData;
- }
-
- public MapNotify setAuthenticationData(byte[] authenticationData) {
- this.authenticationData = (authenticationData != null) ? authenticationData : NO_AUTHENTICATION_DATA;
- return this;
- }
-
- public List<EidToLocatorRecord> getEidToLocatorRecords() {
- return eidToLocatorRecords;
- }
-
- public void addEidToLocator(EidToLocatorRecord record) {
- eidToLocatorRecords.add(record);
- }
-
-
-
- public void setFromMapRegister(MapRegister mapRegister) {
- setNonce(mapRegister.getNonce());
- setKeyId(mapRegister.getKeyId());
- byte[] authenticationData = mapRegister.getAuthenticationData();
- if (authenticationData != null) {
- authenticationData = authenticationData.clone();
- Arrays.fill(authenticationData, (byte)0);
- }
- setAuthenticationData(authenticationData);
-
- for (EidToLocatorRecord eidToLocator : mapRegister.getEidToLocatorRecords()) {
- addEidToLocator(eidToLocator.clone());
- }
- }
-
- private static byte[] NO_AUTHENTICATION_DATA = new byte[] {};
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.type.lisp;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- * <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
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |Type=3 |P| Reserved |M| Record Count |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Nonce . . . |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | . . . Nonce |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Key ID | Authentication Data Length |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * ~ Authentication Data ~
- * +-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | | Record TTL |
- * | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * R | Locator Count | EID mask-len | ACT |A| Reserved |
- * e +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * c | Rsvd | Map-Version Number | EID-Prefix-AFI |
- * o +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * r | EID-Prefix |
- * d +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | /| Priority | Weight | M Priority | M Weight |
- * | L +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | o | Unused Flags |L|p|R| Loc-AFI |
- * | c +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | \| Locator |
- * +-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * </pre>
- *
- * @author gmainzer
- *
- */
-
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.NONE)
-public class MapRegister {
- /**
- * P: This is the proxy Map-Reply bit. When set to 1, an ETR sends a
- * Map-Register message requesting the Map-Server to proxy a Map-Reply. The
- * Map-Server will send non-authoritative Map-Replies on behalf of the ETR.
- * Details on this usage can be found in [RFC6833].
- */
- @XmlElement
- private boolean proxyMapReply;
- /**
- * M: This is the want-map-notify bit. When set to 1, an ETR is requesting a
- * Map-Notify message to be returned in response to sending a Map-Register
- * message. The Map-Notify message sent by a Map-Server is used to
- * acknowledge receipt of a Map-Register message.
- */
- private boolean wantMapNotify;
-
- /**
- * Nonce: This 8-octet 'Nonce' field is set to 0 in Map-Register messages.
- * Since the Map-Register message is authenticated, the 'Nonce' field is not
- * currently used for any security function but may be in the future as part
- * of an anti-replay solution.
- */
- @XmlElement
- private long nonce;
-
- /**
- * Key ID: This is a configured ID to find the configured Message
- * Authentication Code (MAC) algorithm and key value used for the
- * authentication function. See Section 14.4 for codepoint assignments.
- */
- @XmlElement
- private short keyId;
-
- /**
- * Authentication Data Length: This is the length in octets of the
- * 'Authentication Data' field that follows this field. The length of the
- * 'Authentication Data' field is dependent on the MAC algorithm used. The
- * length field allows a device that doesn't know the MAC algorithm to
- * correctly parse the packet. private short authenticationLength;
- */
-
- /**
- * Authentication Data: This is the message digest used from the output of
- * the MAC algorithm. The entire Map-Register payload is authenticated with
- * this field preset to 0. After the MAC is computed, it is placed in this
- * field. Implementations of this specification MUST include support for
- * HMAC-SHA-1-96 [RFC2404], and support for HMAC-SHA-256-128 [RFC4868] is
- * RECOMMENDED.
- */
-
- private byte[] authenticationData;
-
- /**
- * The representation in bytes of the map register.
- */
- private byte[] mapRegisterBytes;
-
- /**
- * 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
- private List<EidToLocatorRecord> eidToLocatorRecords;
-
- public MapRegister() {
- eidToLocatorRecords = new ArrayList<EidToLocatorRecord>();
- setAuthenticationData(null);
- }
-
- public void addEidToLocator(EidToLocatorRecord record) {
- eidToLocatorRecords.add(record);
- }
-
- public List<EidToLocatorRecord> getEidToLocatorRecords() {
- return eidToLocatorRecords;
- }
-
- public boolean isProxyMapReply() {
- return proxyMapReply;
- }
-
- public void setProxyMapReply(boolean proxyMapReply) {
- this.proxyMapReply = proxyMapReply;
- }
-
- public byte[] getAuthenticationData() {
- return authenticationData;
- }
-
- public MapRegister setAuthenticationData(byte[] authenticationData) {
- this.authenticationData = (authenticationData != null) ? authenticationData : NO_AUTHENTICATION_DATA;
- return this;
- }
-
- public boolean isWantMapNotify() {
- return wantMapNotify;
- }
-
- public MapRegister setWantMapNotify(boolean wantMapNotify) {
- this.wantMapNotify = wantMapNotify;
- return this;
- }
-
- public long getNonce() {
- return nonce;
- }
-
- public MapRegister setNonce(long nonce) {
- this.nonce = nonce;
- return this;
- }
-
- public short getKeyId() {
- return keyId;
- }
-
- public MapRegister setKeyId(short keyId) {
- this.keyId = keyId;
- return this;
- }
-
- public byte[] getMapRegisterBytes() {
- return mapRegisterBytes;
- }
-
- public MapRegister setMapRegisterBytes(byte[] mapRegisterBytes) {
- this.mapRegisterBytes = Arrays.copyOf(mapRegisterBytes, mapRegisterBytes.length);
- return this;
- }
-
- private static byte[] NO_AUTHENTICATION_DATA = new byte[] {};
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.type.lisp;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * <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
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |Type=2 |P|E|S| Reserved | Record Count |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Nonce . . . |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | . . . Nonce |
- * +-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | | Record TTL |
- * | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * R | Locator Count | EID mask-len | ACT |A| Reserved |
- * e +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * c | Rsvd | Map-Version Number | EID-Prefix-AFI |
- * o +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * r | EID-Prefix |
- * d +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | /| Priority | Weight | M Priority | M Weight |
- * | L +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | o | Unused Flags |L|p|R| Loc-AFI |
- * | c +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | \| Locator |
- * +-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * </pre>
- *
- * @author gmainzer
- *
- */
-public class MapReply {
- /**
- * P: This is the probe-bit, which indicates that the Map-Reply is in
- * response to a Locator reachability probe Map-Request. The 'Nonce' field
- * MUST contain a copy of the nonce value from the original Map-Request. See
- * Section 6.3.2 for more details.
- */
- private boolean probe;
- /**
- * E: This bit indicates that the ETR that sends this Map-Reply message is
- * advertising that the site is enabled for the Echo-Nonce Locator
- * reachability algorithm. See Section 6.3.1 for more details.
- */
- private boolean echoNonceEnabled;
- /**
- * 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
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | AD Type | Authentication Data Content . . . |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * </pre>
- */
- private boolean securityEnabled;
-
- /**
- * Nonce: This is a 24-bit value set in a Data-Probe packet, or a 64-bit
- * value from the Map-Request is echoed in this 'Nonce' field of the
- * Map-Reply. When a 24-bit value is supplied, it resides in the low-order
- * 64 bits of the 'Nonce' field.
- */
- private long nonce;
-
- /**
- * 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;
-
- public MapReply() {
- eidToLocatorRecords = new ArrayList<EidToLocatorRecord>();
- }
-
- public void addEidToLocator(EidToLocatorRecord record) {
- eidToLocatorRecords.add(record);
- }
-
- public long getNonce() {
- return nonce;
- }
-
- public MapReply setNonce(long nonce) {
- this.nonce = nonce;
- return this;
- }
-
- public List<EidToLocatorRecord> getEidToLocatorRecords() {
- return eidToLocatorRecords;
- }
-
- public boolean isProbe() {
- return probe;
- }
-
- public MapReply setProbe(boolean probe) {
- this.probe = probe;
- return this;
- }
-
- public boolean isEchoNonceEnabled() {
- return echoNonceEnabled;
- }
-
- public MapReply setEchoNonceEnabled(boolean echoNonceEnabled) {
- this.echoNonceEnabled = echoNonceEnabled;
- return this;
- }
-
- public boolean isSecurityEnabled() {
- return securityEnabled;
- }
-
- public MapReply setSecurityEnabled(boolean securityEnabled) {
- this.securityEnabled = securityEnabled;
- return this;
- }
-
- public void setEidToLocatorRecords(List<EidToLocatorRecord> eidToLocatorRecords) {
- this.eidToLocatorRecords = eidToLocatorRecords;
- }
-
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.type.lisp;
-
-public enum MapReplyAction {
- /**
- * (0) No-Action: The map-cache is kept alive, and no packet encapsulation
- * occurs.
- */
- NoAction(0), //
- /**
- * (1) Natively-Forward: The packet is not encapsulated or dropped but
- * natively forwarded.
- */
- NativelyForward(1), //
- /**
- * (2) Send-Map-Request: The packet invokes sending a Map-Request.
- */
- SendMapRequest(2), //
- /**
- * (3) Drop: A packet that matches this map-cache entry is dropped. An ICMP
- * Destination Unreachable message SHOULD be sent.
- */
- Drop(3);
-
- private int code;
-
- private MapReplyAction(int code) {
- this.code = code;
- }
-
- public int getCode() {
- return code;
- }
-
- public static MapReplyAction valueOf(int code) {
- for (MapReplyAction action : values()) {
- if (action.getCode() == code) {
- return action;
- }
- }
- return null;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.type.lisp;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.opendaylight.lispflowmapping.type.lisp.address.LispAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispNoAddress;
-
-/**
- * <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
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |Type=1 |A|M|P|S|p|s| Reserved | IRC | Record Count |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Nonce . . . |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | . . . Nonce |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Source-EID-AFI | Source EID Address ... |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | ITR-RLOC-AFI 1 | ITR-RLOC Address 1 ... |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | ... |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | ITR-RLOC-AFI n | ITR-RLOC Address n ... |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * / | Reserved | EID mask-len | EID-Prefix-AFI |
- * Rec +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * \ | EID-Prefix ... |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Map-Reply RecMapReplyord ... |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * </pre>
- *
- * @author gmainzer
- *
- */
-public class MapRequest {
- /**
- * A: This is an authoritative bit, which is set to 0 for UDP-based
- * Map-Requests sent by an ITR. It is set to 1 when an ITR wants the
- * destination site to return the Map-Reply rather than the mapping database
- * system.
- */
- private boolean authoritative;
-
- /**
- * M: This is the map-data-present bit. When set, it indicates that a
- * Map-Reply Record segment is included in the Map-Request.
- */
- private boolean mapDataPresent;
-
- /**
- * P: This is the probe-bit, which indicates that a Map-Request SHOULD be
- * treated as a Locator reachability probe. The receiver SHOULD respond with
- * a Map-Reply with the probe-bit set, indicating that the Map-Reply is a
- * Locator reachability probe reply, with the nonce copied from the
- * Map-Request. See Section 6.3.2 for more details.
- */
- private boolean probe;
-
- /**
- * S: This is the Solicit-Map-Request (SMR) bit. See Section 6.6.2 for
- * details.
- */
- private boolean smr;
-
- /**
- * p: This is the PITR bit. This bit is set to 1 when a PITR sends a
- * Map-Request.
- */
- private boolean pitr;
-
- /**
- * s: This is the SMR-invoked bit. This bit is set to 1 when an xTR is
- * sending a Map-Request in response to a received SMR-based Map-Request.
- */
- private boolean smrInvoked;
-
- /**
- * Nonce: This is an 8-octet random value created by the sender of the
- * Map-Request. This nonce will be returned in the Map-Reply. The security
- * of the LISP mapping protocol critically depends on the strength of the
- * nonce in the Map-Request message. The nonce SHOULD be generated by a
- * properly seeded pseudo-random (or strong random) source. See [RFC4086]
- * for advice on generating security- sensitive random data.
- */
- private long nonce;
-
- /**
- * 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
- * and this field is of zero length.
- */
- private LispAddress sourceEid;
-
- /**
- * 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
- * the Map-Request message.
- */
- /**
- * IRC: This 5-bit field is the ITR-RLOC Count, which encodes the additional
- * number of ('ITR-RLOC-AFI', 'ITR-RLOC Address') fields present in this
- * message. At least one (ITR-RLOC-AFI, ITR-RLOC-Address) pair MUST be
- * encoded. Multiple 'ITR-RLOC Address' fields are used, so a Map-Replier
- * can select which destination address to use for a Map-Reply. The IRC
- * 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
- * mapping entry, the EID-Prefix is set to the destination IP address of the
- * data packet, and the 'EID mask-len' is set to 32 or 128 for IPv4 or IPv6,
- * respectively. When an xTR wants to query a site about the status of a
- * mapping it already has cached, the EID-Prefix used in the Map-Request has
- * the same mask length as the EID-Prefix returned from the site when it
- * sent a Map-Reply message.
- */
- /**
- * Record Count: This is the number of records in this Map-Request message.
- * A record is comprised of the portion of the packet that is labeled 'Rec'
- * above and occurs the number of times equal to Record Count. For this
- * version of the protocol, a receiver MUST accept and process Map-Requests
- * that contain one or more records, but a sender MUST only send
- * 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;
- final private static LispNoAddress NULL_ADDRESS = new LispNoAddress();
-
- public MapRequest() {
- eids = new ArrayList<EidRecord>();
- itrRlocs = new ArrayList<LispAddress>();
- sourceEid = NULL_ADDRESS;
- }
-
- public List<EidRecord> getEids() {
- return eids;
- }
-
- public LispAddress getSourceEid() {
- return sourceEid;
- }
-
- public MapRequest setSourceEid(LispAddress sourceEid) {
- if (sourceEid == null) {
- sourceEid = NULL_ADDRESS;
- }
- this.sourceEid = sourceEid;
- return this;
- }
-
- public long getNonce() {
- return nonce;
- }
-
- public MapRequest setNonce(long nonce) {
- this.nonce = nonce;
- return this;
- }
-
- public void addItrRloc(LispAddress itrRloc) {
- this.itrRlocs.add(itrRloc);
- }
-
- public void addEidRecord(EidRecord record) {
- this.eids.add(record);
- }
-
- public boolean isAuthoritative() {
- return authoritative;
- }
-
- public MapRequest setAuthoritative(boolean authoritative) {
- this.authoritative = authoritative;
- return this;
- }
-
- public boolean isMapDataPresent() {
- return mapDataPresent;
- }
-
- public MapRequest setMapDataPresent(boolean mapDataPresent) {
- this.mapDataPresent = mapDataPresent;
- return this;
- }
-
- public boolean isProbe() {
- return probe;
- }
-
- public MapRequest setProbe(boolean probe) {
- this.probe = probe;
- return this;
- }
-
- public boolean isSmr() {
- return smr;
- }
-
- public MapRequest setSmr(boolean smr) {
- this.smr = smr;
- return this;
- }
-
- public boolean isPitr() {
- return pitr;
- }
-
- public MapRequest setPitr(boolean pitr) {
- this.pitr = pitr;
- return this;
- }
-
- public boolean isSmrInvoked() {
- return smrInvoked;
- }
-
- public MapRequest setSmrInvoked(boolean smrInvoked) {
- this.smrInvoked = smrInvoked;
- return this;
- }
-
- public List<LispAddress> getItrRlocs() {
- return itrRlocs;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.type.lisp;
-
-public enum NegativeAction {
- NoAction(0), //
- NativelyForward(1), //
- SendMapRequest(2), //
- Drop(3);
-
- int value;
-
- private NegativeAction(int value) {
- this.value = value;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.lispflowmapping.type.lisp.address;
-
-public interface IMaskable extends Cloneable {
-
- public int getMaxMask();
-
- public void normalize(int mask);
-
- public LispAddress clone();
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.type.lisp.address;
-
-import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
-
-public class LispASAddress extends LispAddress {
- private int asNum;
-
- public LispASAddress(int num) {
- super(AddressFamilyNumberEnum.AS);
- this.asNum = num;
- }
-
-
- public int getAS() {
- return asNum;
- }
-
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + asNum;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- LispASAddress other = (LispASAddress) obj;
- if (asNum != other.asNum)
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "" + asNum;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.type.lisp.address;
-
-import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
-
-public abstract class LispAddress {
- private AddressFamilyNumberEnum afi;
-
- protected LispAddress(AddressFamilyNumberEnum afi) {
- this.afi = afi;
- }
-
- public AddressFamilyNumberEnum getAfi() {
- return afi;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((afi == null) ? 0 : afi.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- LispAddress other = (LispAddress) obj;
- if (afi != other.afi)
- return false;
- return true;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.type.lisp.address;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
-
-@XmlRootElement(name="LispAddressGeneric")
-@XmlAccessorType(XmlAccessType.NONE)
-public class LispAddressGeneric{
-
- @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
- byte iidMaskLength;
-
- @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);
- break;
- case IP:
- case IP6:
- ipAddress = address;
- break;
- default:
- 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;
- ipAddress = ipv4Address.getAddress().getHostAddress();
- break;
- case AS:
- LispASAddress asAddress = (LispASAddress) lispAddress;
- asNum = asAddress.getAS();
- break;
- case IP6:
- LispIpv6Address ipv6Address = (LispIpv6Address) lispAddress;
- ipAddress = ipv6Address.getAddress().getHostAddress();
- break;
- case MAC:
- LispMACAddress macAddress = (LispMACAddress) lispAddress;
- mac = macAddress.getMAC();
- break;
- case DISTINGUISHED_NAME:
- LispDistinguishedNameAddress distinguishedNameAddress = (LispDistinguishedNameAddress) lispAddress;
- distinguishedName = distinguishedNameAddress.getDistinguishedName();
- break;
- case LCAF:
- LispLCAFAddress lcafAddress = (LispLCAFAddress) lispAddress;
- lcafType = lcafAddress.getType().getLispCode();
-
- switch (lcafAddress.getType()){
- case APPLICATION_DATA:
- applicationDataGeneric(lcafAddress);
- break;
- case LIST:
- listGeneric(lcafAddress);
- break;
- case SEGMENT:
- segmentGeneric(lcafAddress);
- break;
- case SOURCE_DEST:
- srcDstGeneric(lcafAddress);
- break;
- case TRAFFIC_ENGINEERING:
- trafficEngineeringGeneric(lcafAddress);
- break;
- default:
- throw new IllegalArgumentException("LCAF type " + lcafAddress.getType() +
- " not supported by this constructor: LispAddressGeneric(LispAddress lispAddress)");
- }
- break;
- default:
- throw new IllegalArgumentException("AFI " + afi +
- " not supported by this constructor: LispAddressGeneric(LispAddress lispAddress)");
- }
- }
-
- private void applicationDataGeneric(LispLCAFAddress 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>();
- for(int i=0;i<listAddress.getAddresses().size();i++){
- 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());
- iidMaskLength = segmentAddress.getIdMaskLen();
- }
-
- private void srcDstGeneric(LispLCAFAddress lcafAddress){
- LispSourceDestLCAFAddress srcDstAddress = (LispSourceDestLCAFAddress) lcafAddress;
- srcAddress = new LispAddressGeneric(srcDstAddress.getSrcAddress());
- dstAddress = new LispAddressGeneric(srcDstAddress.getDstAddress());
- 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());
- hop.setLookup(teAddress.getHops().get(i).isLookup());
- hop.setRLOCProbe(teAddress.getHops().get(i).isRLOCProbe());
- hop.setStrict(teAddress.getHops().get(i).isStrict());
- hop.setAddress(new LispAddressGeneric(teAddress.getHops().get(i).getHop()));
- hops.add(hop);
- }
- }
-
-
-
-
-
- public String getIpAddress() {
- return ipAddress;
- }
-
- public void setIpAddress(String ipAddress) {
- this.ipAddress = ipAddress;
- }
-
- public int getAfi() {
- return afi;
- }
-
- public void setAfi(int afi) {
- this.afi = afi;
- }
-
- public int getInstanceId() {
- return instanceId;
- }
-
- public void setInstanceId(int iid) {
- this.instanceId = iid;
- }
-
- public byte[] getMac() {
- return mac;
- }
-
- public void setMac(byte[] mac) {
- this.mac = Arrays.copyOf(mac, mac.length);
- }
-
- public int getAsNum() {
- return asNum;
- }
-
- public void setAsNum(int asNum) {
- this.asNum = asNum;
- }
-
- public int getLcafType() {
- return lcafType;
- }
-
- public void setLcafType(int lcafType) {
- this.lcafType = lcafType;
- }
-
- public byte getProtocol() {
- return protocol;
- }
-
- public void setProtocol(byte protocol) {
- this.protocol = protocol;
- }
-
- public short getLocalPort() {
- return localPort;
- }
-
- public void setLocalPort(short localPort) {
- this.localPort = localPort;
- }
-
- public short getRemotePort() {
- return remotePort;
- }
-
- public void setRemotePort(short remotePort) {
- this.remotePort = remotePort;
- }
-
- public LispAddressGeneric getSrcAddress() {
- return srcAddress;
- }
-
- public void setSrcAddress(LispAddressGeneric srcAddress) {
- this.srcAddress = srcAddress;
- }
-
- public LispAddressGeneric getDstAddress() {
- return dstAddress;
- }
-
- public void setDstAddress(LispAddressGeneric dstAddress) {
- this.dstAddress = dstAddress;
- }
-
- public byte getSrcMaskLength() {
- return srcMaskLength;
- }
-
- public void setSrcMaskLength(byte srcMaskLength) {
- this.srcMaskLength = srcMaskLength;
- }
-
- public byte getDstMaskLength() {
- return dstMaskLength;
- }
-
- public void setDstMaskLength(byte dstMaskLength) {
- this.dstMaskLength = dstMaskLength;
- }
-
- public boolean isLookup() {
- return lookup;
- }
-
- public void setLookup(boolean lookup) {
- this.lookup = lookup;
- }
-
- public boolean isRLOCProbe() {
- return RLOCProbe;
- }
-
- public void setRLOCProbe(boolean rLOCProbe) {
- RLOCProbe = rLOCProbe;
- }
-
- public boolean isStrict() {
- return strict;
- }
-
- public void setStrict(boolean strict) {
- this.strict = strict;
- }
-
- public List<LispAddressGeneric> getHops() {
- return hops;
- }
-
- public void setHops(List<LispAddressGeneric> hops) {
- this.hops = hops;
- }
-
- public byte getIidMaskLength() {
- return iidMaskLength;
- }
-
- public void setIidMaskLength(byte iidMaskLength) {
- this.iidMaskLength = iidMaskLength;
- }
-
- public LispAddressGeneric getAddress() {
- return address;
- }
-
- public void setAddress(LispAddressGeneric address) {
- this.address = address;
- }
-
- public List<LispAddressGeneric> getAddresses() {
- return addresses;
- }
-
- public void setAddresses(List<LispAddressGeneric> addresses) {
- this.addresses = addresses;
- }
-
-
- public int getIpTos() {
- return ipTos;
- }
-
-
- public void setIpTos(int ipTos) {
- this.ipTos = ipTos;
- }
-
-
- public String getDistinguishedName() {
- return distinguishedName;
- }
-
-
- public void setDistinguishedName(String distinguishedName) {
- this.distinguishedName = distinguishedName;
- }
-
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.lispflowmapping.type.lisp.address;
-
-import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
-
-public class LispApplicationDataLCAFAddress extends LispLCAFAddress {
-
- private byte protocol;
- private int IPTos;
- private short localPort;
- private short remotePort;
- private LispAddress address;
-
- public LispApplicationDataLCAFAddress(byte res2) {
- super(LispCanonicalAddressFormatEnum.APPLICATION_DATA, res2);
-
- }
-
- public LispApplicationDataLCAFAddress(byte res2, byte protocol, int iPTos, short localPort, short remotePort, LispAddress address) {
- super(LispCanonicalAddressFormatEnum.APPLICATION_DATA, res2);
- this.protocol = protocol;
- this.IPTos = iPTos;
- this.localPort = localPort;
- this.remotePort = remotePort;
- this.address = address;
- }
-
- public byte getProtocol() {
- return protocol;
- }
-
- public void setProtocol(byte protocol) {
- this.protocol = protocol;
- }
-
- public int getIPTos() {
- return IPTos;
- }
-
- public void setIPTos(int iPTos) {
- IPTos = iPTos;
- }
-
- public short getLocalPort() {
- return localPort;
- }
-
- public void setLocalPort(short localPort) {
- this.localPort = localPort;
- }
-
- public short getRemotePort() {
- return remotePort;
- }
-
- public void setRemotePort(short remotePort) {
- this.remotePort = remotePort;
- }
-
- public LispAddress getAddress() {
- return address;
- }
-
- public void setAddress(LispAddress address) {
- this.address = address;
- }
-
- @Override
- public String toString() {
- return "LispApplicationDataLCAFAddress [protocol=" + protocol + ", IPTos=" + IPTos + ", localPort=" + localPort + ", remotePort="
- + remotePort + ", address=" + address + "]";
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.lispflowmapping.type.lisp.address;
-
-import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
-
-public class LispDistinguishedNameAddress extends LispAddress {
-
- private String distinguishedName;
-
- public LispDistinguishedNameAddress(String distinguishedName) {
- super(AddressFamilyNumberEnum.DISTINGUISHED_NAME);
- this.distinguishedName = distinguishedName;
- }
-
- public String getDistinguishedName() {
- return distinguishedName;
- }
-
- public void setDistinguishedName(String distinguishedName) {
- this.distinguishedName = distinguishedName;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((distinguishedName == null) ? 0 : distinguishedName.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- LispDistinguishedNameAddress other = (LispDistinguishedNameAddress) obj;
- if (distinguishedName == null) {
- if (other.distinguishedName != null)
- return false;
- } else if (!distinguishedName.equals(other.distinguishedName))
- return false;
- return true;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.lispflowmapping.type.lisp.address;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.nio.ByteBuffer;
-
-import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
-
-public abstract class LispIPAddress extends LispAddress implements IMaskable {
-
- protected InetAddress address;
-
- @Override
- public abstract LispIPAddress clone();
-
- protected LispIPAddress(InetAddress address, AddressFamilyNumberEnum afi) {
- super(afi);
- this.address = address;
- }
-
- protected LispIPAddress(int address, AddressFamilyNumberEnum afi) {
- super(afi);
- try {
- this.address = InetAddress.getByAddress(ByteBuffer.allocate(4).putInt(address).array());
- } catch (UnknownHostException e) {
- }
- }
-
- protected LispIPAddress(byte[] address, AddressFamilyNumberEnum afi) {
- super(afi);
- try {
-
- this.address = InetAddress.getByAddress(address);
- } catch (UnknownHostException e) {
- }
- }
-
- protected LispIPAddress(String name, AddressFamilyNumberEnum afi) {
- super(afi);
- try {
- this.address = InetAddress.getByName(name);
- } catch (UnknownHostException e) {
- }
- }
-
- public InetAddress getAddress() {
- return address;
- }
-
- public void normalize(int mask) {
- if (mask < 0 || mask >= getMaxMask()) {
- return;
- }
- ByteBuffer byteRepresentation = ByteBuffer.wrap(address.getAddress());
- byte b = (byte) 0xff;
- for (int i = 0; i < byteRepresentation.array().length; i++) {
- if (mask >= 8)
- byteRepresentation.put(i, (byte) (b & byteRepresentation.get(i)));
-
- else if (mask > 0) {
- byteRepresentation.put(i, (byte) ((byte) (b << (8 - mask)) & byteRepresentation.get(i)));
- } else {
- byteRepresentation.put(i, (byte) (0 & byteRepresentation.get(i)));
- }
-
- mask -= 8;
- }
- try {
- this.address = InetAddress.getByAddress(byteRepresentation.array());
- } catch (UnknownHostException e) {
- }
-
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((address == null) ? 0 : address.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- LispIPAddress other = (LispIPAddress) obj;
- if (address == null) {
- if (other.address != null)
- return false;
- } else if (!address.equals(other.address))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return address.getHostAddress();
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.type.lisp.address;
-
-import java.net.InetAddress;
-
-import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
-
-public class LispIpv4Address extends LispIPAddress {
-
- public LispIpv4Address(InetAddress address) {
- super(address, AddressFamilyNumberEnum.IP);
- }
-
- public LispIpv4Address(int address) {
- super(address, AddressFamilyNumberEnum.IP);
- }
-
- public LispIpv4Address(String name) {
- super(name, AddressFamilyNumberEnum.IP);
- }
-
- public int getMaxMask() {
- return 32;
- }
-
- @Override
- public LispIpv4Address clone() {
- LispIpv4Address clonedAddress = new LispIpv4Address(address.getHostAddress());
- return clonedAddress;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.type.lisp.address;
-
-import java.net.InetAddress;
-
-import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
-
-public class LispIpv6Address extends LispIPAddress {
-
- public LispIpv6Address(InetAddress address) {
- super(address, AddressFamilyNumberEnum.IP6);
- }
-
- public LispIpv6Address(byte[] address) {
- super(address, AddressFamilyNumberEnum.IP6);
- }
-
- public LispIpv6Address(String name) {
- super(name, AddressFamilyNumberEnum.IP6);
- }
-
- public int getMaxMask() {
- return 128;
- }
-
- @Override
- public LispIpv6Address clone() {
- LispIpv6Address clonedAddress = new LispIpv6Address(address.getHostAddress());
- return clonedAddress;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.lispflowmapping.type.lisp.address;
-
-import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
-import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
-
-public abstract class LispLCAFAddress extends LispAddress {
-
- protected LispCanonicalAddressFormatEnum lcafType;
- protected byte res2;
-
- public LispLCAFAddress(LispCanonicalAddressFormatEnum lcafType, byte res2) {
- super(AddressFamilyNumberEnum.LCAF);
- this.lcafType = lcafType;
- this.res2 = res2;
- }
-
-
- public LispCanonicalAddressFormatEnum getType() {
- return lcafType;
- }
-
- public byte getRes2() {
- return res2;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((lcafType == null) ? 0 : lcafType.hashCode());
- result = prime * result + res2;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- LispLCAFAddress other = (LispLCAFAddress) obj;
- if (lcafType != other.lcafType)
- return false;
- if (res2 != other.res2)
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "[lcafType=" + lcafType + ", res2=" + res2 + "]";
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.lispflowmapping.type.lisp.address;
-
-import java.util.List;
-
-import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
-
-public class LispListLCAFAddress extends LispLCAFAddress {
- List<? extends LispAddress> addresses;
-
- public LispListLCAFAddress(byte res2, List<? extends LispAddress> addresses) {
- super(LispCanonicalAddressFormatEnum.LIST, res2);
- this.addresses = addresses;
- }
-
- public List<? extends LispAddress> getAddresses() {
- return addresses;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((addresses == null) ? 0 : addresses.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- LispListLCAFAddress other = (LispListLCAFAddress) obj;
- if (addresses == null) {
- if (other.addresses != null)
- return false;
- } else if (!addresses.equals(other.addresses))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "LispListLCAFAddress#[addresses=" + addresses + "]" + super.toString();
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.type.lisp.address;
-
-import java.util.Arrays;
-
-import javax.xml.bind.DatatypeConverter;
-
-import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
-
-public class LispMACAddress extends LispAddress {
-
- private byte[] mac = new byte[6];
-
- public LispMACAddress(byte[] mac) {
- super(AddressFamilyNumberEnum.MAC);
- System.arraycopy(mac, 0, this.mac, 0, 6);
- }
-
-
- public byte[] getMAC() {
- return mac;
- }
-
-
- @Override
- public String toString() {
- return "LispMACAddress#" + DatatypeConverter.printHexBinary(mac) + super.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + Arrays.hashCode(mac);
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- LispMACAddress other = (LispMACAddress) obj;
- if (!Arrays.equals(mac, other.mac))
- return false;
- return true;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.type.lisp.address;
-
-import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
-
-public class LispNoAddress extends LispAddress {
- public LispNoAddress() {
- super(AddressFamilyNumberEnum.NO_ADDRESS);
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.lispflowmapping.type.lisp.address;
-
-import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
-
-public class LispSegmentLCAFAddress extends LispLCAFAddress {
-
- private LispAddress address;
- private int instanceId;
-
- public LispSegmentLCAFAddress(byte idMaskLen, int instanceId, LispAddress address) {
- super(LispCanonicalAddressFormatEnum.SEGMENT, idMaskLen);
- this.address = address;
- this.instanceId = instanceId;
- }
-
-
- public LispAddress getAddress() {
- return address;
- }
-
- public int getInstanceId() {
- return instanceId;
- }
-
- public byte getIdMaskLen() {
- return getRes2();
- }
-
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((address == null) ? 0 : address.hashCode());
- result = prime * result + instanceId;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- LispSegmentLCAFAddress other = (LispSegmentLCAFAddress) obj;
- if (address == null) {
- if (other.address != null)
- return false;
- } else if (!address.equals(other.address))
- return false;
- if (instanceId != other.instanceId)
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "LispSegmentLCAFAddress#[address=" + address + ", instanceId=" + instanceId + "]" + super.toString();
- }
-
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.lispflowmapping.type.lisp.address;
-
-import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
-
-public class LispSourceDestLCAFAddress extends LispLCAFAddress {
-
- private LispAddress srcAddress;
- private LispAddress dstAddress;
- private byte srcMaskLength;
- private byte dstMaskLength;
- private short reserved;
-
- public LispSourceDestLCAFAddress(byte res2) {
- super(LispCanonicalAddressFormatEnum.SOURCE_DEST, res2);
- }
-
- public LispSourceDestLCAFAddress(byte res2, short reserved, byte srcMaskLength, byte dstMaskLength, LispAddress srcAddress, LispAddress dstAddress) {
- super(LispCanonicalAddressFormatEnum.SOURCE_DEST, res2);
- this.srcAddress = srcAddress;
- this.dstAddress = dstAddress;
- this.srcMaskLength = srcMaskLength;
- this.dstMaskLength = dstMaskLength;
- this.reserved = reserved;
- }
-
- public LispAddress getSrcAddress() {
- return srcAddress;
- }
-
- public void setSrcAddress(LispAddress srcAddress) {
- this.srcAddress = srcAddress;
- }
-
- public LispAddress getDstAddress() {
- return dstAddress;
- }
-
- public void setDstAddress(LispAddress dstAddress) {
- this.dstAddress = dstAddress;
- }
-
- public byte getSrcMaskLength() {
- return srcMaskLength;
- }
-
- public void setSrcMaskLength(byte srcMaskLength) {
- this.srcMaskLength = srcMaskLength;
- }
-
- public byte getDstMaskLength() {
- return dstMaskLength;
- }
-
- public void setDstMaskLength(byte dstMaskLength) {
- this.dstMaskLength = dstMaskLength;
- }
-
- public short getReserved() {
- return reserved;
- }
-
- public void setReserved(short reserved) {
- this.reserved = reserved;
- }
-
- @Override
- public String toString() {
- return "LispSourceDestLCAFAddress#[srcAddress=" + srcAddress + "/" + (int) srcMaskLength + " dstAddress=" + dstAddress + "/"
- + (int) dstMaskLength + "]" + super.toString();
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.lispflowmapping.type.lisp.address;
-
-import java.util.List;
-
-import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
-
-public class LispTrafficEngineeringLCAFAddress extends LispLCAFAddress {
-
- private List<ReencapHop> hops;
-
- public LispTrafficEngineeringLCAFAddress(byte res2, List<ReencapHop> hops) {
- super(LispCanonicalAddressFormatEnum.TRAFFIC_ENGINEERING, res2);
- this.hops = hops;
- }
-
- @Override
- public String toString() {
- return "LispTrafficEngineeringLCAFAddress#[hops=" + hops + "]" + super.toString();
- }
-
- public List<ReencapHop> getHops() {
- return hops;
- }
-
- public void setHops(List<ReencapHop> hops) {
- this.hops = hops;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.lispflowmapping.type.lisp.address;
-
-
-
-public class ReencapHop extends LispAddress{
-
- private LispAddress hop;
- private short resv3;
- 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;
- this.resv3 = resv3;
- this.lookup = lookup;
- this.RLOCProbe = RLOCProbe;
- this.strict = strict;
- }
-
- public LispAddress getHop() {
- return hop;
- }
-
- public void setHop(LispAddress hop) {
- this.hop = hop;
- }
-
- public short getResv3() {
- return resv3;
- }
-
- public void setResv3(short resv3) {
- this.resv3 = resv3;
- }
-
- public boolean isLookup() {
- return lookup;
- }
-
- public void setLookup(boolean lookup) {
- this.lookup = lookup;
- }
-
- public boolean isRLOCProbe() {
- return RLOCProbe;
- }
-
- public void setRLOCProbe(boolean rLOCProbe) {
- RLOCProbe = rLOCProbe;
- }
-
- public boolean isStrict() {
- return strict;
- }
-
- public void setStrict(boolean strict) {
- this.strict = strict;
- }
-
- @Override
- public String toString() {
- return "ReencapHop#[hop=" + hop + "]" + super.toString();
- }
-
-
-
-
-}
mavenBundle("orbit", "javax.servlet.jsp.jstl").versionAsInProject(),
mavenBundle("orbit", "javax.servlet.jsp.jstl.impl").versionAsInProject(),
+ // Load this ASAP, or it won't be available soon enough
+ mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.yangmodel").versionAsInProject(),
+
// Basic bundles needed
mavenBundle("org.opendaylight.controller", "containermanager").versionAsInProject(),
mavenBundle("org.opendaylight.controller", "containermanager.it.implementation").versionAsInProject(),
+ mavenBundle("org.opendaylight.controller", "configuration").versionAsInProject(),
+ mavenBundle("org.opendaylight.controller", "configuration.implementation").versionAsInProject(),
TestHelper.baseModelBundles(),
TestHelper.configMinumumBundles(),
TestHelper.junitAndMockitoBundles(),
TestHelper.flowCapableModelBundles(),
- mavenBundle("org.javassist", "javassist").versionAsInProject(), //
-
- // Northbound bundles
- mavenBundle("org.opendaylight.controller", "commons.northbound").versionAsInProject(), //
- mavenBundle(ODL + ".thirdparty", "com.sun.jersey.jersey-servlet").versionAsInProject(), //
- mavenBundle(ODL + ".thirdparty", "net.sf.jung2").versionAsInProject(), //
- mavenBundle(ODL + ".thirdparty", "org.apache.catalina.filters.CorsFilter").versionAsInProject().noStart(),
- mavenBundle(JERSEY, "jersey-client").versionAsInProject(),
- mavenBundle(JERSEY, "jersey-server").versionAsInProject().startLevel(2),
- mavenBundle(JERSEY, "jersey-core").versionAsInProject().startLevel(2),
- mavenBundle("com.fasterxml.jackson.core", "jackson-annotations").versionAsInProject(),//
- mavenBundle("com.fasterxml.jackson.core", "jackson-core").versionAsInProject(),//
- mavenBundle("com.fasterxml.jackson.core", "jackson-databind").versionAsInProject(),//
- mavenBundle("com.fasterxml.jackson.jaxrs", "jackson-jaxrs-json-provider").versionAsInProject(),//
- mavenBundle("com.fasterxml.jackson.jaxrs", "jackson-jaxrs-base").versionAsInProject(),//
- mavenBundle("com.fasterxml.jackson.module", "jackson-module-jaxb-annotations").versionAsInProject(),
- mavenBundle("org.codehaus.jettison", "jettison").versionAsInProject(),//
- mavenBundle("org.ow2.asm", "asm-all").versionAsInProject(), //
- mavenBundle("org.opendaylight.controller", "bundlescanner").versionAsInProject(),//
- mavenBundle("org.opendaylight.controller", "bundlescanner.implementation").versionAsInProject(),//
- mavenBundle("org.opendaylight.controller", "topologymanager").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "hosttracker").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "forwardingrulesmanager").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "forwardingrulesmanager.implementation").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "statisticsmanager").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "statisticsmanager.implementation").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "switchmanager").versionAsInProject(),//
- mavenBundle("org.opendaylight.controller", "switchmanager.implementation").versionAsInProject(),//
- mavenBundle("org.opendaylight.controller", "connectionmanager").versionAsInProject(),//
- mavenBundle("org.opendaylight.controller", "connectionmanager.implementation").versionAsInProject(),//
- mavenBundle("org.opendaylight.controller", "configuration").versionAsInProject(),//
- mavenBundle("org.opendaylight.controller", "configuration.implementation").versionAsInProject(),//
- mavenBundle("org.opendaylight.controller", "usermanager").versionAsInProject(), //
- mavenBundle("org.opendaylight.controller", "usermanager.implementation").versionAsInProject(), //
- mavenBundle("org.springframework", "org.springframework.asm").versionAsInProject(), mavenBundle("org.springframework",
- "org.springframework.aop").versionAsInProject(), mavenBundle("org.springframework", "org.springframework.context")
- .versionAsInProject(), mavenBundle("org.springframework", "org.springframework.context.support").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.core").versionAsInProject(), mavenBundle("org.springframework",
- "org.springframework.beans").versionAsInProject(), mavenBundle("org.springframework", "org.springframework.expression")
- .versionAsInProject(), mavenBundle("org.springframework", "org.springframework.web").versionAsInProject(),
-
- mavenBundle("org.aopalliance", "com.springsource.org.aopalliance").versionAsInProject(), mavenBundle("org.springframework",
- "org.springframework.web.servlet").versionAsInProject(),
- mavenBundle("org.springframework.security", "spring-security-config").versionAsInProject(), mavenBundle(
- "org.springframework.security", "spring-security-core").versionAsInProject(), mavenBundle("org.springframework.security",
- "spring-security-web").versionAsInProject(), mavenBundle("org.springframework.security", "spring-security-taglibs")
- .versionAsInProject(), mavenBundle("org.springframework", "org.springframework.transaction").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "sal.connection").versionAsInProject(), mavenBundle("org.opendaylight.controller",
- "sal.connection.implementation").versionAsInProject(), mavenBundle("org.opendaylight.controller", "security")
- .versionAsInProject().noStart(),
-
- // Tomcat for northbound
- mavenBundle("geminiweb", "org.eclipse.gemini.web.core").versionAsInProject(), mavenBundle("geminiweb",
- "org.eclipse.gemini.web.extender").versionAsInProject(), mavenBundle("geminiweb", "org.eclipse.gemini.web.tomcat")
- .versionAsInProject(),
- mavenBundle("geminiweb", "org.eclipse.virgo.kernel.equinox.extensions").versionAsInProject().noStart(), mavenBundle("geminiweb",
- "org.eclipse.virgo.util.common").versionAsInProject(), mavenBundle("geminiweb", "org.eclipse.virgo.util.io")
- .versionAsInProject(), mavenBundle("geminiweb", "org.eclipse.virgo.util.math").versionAsInProject(), mavenBundle("geminiweb",
- "org.eclipse.virgo.util.osgi").versionAsInProject(), mavenBundle("geminiweb", "org.eclipse.virgo.util.osgi.manifest")
- .versionAsInProject(), mavenBundle("geminiweb", "org.eclipse.virgo.util.parser.manifest").versionAsInProject(),
+ mavenBundle("org.javassist", "javassist").versionAsInProject(),
+ mavenBundle("org.codehaus.jettison", "jettison").versionAsInProject(),
// Our bundles
- mavenBundle("org.opendaylight.controller", "clustering.stub").versionAsInProject(), //
- mavenBundle("org.opendaylight.controller", "clustering.services").versionAsInProject(), //
- mavenBundle("org.opendaylight.controller", "sal").versionAsInProject(), //
- mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.yangmodel").versionAsInProject(), //
- mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.config").versionAsInProject(), //
- mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.api").versionAsInProject(), //
- mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.implementation").versionAsInProject(), //
- mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.southbound").versionAsInProject(), //
- mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.northbound").versionAsInProject(), //
+ mavenBundle("org.opendaylight.controller", "clustering.stub").versionAsInProject(),
+ mavenBundle("org.opendaylight.controller", "clustering.services").versionAsInProject(),
+ mavenBundle("org.opendaylight.controller", "sal").versionAsInProject(),
+ mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.config").versionAsInProject(),
+ mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.api").versionAsInProject(),
+ mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.implementation").versionAsInProject(),
+ mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.southbound").versionAsInProject(),
junitBundles());
}
@Test
public void testMask() throws Exception {
- testPasswordExactMatch();
- testPasswordMaskMatch();
+ //testPasswordExactMatch(); TODO commented because it needs NB
+ //testPasswordMaskMatch(); TODO commented because it needs NB
eidPrefixLookupIPv4();
eidPrefixLookupIPv6();
}
-
+/*
@Test
public void testNorthbound() throws Exception {
northboundAddKey();
northboundRetrieveSourceDestKey();
northboundRetrieveSourceDestMapping();
}
-
+*/
@Test
public void testOverWriting() throws Exception {
- //testMapRegisterDosntOverwritesOtherSubKeys();
+ //testMapRegisterDosntOverwritesOtherSubKeys(); TODO weird failure, needs debug
testMapRegisterOverwritesSameSubkey();
testMapRegisterOverwritesNoSubkey();
testMapRegisterDoesntOverwritesNoSubkey();
@Test
public void testTimeOuts() throws Exception {
mapRequestMapRegisterAndMapRequestTestTimeout();
- mapRequestMapRegisterAndMapRequestTestNativelyForwardTimeoutResponse();
+ //mapRequestMapRegisterAndMapRequestTestNativelyForwardTimeoutResponse(); TODO commented because it needs NB
}
@Test
LOG.trace("Bundle[" + element.getBundleId() + "]:" + element.getSymbolicName() + ",v" + element.getVersion() + ", state:"
+ stateToString(state));
if (state != Bundle.ACTIVE && state != Bundle.RESOLVED) {
- LOG.trace("Bundle:" + element.getSymbolicName() + " state:" + stateToString(state));
+ LOG.debug("Bundle:" + element.getSymbolicName() + " state:" + stateToString(state));
// try {
// String host = element.getHeaders().get("FRAGMENT-HOST");
+++ /dev/null
-<?xml version="1.0"?>
-<enunciate label="full" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.27.xsd">
-
- <services>
- <rest defaultRestSubcontext="/lispflowmapping/nb/v2"/>
- </services>
-
- <modules>
- <docs docsDir="rest" title="LISP flowmapping REST API" includeExampleXml="false" includeExampleJson="true"/>
- </modules>
-</enunciate>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<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">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.opendaylight.lispflowmapping</groupId>
- <artifactId>mappingservice-parent</artifactId>
- <version>1.3.0-SNAPSHOT</version>
- </parent>
- <artifactId>mappingservice.northbound</artifactId>
- <packaging>bundle</packaging>
- <name>LISP Flow Mapping Northbound APIs</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.codehaus.enunciate</groupId>
- <artifactId>enunciate-core-annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>commons.northbound</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>containermanager</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.opendaylight.controller.thirdparty</groupId>
- <artifactId>com.sun.jersey.jersey-servlet</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.opendaylight.lispflowmapping</groupId>
- <artifactId>mappingservice.api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.opendaylight.lispflowmapping</groupId>
- <artifactId>mappingservice.implementation</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.opendaylight.lispflowmapping</groupId>
- <artifactId>mappingservice.yangmodel</artifactId>
- </dependency>
-
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package></Export-Package>
- <Import-Package>org.opendaylight.controller.sal.core,
- org.opendaylight.controller.sal.utils,
- org.opendaylight.controller.containermanager,
- org.opendaylight.controller.switchmanager,
- org.opendaylight.controller.northbound.commons,
- org.opendaylight.controller.northbound.commons.exception,
- org.opendaylight.controller.northbound.commons.utils,
- com.sun.jersey.spi.container.servlet,
- org.opendaylight.controller.sal.authorization,
- org.opendaylight.controller.usermanager,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.eidtolocatorrecords,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.as,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.distinguishedname,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.ipv4,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.ipv6,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.lcafapplicationdata,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.lcaflist,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.lcafsegment,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.lcafsourcedest,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.lcaftrafficengineering,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.mac,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.no,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.locatorrecords,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.eidrecords,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.maprequest,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.maprequestnotification,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.mapregisternotification,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcafsourcedestaddress,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispsimpleaddress,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispsimpleaddress.primitiveaddress,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcafapplicationdataaddress,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcaflistaddress,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcafsegmentaddress,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcaftrafficengineeringaddress,
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.reencaphop,
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924,
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924,
- org.opendaylight.lispflowmapping.implementation.util,
- org.opendaylight.lispflowmapping.type,
- org.opendaylight.lispflowmapping.type.lisp,
- org.opendaylight.lispflowmapping.type.lisp.address,
- org.opendaylight.lispflowmapping.interfaces.lisp,
- javax.ws.rs,
- javax.ws.rs.core,
- javax.xml.bind,
- javax.xml.bind.annotation,
- org.slf4j,
- org.apache.catalina.filters,
- !org.codehaus.enunciate.jaxrs,
- org.apache.felix.dm,
- org.apache.commons.lang3.builder,
- org.osgi.service.component,
- org.eclipse.osgi.framework.console,
- org.osgi.framework</Import-Package>
- <Bundle-Activator>org.opendaylight.lispflowmapping.northbound.Activator</Bundle-Activator>
-
- <Export-Package></Export-Package>
- <Web-ContextPath>/lispflowmapping/nb/v2</Web-ContextPath>
- <Jaxrs-Resources>,${classes;ANNOTATION;javax.ws.rs.Path}</Jaxrs-Resources>
- </instructions>
- <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>java7</id>
- <activation>
- <jdk>1.7</jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.enunciate</groupId>
- <artifactId>maven-enunciate-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
+++ /dev/null
-/*
- * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.northbound;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
-import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
-
-/**
- * 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
- */
- @Override
- public Object[] getImplementations() {
- Object[] res = { LispMappingNorthbound.class };
- return res;
- }
-
- /**
- * 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
- * @param imp
- * Implementation class that is being configured, needed as long
- * as the same routine can configure multiple implementations
- * @param containerName
- * The containerName being configured, this allow also optional
- * per-container different behavior if needed, usually should not
- * be the case though.
- */
- @Override
- public void configureInstance(Component c, Object imp, String containerName) {
- if (imp.equals(LispMappingNorthbound.class)) {
- // export the service
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("name", "mappingservice");
- c.setInterface(new String[] { ILispmappingNorthbound.class.getName() }, props);
- c.add(createContainerServiceDependency(containerName).setService(IFlowMapping.class)
- .setCallbacks("setFlowMappingService", "unsetFlowMappingService").setRequired(true));
- }
- }
-
- /**
- * Method which tells how many Global implementations are supported by the
- * bundle. This way we can tune the number of components created. This
- * components will be created ONLY at the time of bundle startup and will be
- * 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
- */
- @Override
- protected Object[] getGlobalImplementations() {
- return null;
- }
-
- /**
- * Configure the dependency for a given instance Global
- *
- * @param c
- * Component assigned for this instance, this will be what will
- * be used for configuration
- * @param imp
- * implementation to be configured
- * @param containerName
- * container on which the configuration happens
- */
- @Override
- protected void configureGlobalInstance(Component c, Object imp) {
-
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.lispflowmapping.northbound;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.opendaylight.lispflowmapping.type.lisp.address.LispAddressGeneric;
-
-@XmlRootElement(name="AuthKeyNB")
-@XmlAccessorType(XmlAccessType.NONE)
-
-public class AuthKeyNB {
-
-
- @XmlElement
- String key;
-
- @XmlElement
- int maskLength;
-
- @XmlElement
- LispAddressGeneric address;
-
- public String getKey() {
- return key;
- }
-
- public void setKey(String key) {
- this.key = key;
- }
-
- public int getMaskLength() {
- return maskLength;
- }
-
- public void setMaskLength(int maskLength) {
- this.maskLength = maskLength;
- }
-
- public LispAddressGeneric getAddress() {
- return address;
- }
-
- public void setAddress(LispAddressGeneric address) {
- this.address = address;
- }
-
-
-
-
-
-
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.northbound;
-
-import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
-
-public interface ILispmappingNorthbound {
-
- public IFlowMapping getMappingService();
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.northbound;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
-import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
-import org.opendaylight.lispflowmapping.type.lisp.EidToLocatorRecord;
-import org.opendaylight.lispflowmapping.type.lisp.LocatorRecord;
-import org.opendaylight.lispflowmapping.type.lisp.MapRegister;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispASAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispAddressGeneric;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispApplicationDataLCAFAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispDistinguishedNameAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispIpv4Address;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispIpv6Address;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispListLCAFAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispMACAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispSegmentLCAFAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispSourceDestLCAFAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispTrafficEngineeringLCAFAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.ReencapHop;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LispAddressConvertorNB {
-
- protected static final Logger LOG = LoggerFactory.getLogger(LispAddressConvertorNB.class);
-
-
-public static LispAddress convertToLispAddress(LispAddressGeneric generic){
-
- if (generic == null){
- LOG.warn("Couldn't convert address, generic address is null");
- return null;
- }
-
- LispAddress lispAddress = null;
-
- AddressFamilyNumberEnum afiEnum = AddressFamilyNumberEnum.valueOf((short) generic.getAfi());
-
- switch (afiEnum) {
-
- case IP:
- lispAddress = new LispIpv4Address(generic.getIpAddress());
- if (((LispIpv4Address)lispAddress).getAddress() == null){
- throw new IllegalArgumentException("Convertor was unable to convert address");
- }
- break;
- case AS:
- lispAddress = new LispASAddress(generic.getAsNum());
- break;
- case IP6:
- lispAddress = new LispIpv6Address(generic.getIpAddress());
- if (((LispIpv6Address)lispAddress).getAddress() == null){
- throw new IllegalArgumentException("Convertor was unable to convert address");
- }
- break;
- case MAC:
- lispAddress = new LispMACAddress(generic.getMac());
- break;
- case DISTINGUISHED_NAME:
- lispAddress = new LispDistinguishedNameAddress(generic.getDistinguishedName());
- break;
- case LCAF:
- LispCanonicalAddressFormatEnum lcafEnum =
- LispCanonicalAddressFormatEnum.valueOf(generic.getLcafType());
- switch (lcafEnum){
- case APPLICATION_DATA:
- lispAddress = convertToApplicationData(generic);
- break;
- case LIST:
- lispAddress = convertToList(generic);
- break;
- case SEGMENT:
- lispAddress = convertToSegment(generic);
- break;
- case SOURCE_DEST:
- lispAddress = convertToSrcDst(generic);
- break;
- case TRAFFIC_ENGINEERING:
- lispAddress = convertToTE(generic);
- break;
- default:
- throw new IllegalArgumentException("LCAF type " + lcafEnum +
- " not supported by this convertor: convertToLispAddress(LispAddressGeneric generic)");
- }
- break;
- default:
- throw new IllegalArgumentException("AFI " + afiEnum +
- " not supported by this convertor: convertToLispAddress(LispAddressGeneric generic)");
- }
-
-
-
- return lispAddress;
- }
-
-private static LispApplicationDataLCAFAddress convertToApplicationData(LispAddressGeneric generic){
- return new LispApplicationDataLCAFAddress(
- (byte) 0, generic.getProtocol(), generic.getIpTos(), generic.getLocalPort(),
- generic.getRemotePort(), convertToLispAddress(generic.getAddress()));
-}
-
-private static LispListLCAFAddress convertToList(LispAddressGeneric generic){
- List<LispAddress> list = new ArrayList<LispAddress>();
-
- for (int i=0;i<generic.getAddresses().size();i++){
- list.add(convertToLispAddress(generic.getAddresses().get(i)));
- }
-
- return new LispListLCAFAddress((byte) 0, list);
-}
-
-private static LispSegmentLCAFAddress convertToSegment(LispAddressGeneric generic){
- return new LispSegmentLCAFAddress(generic.getIidMaskLength(), generic.getInstanceId(),
- convertToLispAddress(generic.getAddress()));
-}
-
-private static LispSourceDestLCAFAddress convertToSrcDst(LispAddressGeneric generic){
- return new LispSourceDestLCAFAddress((byte)0, (short)0, generic.getSrcMaskLength(),
- generic.getDstMaskLength(), convertToLispAddress(generic.getSrcAddress()),
- convertToLispAddress(generic.getDstAddress()));
-}
-
-
-
-private static LispTrafficEngineeringLCAFAddress convertToTE(LispAddressGeneric generic){
- List<ReencapHop> listHops = new ArrayList<ReencapHop>();
- ReencapHop hop;
-
- for (int i=0;i<generic.getHops().size();i++){
- hop = new ReencapHop(
- convertToLispAddress(generic.getHops().get(i).getAddress()), (short) 0,
- generic.getHops().get(i).isLookup(), generic.getHops().get(i).isRLOCProbe(), generic.getHops().get(i).isStrict());
- listHops.add(hop);
- }
- return new LispTrafficEngineeringLCAFAddress((byte)0, listHops);
-}
-
-
-
-
-
-public static void convertGenericToLispAddresses(MapRegister mapRegister){
- LispAddress EID;
- LispAddressGeneric EIDGeneric;
-
- List<LocatorRecord> locRecordList;
- LispAddress RLOC;
- LispAddressGeneric RLOCGeneric;
-
- if (mapRegister == null){
- LOG.warn("Couldn't convert addresses, mapRegister is null");
- return;
- }
-
- int EIDtoLocatorRecordCount = mapRegister.getEidToLocatorRecords().size();
-
- for (int i=0;i<EIDtoLocatorRecordCount;i++){
- EIDGeneric = mapRegister.getEidToLocatorRecords().get(i).getPrefixGeneric();
-
- EID = convertToLispAddress(EIDGeneric);
-
- mapRegister.getEidToLocatorRecords().get(i).setPrefix(EID);
- locRecordList = mapRegister.getEidToLocatorRecords().get(i).getLocators();
-
- for(int j=0;j<locRecordList.size();j++){
-
- RLOCGeneric = locRecordList.get(j).getLocatorGeneric();
-
- RLOC = convertToLispAddress(RLOCGeneric);
- locRecordList.get(j).setLocator(RLOC);
- }
-
- }
-}
-
-
-public static void convertRecordToGenericAddress(EidToLocatorRecord record){
-
- LispAddress EID;
- List<LocatorRecord> locRecordList;
- LispAddress RLOC;
-
- if (record == null){
- LOG.warn("Couldn't convert addresses, record is null");
- return;
- }
-
- EID = record.getPrefix();
- record.setPrefixGeneric(new LispAddressGeneric(EID));
-
- locRecordList = record.getLocators();
- for(int j=0;j<locRecordList.size();j++){
-
- RLOC = locRecordList.get(j).getLocator();
- locRecordList.get(j).setLocatorGeneric(new LispAddressGeneric(RLOC));
- }
-}
-
-
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.lispflowmapping.northbound;
-
-import java.util.List;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.SecurityContext;
-
-import org.codehaus.enunciate.jaxrs.ResponseCode;
-import org.codehaus.enunciate.jaxrs.StatusCodes;
-import org.codehaus.enunciate.jaxrs.TypeHint;
-import org.opendaylight.controller.containermanager.IContainerManager;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.InternalServerErrorException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.northbound.commons.exception.UnauthorizedException;
-import org.opendaylight.controller.northbound.commons.utils.NorthboundUtils;
-import org.opendaylight.controller.sal.authorization.Privilege;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
-import org.opendaylight.lispflowmapping.implementation.util.MaskUtil;
-import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
-import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
-import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
-import org.opendaylight.lispflowmapping.type.lisp.EidRecord;
-import org.opendaylight.lispflowmapping.type.lisp.MapRequest;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispAddressGeneric;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispIpv4Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.MapNotify;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.MapReply;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.eidtolocatorrecords.EidToLocatorRecord;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.LispAddressContainer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@Path("/")
-public class LispMappingNorthbound implements ILispmappingNorthbound {
- protected static final Logger LOG = LoggerFactory.getLogger(LispMappingNorthbound.class);
- private IFlowMapping mappingService;
-
- private String userName;
-
- // Based on code from controller project
- @Context
- public void setSecurityContext(SecurityContext context) {
- if (context != null && context.getUserPrincipal() != null) {
- userName = context.getUserPrincipal().getName();
- }
- }
-
- protected String getUserName() {
- return userName;
- }
-
- public IFlowMapping getMappingService() {
- return this.mappingService;
- }
-
- void setFlowMappingService(IFlowMapping mappingService) {
- LOG.trace("FlowMapping set in LispNorthbound");
- this.mappingService = mappingService;
- }
-
- void unsetFlowMappingService(IFlowMapping mappingService) {
- LOG.trace("LispDAO was unset in LISP Northbound");
- this.mappingService = null;
- }
-
- public void init() {
- LOG.trace("LISP Northbound Service is initialized!");
- }
-
- public void start() {
- LOG.info("LISP Northbound Service is up!");
- }
-
- public void stop() {
- LOG.info("LISP Northbound Service is down!");
- }
-
- public void destroy() {
- LOG.trace("LISP Northbound Service is destroyed!");
- mappingService = null;
- }
-
- // Based on code from controller project
- private void handleContainerDoesNotExist(String containerName) {
- IContainerManager containerManager = (IContainerManager) ServiceHelper.getGlobalInstance(IContainerManager.class, this);
- if (containerManager == null) {
- throw new ServiceUnavailableException("Container " + containerName + RestMessages.NOCONTAINER.toString());
- }
-
- List<String> containerNames = containerManager.getContainerNames();
- for (String cName : containerNames) {
- if (cName.trim().equalsIgnoreCase(containerName.trim())) {
- return;
- }
- }
-
- throw new ResourceNotFoundException("Container " + containerName + " " + RestMessages.NOCONTAINER.toString());
- }
-
- private void authorizationCheck(String containerName, Privilege privilege) {
-
- if (!NorthboundUtils.isAuthorized(getUserName(), containerName, privilege, this)) {
- throw new UnauthorizedException("User is not authorized to perform this operation on container " + containerName);
- }
- }
-
- private EidToLocatorRecord lookupEID(String containerName, int mask, LispAddress EID) {
-
- ILispmappingNorthbound nbService = (ILispmappingNorthbound) ServiceHelper.getInstance(ILispmappingNorthbound.class, containerName, this);
-
- MapRequest mapRequest = new MapRequest();
- EidRecord EIDRecord = new EidRecord((byte) mask, EID);
- mapRequest.addEidRecord(EIDRecord);
- mapRequest.setSourceEid(new LispIpv4Address("127.0.0.1"));
-
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.MapRequest mr = YangTransformerNB.transformMapRequest(mapRequest);
- MapReply mapReply;
- try {
- mapReply = nbService.getMappingService().handleMapRequest(mr);
- } catch (Exception e) {
- throw new InternalServerErrorException(RestMessages.INTERNALERROR.toString() + " : There was an error looking up the EID");
- }
-
- if (mapReply == null) {
- throw new InternalServerErrorException(RestMessages.INTERNALERROR.toString() + " : There was an error looking up the EID");
- }
-
- return mapReply.getEidToLocatorRecord().get(0);
- }
-
- private void keyCheck(IFlowMapping mappingService, MapRegisterNB mapRegisterNB) {
-
- String usedKey = mapRegisterNB.getKey();
-
- LispAddressGeneric lispAddressGeneric;
- LispAddress lispAddress;
- int mask;
- String storedKey;
-
- int numEidRecords = mapRegisterNB.getMapRegister().getEidToLocatorRecords().size();
-
- for (int i = 0; i < numEidRecords; i++) {
-
- lispAddressGeneric = mapRegisterNB.getMapRegister().getEidToLocatorRecords().get(i).getPrefixGeneric();
-
- try {
- lispAddress = LispAddressConvertorNB.convertToLispAddress(lispAddressGeneric);
- } catch (Exception e) {
- throw new BadRequestException(RestMessages.INVALIDDATA.toString() + " : Address is not valid");
- }
- mask = mapRegisterNB.getMapRegister().getEidToLocatorRecords().get(i).getMaskLength();
- try {
- storedKey = mappingService.getAuthenticationKey(YangTransformerNB.transformLispAddress(lispAddress), mask);
- } catch (Exception e) {
- throw new InternalServerErrorException(RestMessages.INTERNALERROR.toString() + " : There was an error while retrieving the key");
- }
-
- if (!usedKey.equals(storedKey)) {
- throw new UnauthorizedException("The key used to register the mapping " + "does not match with the stored key for that mapping");
- }
- }
- }
-
- /**
- * Add a mapping to the LISP mapping system
- *
- * @param containerName
- * name of the container context in which the mapping needs to be
- * added
- * @param mapRegisterNB
- * JSON object that contains the mapping information
- *
- * @return Text plain confirming reception
- *
- * <pre>
- * Example:
- *
- * Request URL:
- * http://localhost:8080/lispflowmapping/nb/v2/default/mapping
- *
- * Request body in JSON:
- *
- * {
- * "key" : "asdf",
- * "mapregister" :
- * {
- * "wantMapNotify" : true,
- * "proxyMapReply" : false,
- * "eidToLocatorRecords" :
- * [
- * {
- * "authoritative" : true,
- * "prefixGeneric" :
- * {
- * "ipAddress" : "10.0.0.1",
- * "afi" : 1
- * },
- * "mapVersion" : 3,
- * "maskLength" : 32,
- * "action" : "NoAction",
- * "locators" :
- * [
- * {
- * "multicastPriority" : 3,
- * "locatorGeneric" :
- * {
- * "ipAddress" : "3.3.3.3",
- * "afi" : 1
- * },
- * "routed" : true,
- * "multicastWeight" : 3,
- * "rlocProbed" : false,
- * "localLocator" : false,
- * "priority" : 3,
- * "weight" : 3
- * }
- * ],
- * "recordTtl" : 3
- * }
- * ],
- * "nonce" : 3,
- * "keyId" : 0
- * }
- * }
- * </pre>
- */
-
- @Path("/{containerName}/mapping")
- @PUT
- @Consumes(MediaType.APPLICATION_JSON)
- @StatusCodes({ @ResponseCode(code = 400, condition = "Invalid data passed"),
- @ResponseCode(code = 401, condition = "User not authorized to perform this operation"),
- @ResponseCode(code = 404, condition = "The containerName passed was not found"),
- @ResponseCode(code = 500, condition = "Internal Server Error: Addition of mapping failed"),
- @ResponseCode(code = 503, condition = "Service unavailable") })
- public Response addMapping(@PathParam("containerName") String containerName, @TypeHint(MapRegisterNB.class) MapRegisterNB mapRegisterNB) {
-
- handleContainerDoesNotExist(containerName);
-
- authorizationCheck(containerName, Privilege.WRITE);
-
- ILispmappingNorthbound nbService = (ILispmappingNorthbound) ServiceHelper.getInstance(ILispmappingNorthbound.class, containerName, this);
-
- try {
- keyCheck(nbService.getMappingService(), mapRegisterNB);
-
- LispAddressConvertorNB.convertGenericToLispAddresses(mapRegisterNB.getMapRegister());
- } catch (Exception e) {
- throw new BadRequestException(RestMessages.INVALIDDATA.toString() + " : Address is not valid");
- }
- // Always request MapNotify
- mapRegisterNB.getMapRegister().setWantMapNotify(true);
-
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.MapRegister mr = null;
- try {
- mr = YangTransformerNB.transformMapRegister(mapRegisterNB.getMapRegister());
- } catch (Exception e) {
- throw new InternalServerErrorException(RestMessages.INTERNALERROR.toString() + " : There was an error while converting the map register");
-
- }
- MapNotify mapNotify;
- try {
- mapNotify = nbService.getMappingService().handleMapRegister(mr);
- } catch (Exception e) {
- throw new InternalServerErrorException(RestMessages.INTERNALERROR.toString() + " : There was an error while registering the mapping");
- }
-
- if (mapNotify == null) {
- throw new InternalServerErrorException(RestMessages.INTERNALERROR.toString() + " : There was an error while registering the mapping");
- }
- return Response.status(Response.Status.OK).build();
- }
-
- /**
- * Delete a mapping from the LISP Map-Server database
- *
- * @param containerName
- * name of the container context from which the key is going to
- * be deleted
- *
- * @param afi
- * Address Family of the address (IPv4, IPv6 or MAC)
- *
- * @param address
- * Address of type defined by afi
- *
- * @param mask
- * Network mask length
- *
- * @return Text plain confirming deletion
- *
- * <pre>
- * Example:
- *
- * Request URL:
- * http://localhost:8080/lispflowmapping/nb/v2/default/mapping/0/1/10.0.0.1/32
- *
- * </pre>
- */
-
- @Path("/{containerName}/mapping/{iid}/{afi}/{address}/{mask}")
- @DELETE
- @Consumes(MediaType.APPLICATION_JSON)
- @StatusCodes({ @ResponseCode(code = 400, condition = "Invalid data passed"),
- @ResponseCode(code = 401, condition = "User not authorized to perform this operation"),
- @ResponseCode(code = 404, condition = "The containerName passed was not found"),
- @ResponseCode(code = 500, condition = "Internal Server Error: Addition of mapping failed"),
- @ResponseCode(code = 503, condition = "Service unavailable") })
- public Response deleteMapping(@PathParam("containerName") String containerName, @PathParam("iid") int iid,
- @PathParam("afi") int afi, @PathParam("address") String address, @PathParam("mask") int mask) {
-
- handleContainerDoesNotExist(containerName);
- authorizationCheck(containerName, Privilege.WRITE);
-
- LispAddressGeneric eidGeneric = parseAddressURL(iid, afi, address, mask);
- LispAddress eid;
- try {
- eid = LispAddressConvertorNB.convertToLispAddress(eidGeneric);
- } catch (Exception e) {
- throw new BadRequestException(RestMessages.INVALIDDATA.toString() + " : Address is not valid");
- }
-
- ILispmappingNorthbound nbService = (ILispmappingNorthbound) ServiceHelper.getInstance(ILispmappingNorthbound.class, containerName, this);
-
- try {
- nbService.getMappingService().removeMapping(YangTransformerNB.transformLispAddress(eid), mask);
- } catch (Exception e) {
- throw new InternalServerErrorException(RestMessages.INTERNALERROR.toString() + " : There was an error while deleting the key");
- }
-
- return Response.status(Response.Status.OK).build();
- }
-
-
- /**
- * Retrieve a mapping from the LISP mapping system
- *
- * @param containerName
- * name of the container context from which the mapping is going
- * to be retrieved
- * @param iid
- * Instance-ID of the address (0 if none)
- *
- * @param afi
- * Address Family of the address (IPv4, IPv6 or MAC)
- *
- * @param address
- * Address of type defined by afi
- *
- * @param mask
- * Network mask length
- *
- * @return EidToLocatorRecord as a JSON object
- *
- * <pre>
- * Example:
- *
- * Request URL:
- * http://localhost:8080/lispflowmapping/nb/v2/default/mapping/0/1/10.0.0.1/32
- *
- * </pre>
- */
-
- private LispAddressGeneric parseAddressURL(int iid, int afi, String address, int mask) {
- LispAddressGeneric eidGeneric = new LispAddressGeneric(afi, address);
-
- if (iid != 0) {
- eidGeneric = new LispAddressGeneric(AddressFamilyNumberEnum.LCAF.getIanaCode(), eidGeneric);
- eidGeneric.setLcafType(LispCanonicalAddressFormatEnum.SEGMENT.getLispCode());
- eidGeneric.setInstanceId(iid);
- // XXX since we can't set iid mask length in the URL, set default to max mask corresponding to afi
- eidGeneric.setIidMaskLength(MaskUtil.getMaxMaskForAfi(afi));
- }
- return eidGeneric;
- }
-
- private LispAddressGeneric parseSrcDstAddressURL(int iid, int afi, String srcAdd, int srcML, String dstAdd, int dstML) {
- LispAddressGeneric srcGeneric = new LispAddressGeneric(afi, srcAdd);
- LispAddressGeneric dstGeneric = new LispAddressGeneric(afi, dstAdd);
-
- if (iid != 0) {
- srcGeneric = new LispAddressGeneric(AddressFamilyNumberEnum.LCAF.getIanaCode(), srcGeneric);
- srcGeneric.setLcafType(LispCanonicalAddressFormatEnum.SEGMENT.getLispCode());
- srcGeneric.setInstanceId(iid);
-
- dstGeneric = new LispAddressGeneric(AddressFamilyNumberEnum.LCAF.getIanaCode(), dstGeneric);
- dstGeneric.setLcafType(LispCanonicalAddressFormatEnum.SEGMENT.getLispCode());
- dstGeneric.setInstanceId(iid);
- }
-
- LispAddressGeneric address = new LispAddressGeneric(AddressFamilyNumberEnum.LCAF.getIanaCode());
-
- address.setLcafType(LispCanonicalAddressFormatEnum.SOURCE_DEST.getLispCode());
- address.setSrcAddress(srcGeneric);
- address.setSrcMaskLength((byte) srcML);
- address.setDstAddress(dstGeneric);
- address.setDstMaskLength((byte) dstML);
-
- return address;
- }
-
- @Path("/{containerName}/mapping/{iid}/{afi}/{address}/{mask}")
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- @StatusCodes({ @ResponseCode(code = 401, condition = "User not authorized to perform this operation"),
- @ResponseCode(code = 400, condition = "Invalid data passed"),
- @ResponseCode(code = 404, condition = "The containerName passed was not found"),
- @ResponseCode(code = 500, condition = "Internal Server Error: Get mapping failed"),
- @ResponseCode(code = 503, condition = "Service unavailable") })
- public org.opendaylight.lispflowmapping.type.lisp.EidToLocatorRecord getMapping(@PathParam("containerName") String containerName,
- @PathParam("iid") int iid, @PathParam("afi") int afi, @PathParam("address") String address, @PathParam("mask") int mask) {
-
- handleContainerDoesNotExist(containerName);
-
- authorizationCheck(containerName, Privilege.READ);
-
- LispAddressGeneric eidGeneric = parseAddressURL(iid, afi, address, mask);
-
- LispAddress eid;
- try {
- eid = LispAddressConvertorNB.convertToLispAddress(eidGeneric);
- } catch (Exception e) {
- throw new BadRequestException(RestMessages.INVALIDDATA.toString() + " : Address is not valid");
- }
-
- EidToLocatorRecord record = lookupEID(containerName, mask, eid);
-
- org.opendaylight.lispflowmapping.type.lisp.EidToLocatorRecord legacyRecord = YangTransformerNB.reTransformEidToLocatorRecord(record);
- LispAddressConvertorNB.convertRecordToGenericAddress(legacyRecord);
-
- return legacyRecord;
- }
-
- /**
- * Retrieve a mapping from the LISP mapping system, using Source-Destination
- * LCAF as EID
- *
- * @param containerName
- * name of the container context from which the mapping is going
- * to be retrieved
- * @param iid
- * Instance-ID of the addresses (0 if none)
- *
- * @param afi
- * Address Family of the addresses (IPv4, IPv6 or MAC)
- *
- * @param srcAdd
- * Source address of type defined by afi
- *
- * @param srcML
- * Network mask length of the source address
- *
- * @param dstAdd
- * Destination address of type defined by afi
- *
- * @param dstML
- * Network mask length of the destination address
- *
- * @return EidToLocatorRecord as a JSON object
- *
- * <pre>
- * Example:
- *
- * Request URL:
- *
- * http://localhost:8080/lispflowmapping/nb/v2/default/mapping/0/1/10.0.0.1/32/20.0.0.2/32
- *
- * </pre>
- */
-
- @Path("/{containerName}/mapping/{iid}/{afi}/{srcAdd}/{srcML}/{dstAdd}/{dstML}")
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- @StatusCodes({ @ResponseCode(code = 401, condition = "User not authorized to perform this operation"),
- @ResponseCode(code = 404, condition = "The containerName passed was not found"),
- @ResponseCode(code = 503, condition = "Service unavailable") })
- public org.opendaylight.lispflowmapping.type.lisp.EidToLocatorRecord getMapping(@PathParam("containerName") String containerName,
- @PathParam("iid") int iid, @PathParam("afi") int afi, @PathParam("srcAdd") String srcAdd, @PathParam("srcML") int srcML,
- @PathParam("dstAdd") String dstAdd, @PathParam("dstML") int dstML) {
-
- handleContainerDoesNotExist(containerName);
-
- authorizationCheck(containerName, Privilege.READ);
-
- LispAddressGeneric eidGeneric = parseSrcDstAddressURL(iid, afi, srcAdd, srcML, dstAdd, dstML);
-
- int mask = 0; // Not used here
-
- EidToLocatorRecord record = lookupEID(containerName, mask, LispAddressConvertorNB.convertToLispAddress(eidGeneric));
-
- org.opendaylight.lispflowmapping.type.lisp.EidToLocatorRecord legacyRecord = YangTransformerNB.reTransformEidToLocatorRecord(record);
- LispAddressConvertorNB.convertRecordToGenericAddress(legacyRecord);
-
- return legacyRecord;
- }
-
- /**
- * Set the authentication key for an EID prefix
- *
- * @param containerName
- * name of the container context in which the key needs to be set
- * @param authKeyNB
- * JSON object that contains the key information
- *
- * @return Text plain confirming reception
- *
- * <pre>
- * Example:
- *
- * Request URL:
- * http://localhost:8080/lispflowmapping/nb/v2/default/key
- *
- * Request body in JSON:
- *
- * {
- * "key" : "asdf",
- * "maskLength" : 24,
- * "address" :
- * {
- * "ipAddress" : "10.0.0.1",
- * "afi" : 1
- * }
- * }
- *
- * </pre>
- */
-
- @Path("/{containerName}/key")
- @PUT
- @Consumes(MediaType.APPLICATION_JSON)
- @StatusCodes({ @ResponseCode(code = 401, condition = "User not authorized to perform this operation"),
- @ResponseCode(code = 400, condition = "Invalid data passed"),
- @ResponseCode(code = 404, condition = "The containerName passed was not found"),
- @ResponseCode(code = 500, condition = "Internal Server Error: Addition of key failed"),
- @ResponseCode(code = 503, condition = "Service unavailable") })
- public Response addAuthKey(@PathParam("containerName") String containerName, @TypeHint(AuthKeyNB.class) AuthKeyNB authKeyNB) {
-
- handleContainerDoesNotExist(containerName);
-
- authorizationCheck(containerName, Privilege.WRITE);
-
- LispAddress lispAddress;
- try {
- lispAddress = LispAddressConvertorNB.convertToLispAddress(authKeyNB.getAddress());
- } catch (Exception e) {
- throw new BadRequestException(RestMessages.INVALIDDATA.toString() + " : Address is not valid");
- }
- ILispmappingNorthbound nbService = (ILispmappingNorthbound) ServiceHelper.getInstance(ILispmappingNorthbound.class, containerName, this);
-
- try {
-
- nbService.getMappingService().addAuthenticationKey(YangTransformerNB.transformLispAddress(lispAddress), authKeyNB.getMaskLength(),
- authKeyNB.getKey());
- } catch (Exception e) {
- throw new InternalServerErrorException(RestMessages.INTERNALERROR.toString() + " : There was an error while adding the key");
- }
-
- return Response.status(Response.Status.OK).build();
- }
-
- /**
- * Retrieve the key used to register an EID prefix
- *
- * @param containerName
- * name of the container context from which the key is going to
- * be retrieved
- *
- * @param afi
- * Address Family of the address (IPv4, IPv6 or MAC)
- *
- * @param address
- * Address of type defined by afi
- *
- * @param mask
- * Network mask length
- *
- * @return AuthKeyNB as a JSON object
- *
- * <pre>
- * Example:
- *
- * Request URL:
- * http://localhost:8080/lispflowmapping/nb/v2/default/key/0/1/10.0.0.1/32
- *
- * </pre>
- */
-
- @Path("/{containerName}/key/{iid}/{afi}/{address}/{mask}")
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- @StatusCodes({ @ResponseCode(code = 401, condition = "User not authorized to perform this operation"),
- @ResponseCode(code = 400, condition = "Invalid data passed"),
- @ResponseCode(code = 404, condition = "The containerName passed was not found"),
- @ResponseCode(code = 500, condition = "Internal Server Error: Get key failed"),
- @ResponseCode(code = 503, condition = "Service unavailable") })
- public AuthKeyNB getAuthKey(@PathParam("containerName") String containerName, @PathParam("iid") int iid, @PathParam("afi") int afi,
- @PathParam("address") String address, @PathParam("mask") int mask) {
-
- handleContainerDoesNotExist(containerName);
-
- authorizationCheck(containerName, Privilege.READ);
-
- LispAddressGeneric lispAddressGeneric = parseAddressURL(iid, afi, address, mask);
-
- LispAddress lispAddress;
-
- try {
- lispAddress = LispAddressConvertorNB.convertToLispAddress(lispAddressGeneric);
- } catch (Exception e) {
- throw new BadRequestException(RestMessages.INVALIDDATA.toString() + " : Address is not valid");
- }
- ILispmappingNorthbound nbService = (ILispmappingNorthbound) ServiceHelper.getInstance(ILispmappingNorthbound.class, containerName, this);
-
- String key;
- try {
- key = nbService.getMappingService().getAuthenticationKey(YangTransformerNB.transformLispAddress(lispAddress), mask);
- } catch (Exception e) {
- throw new InternalServerErrorException(RestMessages.INTERNALERROR.toString() + " : There was an error while retrieving the key");
- }
-
- if (key == null) {
- throw new ResourceNotFoundException(RestMessages.NORESOURCE.toString() + " : The requested key was not found");
- }
-
- AuthKeyNB authKeyNB = new AuthKeyNB();
-
- authKeyNB.setKey(key);
- authKeyNB.setAddress(lispAddressGeneric);
- authKeyNB.setMaskLength(mask);
-
- return authKeyNB;
- }
-
- /**
- * Retrieve a key used to register a Source-Destination LCAF EID prefix
- *
- * @param containerName
- * name of the container context from which the key is going to
- * be retrieved
- *
- * @param afi
- * Address Family of the addresses (IPv4, IPv6 or MAC)
- *
- * @param srcAdd
- * Source address of type defined by afi
- *
- * @param srcML
- * Network mask length of the source address
- *
- * @param dstAdd
- * Destination address of type defined by afi
- *
- * @param dstML
- * Network mask length of the destination address
- *
- * @return AuthKeyNB as a JSON object
- *
- * <pre>
- * Example:
- *
- * Request URL:
- *
- * http://localhost:8080/lispflowmapping/nb/v2/default/key/0/1/10.0.0.1/32/20.0.0.2/32
- *
- * </pre>
- */
-
- @Path("/{containerName}/key/{iid}/{afi}/{srcAdd}/{srcML}/{dstAdd}/{dstML}")
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- @StatusCodes({ @ResponseCode(code = 401, condition = "User not authorized to perform this operation"),
- @ResponseCode(code = 404, condition = "The containerName passed was not found"),
- @ResponseCode(code = 503, condition = "Service unavailable") })
- public AuthKeyNB getAuthKey(@PathParam("containerName") String containerName, @PathParam("iid") int iid, @PathParam("afi") int afi,
- @PathParam("srcAdd") String srcAdd, @PathParam("srcML") int srcML, @PathParam("dstAdd") String dstAdd, @PathParam("dstML") int dstML) {
-
- handleContainerDoesNotExist(containerName);
-
- authorizationCheck(containerName, Privilege.READ);
-
- LispAddressGeneric lispAddressGeneric = parseSrcDstAddressURL(iid, afi, srcAdd, srcML, dstAdd, dstML);
-
- LispAddress lispAddress = LispAddressConvertorNB.convertToLispAddress(lispAddressGeneric);
-
- ILispmappingNorthbound nbService = (ILispmappingNorthbound) ServiceHelper.getInstance(ILispmappingNorthbound.class, containerName, this);
-
- int mask = 0; // Not used here
-
- LispAddressContainer yangAddress = YangTransformerNB.transformLispAddress(lispAddress);
-
- String key = nbService.getMappingService().getAuthenticationKey(yangAddress, mask);
-
- if (key == null) {
- throw new ResourceNotFoundException(RestMessages.NORESOURCE.toString() + " : The requested key was not found");
- }
-
- AuthKeyNB authKeyNB = new AuthKeyNB();
-
- authKeyNB.setKey(key);
- authKeyNB.setAddress(lispAddressGeneric);
- authKeyNB.setMaskLength(mask);
-
- return authKeyNB;
- }
-
- /**
- * Delete the key used to register an EID prefix
- *
- * @param containerName
- * name of the container context from which the key is going to
- * be deleted
- *
- * @param afi
- * Address Family of the address (IPv4, IPv6 or MAC)
- *
- * @param address
- * Address of type defined by afi
- *
- * @param mask
- * Network mask length
- *
- * @return Text plain confirming deletion
- *
- * <pre>
- * Example:
- *
- * Request URL:
- * http://localhost:8080/lispflowmapping/nb/v2/default/key/0/1/10.0.0.1/32
- *
- * </pre>
- */
-
- @Path("/{containerName}/key/{iid}/{afi}/{address}/{mask}")
- @DELETE
- @StatusCodes({ @ResponseCode(code = 401, condition = "User not authorized to perform this operation"),
- @ResponseCode(code = 400, condition = "Invalid data passed"),
- @ResponseCode(code = 404, condition = "The containerName passed was not found"),
- @ResponseCode(code = 500, condition = "Internal Server Error: Delete key failed"),
- @ResponseCode(code = 503, condition = "Service unavailable") })
- public Response delAuthKey(@PathParam("containerName") String containerName, @PathParam("afi") int afi, @PathParam("iid") int iid,
- @PathParam("address") String address, @PathParam("mask") int mask) {
-
- handleContainerDoesNotExist(containerName);
-
- authorizationCheck(containerName, Privilege.WRITE);
-
- LispAddressGeneric lispAddressGeneric = parseAddressURL(iid, afi, address, mask);
-
- LispAddress lispAddress;
- try {
- lispAddress = LispAddressConvertorNB.convertToLispAddress(lispAddressGeneric);
- } catch (Exception e) {
- throw new BadRequestException(RestMessages.INVALIDDATA.toString() + " : Address is not valid");
- }
-
- ILispmappingNorthbound nbService = (ILispmappingNorthbound) ServiceHelper.getInstance(ILispmappingNorthbound.class, containerName, this);
-
- try {
- nbService.getMappingService().removeAuthenticationKey(YangTransformerNB.transformLispAddress(lispAddress), mask);
- } catch (Exception e) {
- throw new InternalServerErrorException(RestMessages.INTERNALERROR.toString() + " : There was an error while deleting the key");
- }
-
- return Response.status(Response.Status.OK).build();
- }
-
- /**
- * Delete the key used to register an EID prefix
- *
- * @param containerName
- * name of the container context from which the key is going to
- * be retrieved
- *
- * @param afi
- * Address Family of the addresses (IPv4, IPv6 or MAC)
- *
- * @param srcAdd
- * Source address of type defined by afi
- *
- * @param srcML
- * Network mask length of the source address
- *
- * @param dstAdd
- * Destination address of type defined by afi
- *
- * @param dstML
- * Network mask length of the destination address
- *
- * @return AuthKeyNB as a JSON object
- *
- * <pre>
- * Example:
- *
- * Request URL:
- * http://localhost:8080/lispflowmapping/nb/v2/default/key/0/1/10.0.0.1/32/20.0.0.2/32
- *
- * </pre>
- */
-
- @Path("/{containerName}/key/{iid}/{afi}/{srcAdd}/{srcML}/{dstAdd}/{dstML}")
- @DELETE
- @StatusCodes({ @ResponseCode(code = 401, condition = "User not authorized to perform this operation"),
- @ResponseCode(code = 400, condition = "Invalid data passed"),
- @ResponseCode(code = 404, condition = "The containerName passed was not found"),
- @ResponseCode(code = 500, condition = "Internal Server Error: Delete key failed"),
- @ResponseCode(code = 503, condition = "Service unavailable") })
- public Response delAuthKey(@PathParam("containerName") String containerName, @PathParam("iid") int iid, @PathParam("afi") int afi,
- @PathParam("srcAdd") String srcAdd, @PathParam("srcML") int srcML, @PathParam("dstAdd") String dstAdd, @PathParam("dstML") int dstML) {
-
- handleContainerDoesNotExist(containerName);
-
- authorizationCheck(containerName, Privilege.WRITE);
-
- LispAddressGeneric lispAddressGeneric = parseSrcDstAddressURL(iid, afi, srcAdd, srcML, dstAdd, dstML);
-
- LispAddress lispAddress;
- try {
- lispAddress = LispAddressConvertorNB.convertToLispAddress(lispAddressGeneric);
- } catch (Exception e) {
- throw new BadRequestException(RestMessages.INVALIDDATA.toString() + " : Address is not valid");
- }
-
- ILispmappingNorthbound nbService = (ILispmappingNorthbound) ServiceHelper.getInstance(ILispmappingNorthbound.class, containerName, this);
-
- int mask = 0; // Not used here
-
- try {
- nbService.getMappingService().removeAuthenticationKey(YangTransformerNB.transformLispAddress(lispAddress), mask);
- } catch (Exception e) {
- throw new InternalServerErrorException(RestMessages.INTERNALERROR.toString() + " : There was an error while deleting the key");
- }
-
- return Response.status(Response.Status.OK).build();
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.lispflowmapping.northbound;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.opendaylight.lispflowmapping.type.lisp.MapRegister;
-
-@XmlRootElement(name="MapRegisterNB")
-@XmlAccessorType(XmlAccessType.NONE)
-
-public class MapRegisterNB {
-
-
- @XmlElement
- String key;
-
- @XmlElement
- MapRegister mapregister;
-
- public String getKey() {
- return key;
- }
-
- public MapRegister getMapRegister() {
- return mapregister;
- }
-
-
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.northbound;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.ws.rs.core.Application;
-
-public class NorthboundRSApplication extends Application {
-
- @Override
- public Set<Class<?>> getClasses() {
- Set<Class<?>> classes = new HashSet<Class<?>>();
- classes.add(LispMappingNorthbound.class);
- return classes;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.northbound;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.DatatypeConverter;
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.EidToLocatorRecord.Action;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispAFIAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.MapRegister;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.MapRequest;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.eidrecords.EidRecordBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.eidtolocatorrecords.EidToLocatorRecord;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.eidtolocatorrecords.EidToLocatorRecordBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcaflistaddress.Addresses;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcafsourcedestaddress.DstAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcafsourcedestaddress.DstAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcafsourcedestaddress.SrcAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcafsourcedestaddress.SrcAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcaftrafficengineeringaddress.Hops;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcaftrafficengineeringaddress.HopsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.LispAddressContainer;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.as.ASBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.distinguishedname.DistinguishedNameBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.ipv4.Ipv4AddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.ipv6.Ipv6AddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.lcafapplicationdata.LcafApplicationDataAddrBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.lcaflist.LcafListAddrBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.lcafsegment.LcafSegmentAddrBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.lcafsourcedest.LcafSourceDestAddrBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.lcaftrafficengineering.LcafTrafficEngineeringAddrBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.mac.MacAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.no.NoAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispsimpleaddress.PrimitiveAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.locatorrecords.LocatorRecord;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.locatorrecords.LocatorRecordBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.mapregisternotification.MapRegisterBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.maprequest.ItrRloc;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.maprequest.ItrRlocBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.maprequest.SourceEidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.maprequestnotification.MapRequestBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.reencaphop.HopBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
-import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
-import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
-import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
-import org.opendaylight.lispflowmapping.type.lisp.EidRecord;
-import org.opendaylight.lispflowmapping.type.lisp.MapReplyAction;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispASAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispApplicationDataLCAFAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispDistinguishedNameAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispIpv4Address;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispIpv6Address;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispLCAFAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispListLCAFAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispMACAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispNoAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispSegmentLCAFAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispSourceDestLCAFAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispTrafficEngineeringLCAFAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.ReencapHop;
-
-public class YangTransformerNB {
-
- public static LispAFIAddress toAFI(LispAddressContainer container) {
- return LispAFIConvertor.toAFI(container);
- }
-
- public static PrimitiveAddress toPrimitive(LispAFIAddress address) {
- return LispAFIConvertor.toPrimitive(address);
- }
-
- public static LispAFIAddress toAFIfromPrimitive(PrimitiveAddress primitive) {
- return LispAFIConvertor.toAFIfromPrimitive(primitive);
- }
-
- public static LispAddressContainer transformLispAddress(LispAddress lispAddress) {
-
- if (lispAddress == null) {
- return null;
- }
-
- LispAFIAddress lispAFIAddress = null;
- short ianaCode = lispAddress.getAfi().getIanaCode();
-
- switch (lispAddress.getAfi()) {
-
- case IP:
- LispIpv4Address lispIpv4Address = (LispIpv4Address) lispAddress;
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address ipv4Address =
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address(
- lispIpv4Address.getAddress().getHostAddress());
- lispAFIAddress = new Ipv4AddressBuilder().setIpv4Address(ipv4Address).setAfi(ianaCode).build();
- break;
- case NO_ADDRESS:
- lispAFIAddress = new NoAddressBuilder().setAfi(ianaCode).build();
- case AS:
- LispASAddress lispASAddress = (LispASAddress) lispAddress;
- lispAFIAddress = new ASBuilder().setAS(lispASAddress.getAS()).setAfi(ianaCode).build();
- break;
- case DISTINGUISHED_NAME:
- LispDistinguishedNameAddress lispDNAddress = (LispDistinguishedNameAddress) lispAddress;
- lispAFIAddress = new DistinguishedNameBuilder().setDistinguishedName(lispDNAddress.getDistinguishedName()).setAfi(ianaCode).build();
- break;
- case IP6:
- LispIpv6Address lispIpv6Address = (LispIpv6Address) lispAddress;
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address ipv6Address =
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address(
- lispIpv6Address.getAddress().getHostAddress());
- lispAFIAddress = new Ipv6AddressBuilder().setIpv6Address(ipv6Address).setAfi(ianaCode).build();
- break;
-
- case MAC:
- lispAFIAddress = transformLispMACAddress(lispAddress);
- break;
-
- case LCAF:
-
- LispLCAFAddress lispLcafAddress = (LispLCAFAddress) lispAddress;
- LispCanonicalAddressFormatEnum lcafEnum = lispLcafAddress.getType();
-
- switch (lcafEnum) {
- case APPLICATION_DATA:
- lispAFIAddress = transformLispApplicationDataLCAFAddress(lispLcafAddress);
- break;
- case LIST:
- lispAFIAddress = transformLispListLCAFAddress(lispLcafAddress);
- break;
- case SEGMENT:
- lispAFIAddress = transformLispSegmentLCAFAddress(lispLcafAddress);
- break;
- case SOURCE_DEST:
- lispAFIAddress = transformLispSourceDestLCAFAddress(lispLcafAddress);
- break;
- case TRAFFIC_ENGINEERING:
- lispAFIAddress = transformLispTrafficEngineeringLCAFAddress(lispLcafAddress);
- break;
- case UNKNOWN:
- default:
- throw new IllegalArgumentException("LCAF type " + lcafEnum + " not supported by this transoformer");
- }
- break;
-
- case UNKNOWN:
- default:
- throw new IllegalArgumentException("AFI " + lispAddress.getAfi() + " not supported by this transformer");
- }
-
- return LispAFIConvertor.toContainer(lispAFIAddress);
-
- }
-
- public static LispAFIAddress transformLispMACAddress(LispAddress lispAddress) {
- LispMACAddress lispMacAddress = (LispMACAddress) lispAddress;
- StringBuilder sb = new StringBuilder(17);
- for (byte b : lispMacAddress.getMAC()) {
- if (sb.length() > 0)
- sb.append(':');
- sb.append(String.format("%02x", b));
- }
-
- return new MacAddressBuilder().setAfi(lispMacAddress.getAfi().getIanaCode()).setMacAddress(
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress(sb.toString())).build();
- }
-
- public static LispAFIAddress transformLispApplicationDataLCAFAddress(LispLCAFAddress lispLcafAddress) {
- LispApplicationDataLCAFAddress lispApplicationDataLCAFAddress = (LispApplicationDataLCAFAddress) lispLcafAddress;
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcafapplicationdataaddress.Address address;
- address = new org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcafapplicationdataaddress.AddressBuilder().setPrimitiveAddress(
- toPrimitive(toAFI(transformLispAddress(lispApplicationDataLCAFAddress.getAddress())))).build();
- return new LcafApplicationDataAddrBuilder().setAfi(lispLcafAddress.getAfi().getIanaCode())
- .setLcafType((short) lispLcafAddress.getType().getLispCode()).setIpTos(lispApplicationDataLCAFAddress.getIPTos())
- .setLocalPort(new PortNumber((int) lispApplicationDataLCAFAddress.getLocalPort()))
- .setRemotePort(new PortNumber((int) lispApplicationDataLCAFAddress.getRemotePort())).setAddress(address).build();
- }
-
- public static LispAFIAddress transformLispListLCAFAddress(LispLCAFAddress lispLcafAddress) {
-
- LispListLCAFAddress lispListLCAFAddress = (LispListLCAFAddress) lispLcafAddress;
-
- List<Addresses> listAddresses = new ArrayList<Addresses>();
-
- for (int i = 0; i < lispListLCAFAddress.getAddresses().size(); i++) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcaflistaddress.Addresses addresses;
- addresses = new org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcaflistaddress.AddressesBuilder().setPrimitiveAddress(
- toPrimitive(toAFI(transformLispAddress(lispListLCAFAddress.getAddresses().get(i))))).build();
- listAddresses.add(addresses);
- }
-
- return new LcafListAddrBuilder().setAfi(lispLcafAddress.getAfi().getIanaCode()).setLcafType((short) lispLcafAddress.getType().getLispCode())
- .setAddresses(listAddresses).build();
- }
-
- public static LispAFIAddress transformLispSegmentLCAFAddress(LispLCAFAddress lispLcafAddress) {
- LispSegmentLCAFAddress lispSegmentLCAFAddress = (LispSegmentLCAFAddress) lispLcafAddress;
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcafsegmentaddress.Address address;
- address = new org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcafsegmentaddress.AddressBuilder().setPrimitiveAddress(
- toPrimitive(toAFI(transformLispAddress(lispSegmentLCAFAddress.getAddress())))).build();
-
- return new LcafSegmentAddrBuilder().setAfi(lispLcafAddress.getAfi().getIanaCode()).setLcafType((short) lispLcafAddress.getType().getLispCode())
- .setInstanceId((long) lispSegmentLCAFAddress.getInstanceId()).setAddress(address)
- .setIidMaskLength((short)lispSegmentLCAFAddress.getIdMaskLen()).build();
- }
-
- public static LispAFIAddress transformLispSourceDestLCAFAddress(LispLCAFAddress lispLcafAddress) {
- LispSourceDestLCAFAddress lispSourceDestLCAFAddress = (LispSourceDestLCAFAddress) lispLcafAddress;
-
- SrcAddress srcAddress = new SrcAddressBuilder().setPrimitiveAddress(
- toPrimitive(toAFI(transformLispAddress(lispSourceDestLCAFAddress.getSrcAddress())))).build();
-
- DstAddress dstAddress = new DstAddressBuilder().setPrimitiveAddress(
- toPrimitive(toAFI(transformLispAddress(lispSourceDestLCAFAddress.getDstAddress())))).build();
-
- return new LcafSourceDestAddrBuilder().setAfi(lispLcafAddress.getAfi().getIanaCode())
- .setLcafType((short) lispLcafAddress.getType().getLispCode()).setSrcMaskLength((short) lispSourceDestLCAFAddress.getSrcMaskLength())
- .setDstMaskLength((short) lispSourceDestLCAFAddress.getDstMaskLength()).setSrcAddress(srcAddress).setDstAddress(dstAddress).build();
- }
-
- public static LispAFIAddress transformLispTrafficEngineeringLCAFAddress(LispLCAFAddress lispLcafAddress) {
- LispTrafficEngineeringLCAFAddress lispTrafficEngineeringLCAFAddress = (LispTrafficEngineeringLCAFAddress) lispLcafAddress;
-
- List<Hops> listHops = new ArrayList<Hops>();
-
- for (int i = 0; i < lispTrafficEngineeringLCAFAddress.getHops().size(); i++) {
- ReencapHop reencapHop = lispTrafficEngineeringLCAFAddress.getHops().get(i);
-
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.reencaphop.Hop hop;
- hop = new HopBuilder().setPrimitiveAddress(toPrimitive(toAFI(transformLispAddress(reencapHop.getHop())))).build();
-
- Hops hops = new HopsBuilder().setLookup(reencapHop.isLookup()).setRLOCProbe(reencapHop.isRLOCProbe()).setStrict(reencapHop.isStrict())
- .setHop(hop).build();
-
- listHops.add(hops);
-
- }
-
- return new LcafTrafficEngineeringAddrBuilder().setAfi(lispLcafAddress.getAfi().getIanaCode())
- .setLcafType((short) lispLcafAddress.getType().getLispCode()).setHops(listHops).build();
- }
-
- public static LispAddress transformToLispAddress(LispAddressContainer lispAddress) {
-
- LispAddress legacyAddress = null;
- LispAFIAddress address = LispAFIConvertor.toAFI(lispAddress);
- AddressFamilyNumberEnum afi = AddressFamilyNumberEnum.valueOf(address.getAfi());
-
- switch (afi) {
-
- case IP:
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispIpv4Address lispIpv4Address;
- lispIpv4Address = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispIpv4Address) address;
- legacyAddress = new LispIpv4Address(lispIpv4Address.getIpv4Address().getValue());
- break;
- case IP6:
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispIpv6Address lispIpv6Address;
- lispIpv6Address = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispIpv6Address) address;
- legacyAddress = new LispIpv6Address(lispIpv6Address.getIpv6Address().getValue());
- break;
- case AS:
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispASAddress lispASAddress;
- lispASAddress = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispASAddress) address;
- legacyAddress = new LispASAddress(lispASAddress.getAS());
- break;
- case DISTINGUISHED_NAME:
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispDistinguishedNameAddress lispDistinguishedNameAddress;
- lispDistinguishedNameAddress = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispDistinguishedNameAddress) address;
- legacyAddress = new LispDistinguishedNameAddress(lispDistinguishedNameAddress.getDistinguishedName());
- break;
- case MAC:
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispMacAddress lispMacAddress;
- lispMacAddress = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispMacAddress) address;
- String macString = lispMacAddress.getMacAddress().getValue();
- macString = macString.replaceAll(":", "");
- legacyAddress = new LispMACAddress(DatatypeConverter.parseHexBinary(macString));
- break;
- case NO_ADDRESS:
- legacyAddress = new LispNoAddress();
- break;
- case LCAF:
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispLcafAddress lispLcafAddress;
- lispLcafAddress = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispLcafAddress) address;
-
- LispCanonicalAddressFormatEnum lcafEnum = LispCanonicalAddressFormatEnum.valueOf(lispLcafAddress.getLcafType());
-
- switch (lcafEnum) {
- case APPLICATION_DATA:
- legacyAddress = transformToLispApplicationDataLCAFAddress(lispLcafAddress);
- break;
- case LIST:
- legacyAddress = transformToLispListLCAFAddress(lispLcafAddress);
- break;
- case SEGMENT:
- legacyAddress = transformToLispSegmentLCAFAddress(lispLcafAddress);
- break;
- case SOURCE_DEST:
- legacyAddress = transformToLispSourceDestLCAFAddress(lispLcafAddress);
- break;
- case TRAFFIC_ENGINEERING:
- legacyAddress = transformToLispTrafficEngineeringLCAFAddress(lispLcafAddress);
- break;
- case UNKNOWN:
- default:
- throw new IllegalArgumentException("LCAF type " + lcafEnum + " not supported by this transoformer");
- }
- break;
- case UNKNOWN:
- default:
- throw new IllegalArgumentException("AFI " + afi + " not supported by this transformer");
- }
-
- return legacyAddress;
- }
-
- public static LispAddress transformToLispApplicationDataLCAFAddress(
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispLcafAddress lispLcafAddress) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LcafApplicationDataAddress lcafApplicationDataAddress;
- lcafApplicationDataAddress = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LcafApplicationDataAddress) lispLcafAddress;
-
- return new LispApplicationDataLCAFAddress((byte) 0, lcafApplicationDataAddress.getProtocol().byteValue(), lcafApplicationDataAddress
- .getIpTos().intValue(), lcafApplicationDataAddress.getLocalPort().getValue().shortValue(), lcafApplicationDataAddress.getRemotePort()
- .getValue().shortValue(), transformToLispAddress(LispAFIConvertor.toContainer(toAFIfromPrimitive(lcafApplicationDataAddress.getAddress()
- .getPrimitiveAddress()))));
- }
-
- public static LispAddress transformToLispListLCAFAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispLcafAddress lispLcafAddress) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LcafListAddress lcafListAddress;
- lcafListAddress = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LcafListAddress) lispLcafAddress;
-
- List<LispAddress> listLegacyAddress = new ArrayList<LispAddress>();
-
- for (int i = 0; i < lcafListAddress.getAddresses().size(); i++) {
- listLegacyAddress
- .add(transformToLispAddress(LispAFIConvertor.toContainer(toAFIfromPrimitive(lcafListAddress.getAddresses().get(i).getPrimitiveAddress()))));
- }
- return new LispListLCAFAddress((byte) 0, listLegacyAddress);
- }
-
- public static LispAddress transformToLispSegmentLCAFAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispLcafAddress lispLcafAddress) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LcafSegmentAddress lcafSegmentAddress;
- lcafSegmentAddress = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LcafSegmentAddress) lispLcafAddress;
-
- byte iidMaskLen = 0;
-
- return new LispSegmentLCAFAddress(iidMaskLen, lcafSegmentAddress.getInstanceId().intValue(),
- transformToLispAddress(LispAFIConvertor.toContainer(toAFIfromPrimitive(lcafSegmentAddress.getAddress().getPrimitiveAddress()))));
-
- }
-
- public static LispAddress transformToLispSourceDestLCAFAddress(
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispLcafAddress lispLcafAddress) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LcafSourceDestAddress lcafSourceDestAddress;
- lcafSourceDestAddress = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LcafSourceDestAddress) lispLcafAddress;
-
- return new LispSourceDestLCAFAddress((byte) 0, (short) 0, lcafSourceDestAddress.getSrcMaskLength().byteValue(), lcafSourceDestAddress
- .getDstMaskLength().byteValue(), transformToLispAddress(LispAFIConvertor.toContainer(toAFIfromPrimitive(lcafSourceDestAddress.getSrcAddress()
- .getPrimitiveAddress()))), transformToLispAddress(LispAFIConvertor.toContainer(toAFIfromPrimitive(lcafSourceDestAddress.getDstAddress()
- .getPrimitiveAddress()))));
-
- }
-
- public static LispAddress transformToLispTrafficEngineeringLCAFAddress(
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispLcafAddress lispLcafAddress) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LcafTrafficEngineeringAddress lcafTrafficEngineeringAddress;
- lcafTrafficEngineeringAddress = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LcafTrafficEngineeringAddress) lispLcafAddress;
-
- List<ReencapHop> listLegacyHops = new ArrayList<ReencapHop>();
-
- ReencapHop legacyHop;
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.ReencapHop hop;
-
- // for (Addresses addresses : lcafListAddress.getAddresses()){
- for (int i = 0; i < lcafTrafficEngineeringAddress.getHops().size(); i++) {
- hop = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.ReencapHop) lcafTrafficEngineeringAddress.getHops().get(i);
-
- legacyHop = new ReencapHop(transformToLispAddress(LispAFIConvertor.toContainer(toAFIfromPrimitive(hop.getHop().getPrimitiveAddress()))), (short) 0,
- hop.isLookup(), hop.isRLOCProbe(), hop.isStrict());
-
- listLegacyHops.add(legacyHop);
- }
- return new LispTrafficEngineeringLCAFAddress((byte) 0, listLegacyHops);
- }
-
- public static MapRegister transformMapRegister(org.opendaylight.lispflowmapping.type.lisp.MapRegister legacyMapRegister) {
-
- List<EidToLocatorRecord> listEidToLocatorRecord = new ArrayList<EidToLocatorRecord>();
-
- // for (EidToLocatorRecord legacyRecord:
- // legacyMapRegister.getEidToLocatorRecords()){
- for (int i = 0; i < legacyMapRegister.getEidToLocatorRecords().size(); i++) {
-
- listEidToLocatorRecord.add(transformEidToLocatorRecord(legacyMapRegister.getEidToLocatorRecords().get(i)));
-
- }
-
- MapRegisterBuilder builder = new MapRegisterBuilder();
-
- MapRegister yangMapRegister = builder.setKeyId(legacyMapRegister.getKeyId()).setProxyMapReply(legacyMapRegister.isProxyMapReply())
- .setEidToLocatorRecord(listEidToLocatorRecord).setWantMapNotify(true).build();
-
- return yangMapRegister;
-
- }
-
- public static EidToLocatorRecord transformEidToLocatorRecord(
- org.opendaylight.lispflowmapping.type.lisp.EidToLocatorRecord legacyEidToLocatorRecord) {
-
- List<LocatorRecord> listLocatorRecord = new ArrayList<LocatorRecord>();
-
- for (int j = 0; j < legacyEidToLocatorRecord.getLocators().size(); j++) {
-
- org.opendaylight.lispflowmapping.type.lisp.LocatorRecord legacyLocatorRecord = legacyEidToLocatorRecord.getLocators().get(j);
-
- LispAddressContainer rloc = transformLispAddress(legacyLocatorRecord.getLocator());
-
- LocatorRecordBuilder locatorRecordBuilder = new LocatorRecordBuilder();
-
- LocatorRecord locatorRecord = locatorRecordBuilder.setLispAddressContainer((LispAddressContainer) rloc)
- .setLocalLocator(legacyLocatorRecord.isLocalLocator()).setPriority((short) legacyLocatorRecord.getPriority())
- .setWeight((short) legacyLocatorRecord.getWeight()).setMulticastPriority((short) legacyLocatorRecord.getMulticastPriority())
- .setMulticastWeight((short) legacyLocatorRecord.getMulticastWeight()).setRlocProbed(legacyLocatorRecord.isRlocProbed())
- .setRouted(legacyLocatorRecord.isRouted()).build();
-
- listLocatorRecord.add(locatorRecord);
- }
-
- LispAddressContainer eid = transformLispAddress(legacyEidToLocatorRecord.getPrefix());
- EidToLocatorRecordBuilder eidToLocatorRecordBuilder = new EidToLocatorRecordBuilder();
- EidToLocatorRecord eidToLocatorRecord = eidToLocatorRecordBuilder.setLispAddressContainer((LispAddressContainer) eid)
- .setAction(Action.forValue(legacyEidToLocatorRecord.getAction().getCode()))
- .setAuthoritative(legacyEidToLocatorRecord.isAuthoritative()).setMaskLength((short) legacyEidToLocatorRecord.getMaskLength())
- .setRecordTtl(legacyEidToLocatorRecord.getRecordTtl()).setLocatorRecord(listLocatorRecord).build();
- return eidToLocatorRecord;
- }
-
- public static org.opendaylight.lispflowmapping.type.lisp.EidToLocatorRecord reTransformEidToLocatorRecord(EidToLocatorRecord eidToLocatorRecord) {
-
- org.opendaylight.lispflowmapping.type.lisp.EidToLocatorRecord legacyRecord = new org.opendaylight.lispflowmapping.type.lisp.EidToLocatorRecord();
-
- for (int j = 0; j < eidToLocatorRecord.getLocatorRecord().size(); j++) {
-
- LocatorRecord locatorRecord = (LocatorRecord) eidToLocatorRecord.getLocatorRecord().get(j);
-
- org.opendaylight.lispflowmapping.type.lisp.LocatorRecord legacyLocatorRecord = new org.opendaylight.lispflowmapping.type.lisp.LocatorRecord();
-
- LispAddressContainer rloc = locatorRecord.getLispAddressContainer();
-
- legacyLocatorRecord.setLocator(YangTransformerNB.transformToLispAddress(rloc));
-
- legacyLocatorRecord.setLocalLocator(locatorRecord.isLocalLocator()).setPriority(locatorRecord.getPriority())
- .setWeight(locatorRecord.getWeight()).setMulticastPriority(locatorRecord.getMulticastPriority())
- .setMulticastWeight(locatorRecord.getMulticastWeight()).setRlocProbed(locatorRecord.isRlocProbed())
- .setRouted(locatorRecord.isRouted());
-
- legacyRecord.addLocator(legacyLocatorRecord);
- }
-
- LispAddress eid = transformToLispAddress(eidToLocatorRecord.getLispAddressContainer());
- legacyRecord.setPrefix(eid).setAction(MapReplyAction.valueOf(eidToLocatorRecord.getAction().getIntValue()))
- .setAuthoritative(eidToLocatorRecord.isAuthoritative()).setMaskLength((short) eidToLocatorRecord.getMaskLength())
- .setRecordTtl(eidToLocatorRecord.getRecordTtl());
- return legacyRecord;
- }
-
- public static MapRequest transformMapRequest(org.opendaylight.lispflowmapping.type.lisp.MapRequest legacyMapRequest) {
-
- MapRequestBuilder builder = new MapRequestBuilder();
- builder.setAuthoritative(legacyMapRequest.isAuthoritative());
- builder.setMapDataPresent(legacyMapRequest.isMapDataPresent());
- builder.setPitr(legacyMapRequest.isPitr());
- builder.setProbe(legacyMapRequest.isProbe());
- builder.setSmr(legacyMapRequest.isSmr());
- builder.setSmrInvoked(legacyMapRequest.isSmrInvoked());
-
- builder.setEidRecord(new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.eidrecords.EidRecord>());
- for (EidRecord record : legacyMapRequest.getEids()) {
- LispAddressContainer container = transformLispAddress(record.getPrefix());
- builder.getEidRecord().add(
-
- new EidRecordBuilder().setMask((short) record.getMaskLength()).setLispAddressContainer(container).build());
- }
-
- builder.setItrRloc(new ArrayList<ItrRloc>());
- for (LispAddress itr : legacyMapRequest.getItrRlocs()) {
- builder.getItrRloc().add(new ItrRlocBuilder().setLispAddressContainer(transformLispAddress(itr)).build());
- }
-
- builder.setMapReply(null);
- builder.setNonce(legacyMapRequest.getNonce());
- if (legacyMapRequest.getSourceEid() != null) {
- builder.setSourceEid(new SourceEidBuilder().setLispAddressContainer(transformLispAddress(legacyMapRequest.getSourceEid())).build());
- }
- return builder.build();
-
- }
-
-}
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<web-app
- xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
- version="3.0">
- <servlet>
- <servlet-name>JAXRSlispflowmapping</servlet-name>
- <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
- <init-param>
- <param-name>javax.ws.rs.Application</param-name>
- <param-value>org.opendaylight.controller.northbound.commons.NorthboundApplication</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>JAXRSlispflowmapping</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
-
- <filter>
- <filter-name>CorsFilter</filter-name>
- <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
- <init-param>
- <param-name>cors.allowed.origins</param-name>
- <param-value>*</param-value>
- </init-param>
- <init-param>
- <param-name>cors.allowed.methods</param-name>
- <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
- </init-param>
- <init-param>
- <param-name>cors.allowed.headers</param-name>
- <param-value>Content-Type,X-Requested-With,accept,authorization, origin,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
- </init-param>
- <init-param>
- <param-name>cors.exposed.headers</param-name>
- <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
- </init-param>
- <init-param>
- <param-name>cors.support.credentials</param-name>
- <param-value>true</param-value>
- </init-param>
- <init-param>
- <param-name>cors.preflight.maxage</param-name>
- <param-value>10</param-value>
- </init-param>
- </filter>
- <filter-mapping>
- <filter-name>CorsFilter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
- <security-constraint>
- <web-resource-collection>
- <web-resource-name>NB api</web-resource-name>
- <url-pattern>/*</url-pattern>
- <http-method>POST</http-method>
- <http-method>GET</http-method>
- <http-method>PUT</http-method>
- <http-method>PATCH</http-method>
- <http-method>DELETE</http-method>
- <http-method>HEAD</http-method>
- </web-resource-collection>
- <auth-constraint>
- <role-name>System-Admin</role-name>
- <role-name>Network-Admin</role-name>
- <role-name>Network-Operator</role-name>
- <role-name>Container-User</role-name>
- </auth-constraint>
- </security-constraint>
-
- <security-role>
- <role-name>System-Admin</role-name>
- </security-role>
- <security-role>
- <role-name>Network-Admin</role-name>
- </security-role>
- <security-role>
- <role-name>Network-Operator</role-name>
- </security-role>
- <security-role>
- <role-name>Container-User</role-name>
- </security-role>
-
- <login-config>
- <auth-method>BASIC</auth-method>
- <realm-name>opendaylight</realm-name>
- </login-config>
-</web-app>
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.northbound;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.lispflowmapping.implementation.util.LispAFIConvertor;
-import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
-import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
-import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispAddress;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispAddressGeneric;
-import org.opendaylight.lispflowmapping.type.lisp.address.LispIpv4Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispAFIAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcafsourcedestaddress.DstAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcafsourcedestaddress.DstAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcafsourcedestaddress.SrcAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lcafsourcedestaddress.SrcAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.LispAddressContainer;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.ipv4.Ipv4AddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispaddress.lispaddresscontainer.address.lcafsourcedest.LcafSourceDestAddrBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
-
-
-
-
-public class TransformerTest extends BaseTestCase{
-
- @Override
- @Before
- 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
- = new LispAddressGeneric(AddressFamilyNumberEnum.IP.getIanaCode(),"10.0.0.1");
-
- LispAddressContainer lispAddressContainer =
- YangTransformerNB.transformLispAddress(
- LispAddressConvertorNB.convertToLispAddress(lispAddressGenericIn));
-
- 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
- = new LispAddressGeneric(AddressFamilyNumberEnum.IP.getIanaCode(),"10.0.0.1");
-
- 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 =
- YangTransformerNB.transformLispAddress(
- LispAddressConvertorNB.convertToLispAddress(lispAddressGenericIn));
-
- 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 Ipv4AddressBuilder()
- .setIpv4Address(ipv4AddressIn)
- .setAfi(AddressFamilyNumberEnum.IP.getIanaCode())
- .build();
-
- LispAddressContainer lispAddressContainerIn = LispAFIConvertor.toContainer(lispAFIAddressIn);
-
- LispAddressGeneric lispAddressGeneric
- = new LispAddressGeneric(YangTransformerNB.transformToLispAddress(lispAddressContainerIn));
-
- LispAddressContainer lispAddressContainerOut
- = YangTransformerNB.transformLispAddress(LispAddressConvertorNB.convertToLispAddress(lispAddressGeneric));
-
- LispAFIAddress lispAFIAddressOut = LispAFIConvertor.toAFI(lispAddressContainerOut);
-
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LispIpv4Address lispIpv4AddressOut;
- lispIpv4AddressOut = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.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 Ipv4AddressBuilder()
- .setIpv4Address(ipv4AddressSrcIn)
- .setAfi(AddressFamilyNumberEnum.IP.getIanaCode())
- .build();
-
- Ipv4Address ipv4AddressDstIn = new Ipv4Address("20.0.0.2");
- LispAFIAddress lispAFIAddressDst = new Ipv4AddressBuilder()
- .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 LcafSourceDestAddrBuilder()
- .setAfi(AddressFamilyNumberEnum.LCAF.getIanaCode())
- .setLcafType((short) LispCanonicalAddressFormatEnum.SOURCE_DEST.getLispCode())
- .setSrcMaskLength((short) 32)
- .setDstMaskLength((short) 32)
- .setSrcAddress(srcAddress)
- .setDstAddress(dstAddress)
- .build();
-
- LispAddressContainer lispAddressContainerIn = LispAFIConvertor.toContainer(lispAFIAddressIn);
-
- LispAddressGeneric lispAddressGeneric
- = new LispAddressGeneric(YangTransformerNB.transformToLispAddress(lispAddressContainerIn));
-
- LispAddressContainer lispAddressContainerOut
- = YangTransformerNB.transformLispAddress(LispAddressConvertorNB.convertToLispAddress(lispAddressGeneric));
-
- LispAFIAddress lispAFIAddressOut = LispAFIConvertor.toAFI(lispAddressContainerOut);
-
-
- org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LcafSourceDestAddress lcafSourceDestAddressOut;
- lcafSourceDestAddressOut = (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.LcafSourceDestAddress) lispAFIAddressOut;
-
- Ipv4Address ipv4AddressSrcOut
- = ((org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispsimpleaddress.primitiveaddress.Ipv4)
- lcafSourceDestAddressOut.getSrcAddress().getPrimitiveAddress())
- .getIpv4Address().getIpv4Address();
-
- Ipv4Address ipv4AddressDstOut
- = ((org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.lispsimpleaddress.primitiveaddress.Ipv4)
- lcafSourceDestAddressOut.getDstAddress().getPrimitiveAddress())
- .getIpv4Address().getIpv4Address();
-
-
- assertEquals(ipv4AddressSrcIn.getValue(),ipv4AddressSrcOut.getValue());
-
- assertEquals(ipv4AddressDstIn.getValue(),ipv4AddressDstOut.getValue());
-
- }
-
-
-}
<module>clusterdao</module>
<module>implementation</module>
<module>southbound</module>
- <module>northbound</module>
<module>neutron</module>
<module>netconf</module>
<module>shell</module>