/**
* Generates an Instance Identifier for a specific OVSDB node by
- * using the node Id
+ * using the node Id.
* @param nodeId The node ID of a specific OVSDB node.
* @return An Instance Identifier for a specific OVSDB node.
*/
/**
* Generates an Instance Identifier for a specific UNI node by
- * using the node Id
+ * using the node Id.
* @param nodeId The node ID of a specific UNI node.
* @return An Instance Identifier for a specific UNI node.
*/
* @return {@link Optional#empty()} in case it cannot be instantiated for a port, driver otherwise
*/
Optional<ActivationDriver> driverFor(BuilderContext context);
+
Uuid getNodeUuid();
/**
*/
public class EndPoint {
private final ConnectivityServiceEndPoint endpoint;
+
/**
- * Optional attributes
+ * Optional attributes.
* (likely to change to different implementation)
*/
private final NrpConnectivityServiceEndPointAttrs attrs;
private Uuid systemNepUuid;
/**
- * Initialize endpoint
+ * Initialize endpoint.
* @param endpoint endpoint data
* @param attrs associated NRP attributes
*/
this.attrs = attrs;
}
- /**
- *
- * @return endpoints
- */
public ConnectivityServiceEndPoint getEndpoint() {
return endpoint;
}
- /**
- *
- * @return attributes
- */
public NrpConnectivityServiceEndPointAttrs getAttrs() {
return attrs;
}
import java.util.List;
/**
- * Request decomposer is responsible for decomposition of {@link org.opendaylight.yang.gen.v1.urn.mef.yang.tapi.connectivity.rev170712.connectivity.context.ConnectivityService}
+ * Request decomposer is responsible for decomposition of ConnectivityService
* requests into one or many driver requests.
+ * @see org.opendaylight.yang.gen.v1.urn.mef.yang.tapi.connectivity.rev170712.connectivity.context.ConnectivityService
* @author bartosz.michalik@amartus.com
*/
public interface RequestDecomposer {
/**
- *
+ * Decompose the provided endpoint connectivity request into a list of sub-requests.
* @param endpoints list of connectiviy request endpoints
* @param constraint on decoposition
* @return list of subrequests - one per driver
}
private void verifyTx() {
- if (tx == null) throw new IllegalStateException("Top perform write operation read write transaction is needed");
+ if (tx == null) {
+ throw new IllegalStateException("Top perform write operation read write transaction is needed");
+ }
}
/**
- * Update nep or add if it does not exist
+ * Update nep or add if it does not exist.
* @param nodeId node id
* @param nep nep to update
*/
public void addSip(ServiceInterfacePoint sip) {
verifyTx();
tx.put(LogicalDatastoreType.OPERATIONAL,
- ctx().child(ServiceInterfacePoint.class, new ServiceInterfacePointKey(sip.getUuid())),
+ ctx().child(ServiceInterfacePoint.class, new ServiceInterfacePointKey(sip.getUuid())),
sip);
}
public void removeSips(Stream<Uuid> uuids) {
verifyTx();
- if (uuids == null) return ;
+ if (uuids == null) {
+ return;
+ }
uuids.forEach(sip -> {
LOG.debug("removing ServiceInterfacePoint with id {}", sip);
tx.delete(LogicalDatastoreType.OPERATIONAL, ctx().child(ServiceInterfacePoint.class, new ServiceInterfacePointKey(sip)));
try {
Optional<Node> opt = tx.read(LogicalDatastoreType.OPERATIONAL, node(nodeId)).checkedGet();
if (opt.isPresent()) {
- removeSips(opt.get().getOwnedNodeEdgePoint().stream().flatMap(nep -> nep.getMappedServiceInterfacePoint() == null ?
- Stream.empty() : nep.getMappedServiceInterfacePoint().stream()
+ removeSips(opt.get().getOwnedNodeEdgePoint().stream().flatMap(nep -> nep.getMappedServiceInterfacePoint() == null
+ ? Stream.empty()
+ : nep.getMappedServiceInterfacePoint().stream()
));
}
} catch (ReadFailedException e) {
public interface ResourceActivator {
/**
+ * Activate connectivity betwee the provided endpoints.
* @param endPoints list of endpoint to connect
* @param serviceName generated service id
*/
void activate(List<EndPoint> endPoints, String serviceName) throws ResourceActivatorException, TransactionCommitFailedException;
/**
+ * Deactivate connectivity between the provided endpoints.
* @param endPoints list of endpoint between which connection have to be deactivated
* @param serviceName generated service id
*/
*/
package org.opendaylight.unimgr.mef.nrp.common;
-public class ResourceActivatorException extends Exception{
+public class ResourceActivatorException extends Exception {
- private static final long serialVersionUID = 4242336212297338778L;
+ private static final long serialVersionUID = 4242336212297338778L;
- public ResourceActivatorException() {
- super();
- }
-
- public ResourceActivatorException(String message) {
- super(message);
- }
-
- public ResourceActivatorException(String message, Throwable cause) {
- super(message, cause);
- }
+ public ResourceActivatorException() {
+ super();
+ }
+ public ResourceActivatorException(String message) {
+ super(message);
+ }
+ public ResourceActivatorException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
* @param id unique allocated id
* @return String name
*/
- public String getOuterName(String id);
+ String getOuterName(String id);
/**
* Return a resource name composed to include the provided id.
* @param id unique allocated id
* @return String name
*/
- public String getInnerName(String id);
+ String getInnerName(String id);
}
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId;
/**
- * Class representing port (replacement for FcPort)
+ * Class representing port (replacement for FcPort).
*
* @author marek.ryznar@amartus.com
*/
//defines port
private TpId tpId;
//defines cTag VLAN ID
- private Long vlanId=null;
+ private Long vlanId = null;
public ServicePort(TopologyId topoId, NodeId nodeId, TpId tpId) {
this.topoId = topoId;
}
public static boolean hasVlan(EndPoint endPoint) {
- if ( (endPoint.getAttrs() != null)
- && (endPoint.getAttrs().getNrpCarrierEthConnectivityEndPointResource() != null) ) {
+ if ((endPoint.getAttrs() != null)
+ && (endPoint.getAttrs().getNrpCarrierEthConnectivityEndPointResource() != null)) {
NrpCarrierEthConnectivityEndPointResource attr =
endPoint.getAttrs().getNrpCarrierEthConnectivityEndPointResource();
- if ( (attr.getCeVlanIdListAndUntag() != null)
- && !(attr.getCeVlanIdListAndUntag().getVlanId().isEmpty()) ) {
+ if ((attr.getCeVlanIdListAndUntag() != null)
+ && !(attr.getCeVlanIdListAndUntag().getVlanId().isEmpty())) {
return true;
} else {
return false;
}
public void close() {
- if (registration!=null) {
+ if (registration != null) {
registration.close();
}
}
OwnedNodeEdgePoint a = (OwnedNodeEdgePoint) dataObjectModificationNep.getDataAfter();
if (b != null) {
- if (a == null) return true;
+ if (a == null) {
+ return true;
+ }
if (hasSip(b)) {
- return ! hasSip(a);
+ return ! hasSip(a);
}
}
private boolean checkIfUpdated(DataObjectModification dataObjectModificationNep) {
OwnedNodeEdgePoint before = (OwnedNodeEdgePoint) dataObjectModificationNep.getDataBefore();
OwnedNodeEdgePoint after = (OwnedNodeEdgePoint) dataObjectModificationNep.getDataAfter();
- if (after == null) return false;
+ if (after == null) {
+ return false;
+ }
//added
if (before == null) {
return hasSip(after);
* @return result
*/
public Result activate() {
- if (drivers.isEmpty()) throw new IllegalStateException("at least one driver required");
+ if (drivers.isEmpty()) {
+ throw new IllegalStateException("at least one driver required");
+ }
sortDrivers();
try {
for (ActivationDriver d: drivers) {
* @return result
*/
public Result deactivate() {
- if (drivers.isEmpty()) throw new IllegalStateException("at least one driver required");
+ if (drivers.isEmpty()) {
+ throw new IllegalStateException("at least one driver required");
+ }
sortDrivers();
try {
for (ActivationDriver d: drivers) {
import java.util.Random;
/**
- * Dummy resource pool
+ * Dummy resource pool.
* @author bartosz.michalik@amartus.com
*/
public class ConnectivityServiceIdResourcePool {
Map<Uuid, LinkedList<EndPoint>> data = null;
try {
data = prepareData(cs, nrpDao);
- } catch(Exception e) {
+ } catch (Exception e) {
LOG.info("Service {} does not exists", input.getServiceIdOrName());
return RpcResultBuilder
.<DeleteConnectivityServiceOutput>failed()
}
}
throw new IllegalStateException("no transaction created for delete connectivity request");
- } catch(Exception e) {
+ } catch (Exception e) {
LOG.warn("Exception in create connectivity service", e);
return RpcResultBuilder
.<DeleteConnectivityServiceOutput>failed()
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-public class GetConnectivityDetailsAction implements Callable<RpcResult<GetConnectivityServiceDetailsOutput>>{
+public class GetConnectivityDetailsAction implements Callable<RpcResult<GetConnectivityServiceDetailsOutput>> {
private final TapiConnectivityServiceImpl service;
private final GetConnectivityServiceDetailsInput input;
30, TimeUnit.MINUTES,
new LinkedBlockingQueue<>());
- final static InstanceIdentifier<Context1> connectivityCtx = NrpDao.ctx().augmentation(Context1.class);
+ final static InstanceIdentifier<Context1> connectivityCtx = NrpDao.ctx().augmentation(Context1.class);
public void init() {
import org.slf4j.LoggerFactory;
/**
- * Basic graph based request decomposer
+ * Basic graph based request decomposer.
* @author bartosz.michalik@amartus.com
*
*/
}
/**
- * We currently support only one-to-one mapping between nep and sip
+ * We currently support only one-to-one mapping between nep and sip.
* @param endpoints
* @param constraint
* @return
public DecompositionAction(List<EndPoint> endpoints, DataBroker broker) {
Objects.requireNonNull(endpoints);
Objects.requireNonNull(broker);
- if (endpoints.size() < 2) throw new IllegalArgumentException("there should be at least two endpoints defined");
+ if (endpoints.size() < 2) {
+ throw new IllegalArgumentException("there should be at least two endpoints defined");
+ }
this.endpoints = endpoints;
this.broker = broker;
}
assert vertexes.size() > 1;
- if (vertexes.size() > 2) throw new IllegalStateException("currently only point to point is supported");
+ if (vertexes.size() > 2) {
+ throw new IllegalStateException("currently only point to point is supported");
+ }
GraphPath<Vertex, DefaultEdge> path = DijkstraShortestPath.findPathBetween(graph, vertexes.get(0), vertexes.get(1));
- if (path == null) return null;
+ if (path == null) {
+ return null;
+ }
return path.getVertexList().stream().collect(Collectors.groupingBy(v -> v.getNodeUuid()))
.entrySet().stream().map(e -> {
return new Subrequrest(e.getKey(), e.getValue().stream().map(v -> toEndPoint(v)).collect(Collectors.toList()));
- }).collect(Collectors.toList());
+ }).collect(Collectors.toList());
}
private EndPoint toEndPoint(Vertex v) {
if (sips == null || sips.isEmpty()) {
return new Vertex(nodeUuid, nep.getUuid(), null);
}
- if (sips.size() > 1) LOG.warn("NodeEdgePoint {} have multiple ServiceInterfacePoint mapped, selecting first one", nep.getUuid());
+ if (sips.size() > 1) {
+ LOG.warn("NodeEdgePoint {} have multiple ServiceInterfacePoint mapped, selecting first one", nep.getUuid());
+ }
return new Vertex(nodeUuid, nep.getUuid(), sips.get(0));
});
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
Vertex vertex = (Vertex) o;
return Objects.equals(uuid, vertex.uuid);
}
@Override
public int compareTo(Vertex o) {
- if (o == null) return -1;
+ if (o == null) {
+ return -1;
+ }
return uuid.getValue().compareTo(o.uuid.getValue());
}
.child(Node.class, new NodeKey(nodeId))
.child(OwnedNodeEdgePoint.class, new OwnedNodeEdgePointKey(nepId))
).checkedGet();
- if (!nep.isPresent()) return withError("NEP with id {0} for node {1} not found", nepId, nodeId);
+ if (!nep.isPresent()) {
+ return withError("NEP with id {0} for node {1} not found", nepId, nodeId);
+ }
Uuid sipId = new Uuid("sip:" + nepId.getValue());
List<Uuid> sips = nep.get().getMappedServiceInterfacePoint();
- if (sips != null && !sips.isEmpty()) return withError("sip for NEP with id {0} for node {1} already defined", nepId, nodeId);
+ if (sips != null && !sips.isEmpty()) {
+ return withError("sip for NEP with id {0} for node {1} already defined", nepId, nodeId);
+ }
NrpDao nrpDao = new NrpDao(tx);
-
ServiceInterfacePointBuilder sipBuilder = new ServiceInterfacePointBuilder()
.setUuid(sipId)
.setLayerProtocol(Collections.singletonList(getLayerProtocol(sipType)));
-
nrpDao.addSip(
sipBuilder
.build());
if (sipType instanceof InniSpec) {
org.opendaylight.yang.gen.v1.urn.odl.unimgr.yang.unimgr.ext.rev700101.add.sip.input.sip.type.inni.spec.InniSpec spec = ((InniSpec) sipType).getInniSpec();
- if (spec != null) lp = new LayerProtocol1Builder()
+ if (spec != null) {
+ lp = new LayerProtocol1Builder()
.setNrpCarrierEthInniNResource(new NrpCarrierEthInniNResourceBuilder(spec).build()).build();
+ }
} else if (sipType instanceof EnniSpec) {
org.opendaylight.yang.gen.v1.urn.odl.unimgr.yang.unimgr.ext.rev700101.add.sip.input.sip.type.enni.spec.EnniSpec spec = ((EnniSpec) sipType).getEnniSpec();
- if (spec != null) lp = new LayerProtocol1Builder()
+ if (spec != null) {
+ lp = new LayerProtocol1Builder()
.setNrpCarrierEthEnniNResource(new NrpCarrierEthEnniNResourceBuilder(spec).build()).build();
+ }
} else if (sipType instanceof UniSpec) {
org.opendaylight.yang.gen.v1.urn.odl.unimgr.yang.unimgr.ext.rev700101.add.sip.input.sip.type.uni.spec.UniSpec spec = ((UniSpec) sipType).getUniSpec();
- if (spec != null) lp = new LayerProtocol1Builder()
+ if (spec != null) {
+ lp = new LayerProtocol1Builder()
.setNrpCarrierEthUniNResource(new NrpCarrierEthUniNResourceBuilder(spec).build()).build();
+ }
}
lpBuilder.addAugmentation(LayerProtocol1.class, lp);
RpcResultBuilder<Void> failed = RpcResultBuilder.<Void>failed();
if (error != null) {
if (params.length > 0) {
- error = MessageFormat.format(error, params);
+ error = MessageFormat.format(error, params);
}
failed.withError(RpcError.ErrorType.APPLICATION, error);
}
private static boolean checkForNetconfCapability(Node node, String netconf_capability) {
NetconfNode netconf = node.getAugmentation(NetconfNode.class);
- if (netconf == null) return false;
- if (netconf.getAvailableCapabilities() == null) return false;
- if (netconf.getAvailableCapabilities().getAvailableCapability() == null) return false;
+ if (netconf == null) {
+ return false;
+ }
+ if (netconf.getAvailableCapabilities() == null) {
+ return false;
+ }
+ if (netconf.getAvailableCapabilities().getAvailableCapability() == null) {
+ return false;
+ }
return netconf
.getAvailableCapabilities()
for (Capability capability : capabilities) {
boolean isSupporting = isSupporting(capability);
- result = (mode == Capability.Mode.AND ? result && isSupporting: result || isSupporting);
+ result = (mode == Capability.Mode.AND ? result && isSupporting : result || isSupporting);
if (result ^ (mode == Capability.Mode.AND)) {
break;
private <T> boolean checkCondition(Capability<T> capability, T data) {
return capability.getCondition().apply(dataBroker, data);
}
-}
\ No newline at end of file
+}
}
/**
- * Read a specific datastore type and return a optional of DataObject
+ * Read a specific datastore type and return a optional of DataObject.
* @param dataBroker The dataBroker instance to create transactions
* @param store The store type to query
* @param path The generic path to query
}
/**
- * Generic function to delete a node on a specific dataStore
+ * Generic function to delete a node on a specific dataStore.
* @param dataBroker The instance of the data broker to create transactions.
* @param genericNode The instance identifier of a generic node
* @param store The dataStore where to send and submit the delete call.
}
/**
- * Read a specific Link from a specific datastore
+ * Read a specific Link from a specific datastore.
* @param dataBroker The dataBroker instance to create transactions
* @param store The datastore type.
* @param genericNode The Instance Identifier of the Link
}
/**
- * Read a specific Link from a specific datastore
+ * Read a specific Link from a specific datastore.
* @param dataBroker The dataBroker instance to create transactions
* @param store The datastore type.
* @param topologyName The topology name.
}
/**
- * Read a TerminationPoint from datastore used in given FcPort
+ * Read a TerminationPoint from datastore used in given FcPort.
* @param dataBroker The dataBroker instance to create transactions
* @param store The datastore type.
* @param port FcPort data
public interface NetconfConstants {
- final String CAPABILITY_IOX_L2VPN = "(http://cisco.com/ns/yang/Cisco-IOS-XR-l2vpn-cfg?revision=2015-11-09)Cisco-IOS-XR-l2vpn-cfg";
- final String CAPABILITY_IOX_IFMGR = "(http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg?revision=2015-07-30)Cisco-IOS-XR-ifmgr-cfg";
- final String CAPABILITY_IOX_ASR9K_POLICYMGR = "(http://cisco.com/ns/yang/Cisco-IOS-XR-asr9k-policymgr-cfg?revision=2015-05-18)Cisco-IOS-XR-asr9k-policymgr-cfg";
+
+ String CAPABILITY_IOX_L2VPN =
+ "(http://cisco.com/ns/yang/Cisco-IOS-XR-l2vpn-cfg?revision=2015-11-09)Cisco-IOS-XR-l2vpn-cfg";
+
+ String CAPABILITY_IOX_IFMGR =
+ "(http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg?revision=2015-07-30)Cisco-IOS-XR-ifmgr-cfg";
+
+ String CAPABILITY_IOX_ASR9K_POLICYMGR =
+ "(http://cisco.com/ns/yang/Cisco-IOS-XR-asr9k-policymgr-cfg?revision=2015-05-18)Cisco-IOS-XR-asr9k-policymgr-cfg";
}
return dataOptional;
}
- private void logDataOptionalStatus(Function <?, ?> function) {
+ private void logDataOptionalStatus(Function<?, ?> function) {
if (dataOptional.isPresent()) {
LOG.trace("Before collection of: " + function.toString() + ", currently collected data is non-null: " + dataOptional.get().toString());
} else {
}
/**
- * Creates a Bridge Augmentation by using a UNI
+ * Creates a Bridge Augmentation by using a UNI.
* @param uni Contains data used to create the augmentation
* @return A Built OvsdbBridgeAugmentation with data.
* @throws Exception if the Ovsdb Node Reference cannot be found.
public static String getDeviceName(Uuid sip) {
String[] sipTab = sip.getValue().split(":");
- return sipTab[sipTab.length-2];
+ return sipTab[sipTab.length - 2];
}
public static String getPortName(Uuid sip) {
String[] sipTab = sip.getValue().split(":");
- return sipTab[sipTab.length-1];
+ return sipTab[sipTab.length - 1];
}
public static boolean isTheSameDevice(Uuid sip1, Uuid sip2) {
}
/**
- * Retrieve a list of Uni Nodes on a specific DataStore
+ * Retrieve a list of Uni Nodes on a specific DataStore.
* @param dataBroker The dataBroker instance to create transactions
* @param store The store to which to send the read request
* @return A List of UNI Nodes.
}
/**
- * Retrieve a list of Unis on a specific DataStore
+ * Retrieve a list of Unis on a specific DataStore.
* @param dataBroker instance to create transactions
* @param store to which send the read request
* @return A List of Unis.
}
/**
- * Retrieve a list of Unis on a specific DataStore
+ * Retrieve a list of Unis on a specific DataStore.
* @param dataBroker instance to create transactions
* @param store to which send the read request
* @param ipAddress of the required Uni
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
/**
- * DataTreeModificationHelper help to get a dummy value of DataTreeModification object as DataTreeModification
+ * DataTreeModificationHelper help to get a dummy value of DataTreeModification object as DataTreeModification
* class is a final class.
*/
public final class DataTreeModificationHelper {
- public static final DataTreeModification<Node> getUniNode(final Node node) {
+ public static DataTreeModification<Node> getUniNode(final Node node) {
final DataTreeIdentifier<Node> uniDataTreeIid = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, getUniIid("10.10.1.3"));
final DataObjectModification<Node> uniDataTreeObj = new DataObjectModification<Node>() {
@Override
// TODO Auto-generated method stub
return null;
}
+
@Override
public <C extends Identifiable<K> & ChildOf<? super Node>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
Class<C> arg0, K arg1) {
// TODO Auto-generated method stub
return null;
}
+
@Override
public <C extends ChildOf<? super Node>> DataObjectModification<C> getModifiedChildContainer(Class<C> arg0) {
// TODO Auto-generated method stub
return null;
}
+
@Override
public DataObjectModification<? extends DataObject> getModifiedChild(PathArgument arg0) {
// TODO Auto-generated method stub
return null;
}
+
@Override
public <C extends Augmentation<Node> & DataObject> DataObjectModification<C> getModifiedAugmentation(
Class<C> arg0) {
// TODO Auto-generated method stub
return null;
}
+
@Override
public ModificationType getModificationType() {
// TODO Auto-generated method stub
return null;
}
+
@Override
public PathArgument getIdentifier() {
// TODO Auto-generated method stub
return null;
}
+
@Override
public Class<Node> getDataType() {
// TODO Auto-generated method stub
return null;
}
+
@Override
public Node getDataBefore() {
return node;
}
+
@Override
public Node getDataAfter() {
return node;
}
};
+
DataTreeModification<Node> uniNode = new DataTreeModification<Node>() {
@Override
public DataTreeIdentifier<Node> getRootPath() {
return uniNode;
}
- private static final InstanceIdentifier<Node> getUniIid(String nodeId) {
+ private static InstanceIdentifier<Node> getUniIid(String nodeId) {
NodeId uniNodeId = new NodeId(new NodeId(nodeId));
InstanceIdentifier<Node> uniNodeIid = InstanceIdentifier
.create(NetworkTopology.class)
return uniNodeIid;
}
- public static final DataTreeModification<Link> getEvcLink(final Link link) {
+ public static DataTreeModification<Link> getEvcLink(final Link link) {
final DataTreeIdentifier<Link> evcDataTreeIid = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, getEvcLinkIid("1"));
final DataObjectModification<Link> evcDataTreeObj = new DataObjectModification<Link>() {
+
@Override
public Collection<DataObjectModification<? extends DataObject>> getModifiedChildren() {
// TODO Auto-generated method stub
return null;
}
+
@Override
public <C extends Identifiable<K> & ChildOf<? super Link>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
Class<C> arg0, K arg1) {
// TODO Auto-generated method stub
return null;
}
+
@Override
public <C extends ChildOf<? super Link>> DataObjectModification<C> getModifiedChildContainer(Class<C> arg0) {
// TODO Auto-generated method stub
return null;
}
+
@Override
public DataObjectModification<? extends DataObject> getModifiedChild(PathArgument arg0) {
// TODO Auto-generated method stub
return null;
}
+
@Override
public <C extends Augmentation<Link> & DataObject> DataObjectModification<C> getModifiedAugmentation(
Class<C> arg0) {
// TODO Auto-generated method stub
return null;
}
+
@Override
public ModificationType getModificationType() {
// TODO Auto-generated method stub
return null;
}
+
@Override
public PathArgument getIdentifier() {
// TODO Auto-generated method stub
return null;
}
+
@Override
public Class<Link> getDataType() {
// TODO Auto-generated method stub
return null;
}
+
@Override
public Link getDataBefore() {
return link;
}
+
@Override
public Link getDataAfter() {
return link;
}
};
+
DataTreeModification<Link> evcLink = new DataTreeModification<Link>() {
@Override
public DataTreeIdentifier<Link> getRootPath() {
PowerMockito.doNothing().when(OvsdbUtils.class, "createGreTunnel", dataBroker, uniAugmentation,
uniAugmentation, node, UnimgrConstants.DEFAULT_BRIDGE_NAME, UnimgrConstants.DEFAULT_GRE_TUNNEL_NAME);
when(OvsdbUtils.createOvsdbNode(any(DataBroker.class), any(UniAugmentation.class)))
- .thenReturn(node);
+ .thenReturn(node);
when(UnimgrMapper.getOvsdbNodeIid(any(NodeId.class))).thenReturn(evcKey);
when(UnimgrMapper.getUniIid(any(DataBroker.class), any(IpAddress.class),
any(LogicalDatastoreType.class))).thenReturn(evcKey);
evcLink = DataTreeModificationHelper.getEvcLink(link);
evcRemoveCommand = new EvcRemoveCommand(dataBroker, evcLink);
}
+
/**
- * Test method for {@link org.opendaylight.unimgr.command.EvcRemoveCommand#execute().
+ * Test method for {@link org.opendaylight.unimgr.command.EvcRemoveCommand#execute()}.
* @throws Exception
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
any(LogicalDatastoreType.class));
}
-}
\ No newline at end of file
+}
evcLink = DataTreeModificationHelper.getEvcLink(link);
evcUpdateCommand = new EvcUpdateCommand(dataBroker, evcLink);
}
+
/**
* Test method for {@link org.opendaylight.unimgr.command.EvcUpdateCommand#execute()}.
* @throws Exception
PowerMockito.doNothing().when(OvsdbUtils.class, "createGreTunnel", dataBroker, uniAugmentation,
uniAugmentation, node, UnimgrConstants.DEFAULT_BRIDGE_NAME, UnimgrConstants.DEFAULT_GRE_TUNNEL_NAME);
when(OvsdbUtils.createOvsdbNode(any(DataBroker.class), any(UniAugmentation.class)))
- .thenReturn(node);
+ .thenReturn(node);
when(UnimgrMapper.getOvsdbBridgeNodeIid(any(Node.class))).thenReturn(evcKey);
when(UnimgrMapper.getUniIid(any(DataBroker.class), any(IpAddress.class),
any(LogicalDatastoreType.class))).thenReturn(evcKey);
when(MdsalUtils.readNode(any(DataBroker.class), any(LogicalDatastoreType.class),
any(InstanceIdentifier.class))).thenReturn(optionalOvsdbNode);
when(OvsdbUtils.createQoSForOvsdbNode(any(DataBroker.class), any(UniAugmentation.class)))
- .thenReturn(null);
+ .thenReturn(null);
when(UniUtils.updateUniNode(any(LogicalDatastoreType.class), any(InstanceIdentifier.class),
any(UniAugmentation.class), any(Node.class), any(DataBroker.class))).thenReturn(true);
when(OvsdbUtils.findOvsdbNode(any(DataBroker.class), any(UniAugmentation.class)))
performNrpDaoAction(addNode,null);
//when changing not sip related attribute
- OwnedNodeEdgePoint toUpdateNep = createNep(testNepName+"1",TerminationDirection.UndefinedOrUnknown);
+ OwnedNodeEdgePoint toUpdateNep = createNep(testNepName + "1", TerminationDirection.UndefinedOrUnknown);
performNrpDaoAction(update, toUpdateNep);
public void testNepRemoval() {
//given
performNrpDaoAction(addNode,null);
- String nepNameToRemove = testNepName+"0";
+ String nepNameToRemove = testNepName + "0";
//when
performNrpDaoAction(removeNep,nepNameToRemove);
//then
Node node = getAbstractNode();
- assertEquals(init_neps_count-1,node.getOwnedNodeEdgePoint().size());
+ assertEquals(init_neps_count - 1, node.getOwnedNodeEdgePoint().size());
assertFalse(node.getOwnedNodeEdgePoint().stream()
.anyMatch(nep -> nep.getUuid().getValue().equals(nepNameToRemove)));
}
}
private List<OwnedNodeEdgePoint> createTestOwnedNodeEdgePointList() {
- return IntStream.range(0,init_neps_count).
- mapToObj(i -> createNep(testNepName + i, TerminationDirection.Bidirectional))
- .collect(Collectors.toList());
+ return IntStream.range(0,init_neps_count)
+ .mapToObj(i -> createNep(testNepName + i, TerminationDirection.Bidirectional))
+ .collect(Collectors.toList());
}
private OwnedNodeEdgePoint createNep(String nepName, TerminationDirection td) {
.setUuid(uuid);
// TODO donaldh .setTerminationDirection(td);
- if (associateSip) builder.setMappedServiceInterfacePoint(Arrays.asList(new Uuid(sipPrefix + nepName)));
+ if (associateSip) {
+ builder.setMappedServiceInterfacePoint(Arrays.asList(new Uuid(sipPrefix + nepName)));
+ }
return builder.build();
}
}
return null;
}
-}
\ No newline at end of file
+}
return new EndPoint(ep, null);
}
+
protected void l(ReadWriteTransaction tx, String nA, String nepA, String nB, String nepB, OperationalState state) {
Uuid uuid = new Uuid(nepA + "-" + nepB);
Link link = new LinkBuilder()
protected Node n(ReadWriteTransaction tx, boolean addSips, String node, String ... endpoints) {
NrpDao nrpDao = new NrpDao(tx);
- if (addSips) Arrays.stream(endpoints).map(e -> new ServiceInterfacePointBuilder()
+ if (addSips) {
+ Arrays.stream(endpoints).map(e -> new ServiceInterfacePointBuilder()
.setUuid(new Uuid("sip:" + e))
.build())
.forEach(nrpDao::addSip);
-
+ }
return nrpDao.createSystemNode(node, Arrays.stream(endpoints)
.map(e-> {
OwnedNodeEdgePointBuilder builder = new OwnedNodeEdgePointBuilder().setUuid(new Uuid(e));
if (addSips) {
- builder.setMappedServiceInterfacePoint(Collections.singletonList(new Uuid("sip:"+e)));
+ builder.setMappedServiceInterfacePoint(Collections.singletonList(new Uuid("sip:" + e)));
}
return builder.build();
}).collect(Collectors.toList()));
final Optional<ActivationDriver> driver1 = driverRepo.getDriver(uuid);
try {
driverRepo.getDriver(new Uuid("otherDriver"));
- } catch(ActivationDriverNotFoundException expected) {}
+ } catch (ActivationDriverNotFoundException expected) {}
assertTrue(driver1.isPresent());
}
private void configureDecomposerAnswer(Function<List<org.opendaylight.unimgr.mef.nrp.api.EndPoint>, List<Subrequrest>> resp) {
try {
- when(decomposer.decompose(any(), any(Constraints.class)))
+ when(decomposer.decompose(any(), any(Constraints.class)))
.thenAnswer(a -> {
List<org.opendaylight.unimgr.mef.nrp.api.EndPoint> eps = a.getArgumentAt(0, List.class);
return resp.apply(eps);
.build();
}
-}
\ No newline at end of file
+}
assertEquals(1, connCtx.getConnectivityService().size());
assertFalse(connCtx.getConnectivityService().get(0).getEndPoint().isEmpty());
- assertEquals("cs:"+servId, connCtx.getConnectivityService().get(0).getUuid().getValue());
+ assertEquals("cs:" + servId, connCtx.getConnectivityService().get(0).getUuid().getValue());
}
boolean hasSip = nep.getMappedServiceInterfacePoint().get(0).getValue().equals("sip:" + nepId);
ServiceInterfacePoint sip = nrpDao.getSip("sip:" + nepId);
assertTrue(hasSip && sip != null);
- if (verifySip != null) verifySip.accept(sip);
-
+ if (verifySip != null) {
+ verifySip.accept(sip);
+ }
}
return input(nepId, null);
}
- enum SipType {enni, inni, uni}
+ enum SipType { enni, inni, uni }
private AddSipInput input(String nepId, SipType type) {
.setNepId(new Uuid(nepId))
.setNodeId(new Uuid(nodeId));
- if (type == null) return sipBuilder.build();
+ if (type == null) {
+ return sipBuilder.build();
+ }
switch (type) {
- case uni: sipBuilder.setSipType(
+ case uni:
+ sipBuilder.setSipType(
new UniSpecBuilder()
- .setUniSpec(new org.opendaylight.yang.gen.v1.urn.odl.unimgr.yang.unimgr.ext.rev700101.add.sip.input.sip.type.uni.spec.UniSpecBuilder().build())
+ .setUniSpec(new org.opendaylight.yang.gen.v1.urn.odl.unimgr.yang.unimgr.ext.rev700101.add.sip.input.sip.type.uni.spec.UniSpecBuilder().build())
.build());
break;
- case enni: sipBuilder.setSipType(
+ case enni:
+ sipBuilder.setSipType(
new EnniSpecBuilder()
.setEnniSpec(
new org.opendaylight.yang.gen.v1.urn.odl.unimgr.yang.unimgr.ext.rev700101.add.sip.input.sip.type.enni.spec.EnniSpecBuilder()
.build());
break;
case inni:
- default: sipBuilder.setSipType(
+ default:
+ sipBuilder.setSipType(
new InniSpecBuilder()
.setInniSpec(new org.opendaylight.yang.gen.v1.urn.odl.unimgr.yang.unimgr.ext.rev700101.add.sip.input.sip.type.inni.spec.InniSpecBuilder().build())
.build());
return sipBuilder.build();
}
-}
\ No newline at end of file
+}
}
- public static Builder builder() { return new Builder();}
+ public static Builder builder() {
+ return new Builder();
+ }
public static class Builder {
HashMap<Uuid, ActivationDriver> drivers = new HashMap<>();
.setUniSource(uniSourceList)
.build();
Optional<Link> optionalEvcLink = mock(Optional.class);
- Link lnk = mock (Link.class);
+ Link lnk = mock(Link.class);
when(optionalEvcLink.isPresent()).thenReturn(true);
when(optionalEvcLink.get()).thenReturn(lnk);
MemberModifier.suppress(MemberMatcher.method(MdsalUtils.class, "readLink", DataBroker.class, LogicalDatastoreType.class, InstanceIdentifier.class));
verify(mockAppender).doAppend(argThat(new ArgumentMatcher() {
@Override
public boolean matches(final Object argument) {
- return ((LoggingEvent)argument).getFormattedMessage().contains("Received a request to delete node");
+ return ((LoggingEvent)argument).getFormattedMessage().contains("Received a request to delete node");
}
- }));
+ }));
}
@SuppressWarnings("unchecked")
verify(mockAppender, times(2)).doAppend(argThat(new ArgumentMatcher() {
@Override
public boolean matches(final Object argument) {
- return ((LoggingEvent)argument).getFormattedMessage().contains("Creating a bridge on node");
+ return ((LoggingEvent)argument).getFormattedMessage().contains("Creating a bridge on node");
}
}));
}
verify(mockAppender).doAppend(argThat(new ArgumentMatcher() {
@Override
public boolean matches(final Object argument) {
- return ((LoggingEvent)argument).getFormattedMessage().contains("Created and submitted a new OVSDB node");
+ return ((LoggingEvent)argument).getFormattedMessage().contains("Created and submitted a new OVSDB node");
}
}));
doNothing().when(transaction).put(any(LogicalDatastoreType.class),
verify(mockAppender).doAppend(argThat(new ArgumentMatcher() {
@Override
public boolean matches(final Object argument) {
- return ((LoggingEvent)argument).getFormattedMessage().contains("Created and submitted a new OVSDB node");
+ return ((LoggingEvent)argument).getFormattedMessage().contains("Created and submitted a new OVSDB node");
}
}));
// createOvsdbNode with Uni
verify(mockAppender).doAppend(argThat(new ArgumentMatcher() {
@Override
public boolean matches(final Object argument) {
- return ((LoggingEvent)argument).getFormattedMessage().contains("Exception while creating Uni Node");
+ return ((LoggingEvent)argument).getFormattedMessage().contains("Exception while creating Uni Node");
}
}));
MemberModifier.suppress(MemberMatcher.method(UnimgrMapper.class, "getUniNodeIid", NodeId.class));
verify(mockAppender).doAppend(argThat(new ArgumentMatcher() {
@Override
public boolean matches(final Object argument) {
- return ((LoggingEvent)argument).getFormattedMessage().contains("Created and submitted a new Uni");
+ return ((LoggingEvent)argument).getFormattedMessage().contains("Created and submitted a new Uni");
}
}));
}
Node node = mock(Node.class);
List<Node> ndList = new ArrayList<Node>();
ndList.add(node);
- Topology topology = mock (Topology.class);
+ Topology topology = mock(Topology.class);
DataBroker dataBroker = mock(DataBroker.class);
UniAugmentation uniAugmentation = mock(UniAugmentation.class);
InstanceIdentifier<Topology> topologyInstanceIdentifier = mock(InstanceIdentifier.class);
Node node = mock(Node.class);
List<Node> ndList = new ArrayList<Node>();
ndList.add(node);
- Topology topology = mock (Topology.class);
+ Topology topology = mock(Topology.class);
DataBroker dataBroker = mock(DataBroker.class);
UniAugmentation uniAugmentation = mock(UniAugmentation.class);
InstanceIdentifier<Topology> topologyInstanceIdentifier = mock(InstanceIdentifier.class);
Node node = mock(Node.class);
List<Node> ndList = new ArrayList<Node>();
ndList.add(node);
- Topology topology = mock (Topology.class);
+ Topology topology = mock(Topology.class);
DataBroker dataBroker = mock(DataBroker.class);
UniAugmentation uniAugmentation = mock(UniAugmentation.class);
InstanceIdentifier<Topology> topologyInstanceIdentifier = mock(InstanceIdentifier.class);
Node node = mock(Node.class);
List<Node> ndList = new ArrayList<Node>();
ndList.add(node);
- Topology topology = mock (Topology.class);
+ Topology topology = mock(Topology.class);
DataBroker dataBroker = mock(DataBroker.class);
UniAugmentation uniAugmentation = mock(UniAugmentation.class);
IpAddress ipAddreDest = new IpAddress("10.10.0.2".toCharArray());