use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.
the class VplsManager method addInterfaces.
@Override
public void addInterfaces(VplsData vplsData, Collection<Interface> interfaces) {
requireNonNull(vplsData);
requireNonNull(interfaces);
VplsData newData = VplsData.of(vplsData);
newData.addInterfaces(interfaces);
updateVplsStatus(newData, VplsData.VplsState.UPDATING);
}
use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.
the class VplsNeighbourHandler method handleRequest.
/**
* Handles request messages.
*
* @param context the message context
*/
protected void handleRequest(NeighbourMessageContext context) {
// Find target VPLS first, then broadcast to all interface of this VPLS
VplsData vplsData = findVpls(context);
if (vplsData != null) {
vplsData.interfaces().stream().filter(intf -> !context.inPort().equals(intf.connectPoint())).forEach(context::forward);
} else {
log.warn(CAN_NOT_FIND_VPLS, context.inPort(), context.vlan());
context.drop();
}
}
use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.
the class VplsNeighbourHandler method handleReply.
/**
* Handles reply messages between VLAN tagged interfaces.
*
* @param context the message context
* @param hostService the host service
*/
protected void handleReply(NeighbourMessageContext context, HostService hostService) {
// Find target VPLS, then reply to the host
VplsData vplsData = findVpls(context);
if (vplsData != null) {
MacAddress dstMac = context.dstMac();
Set<Host> hosts = hostService.getHostsByMac(dstMac);
hosts = hosts.stream().filter(host -> vplsData.interfaces().contains(getHostInterface(host))).collect(Collectors.toSet());
// reply to all host in same VPLS
hosts.stream().map(this::getHostInterface).filter(Objects::nonNull).forEach(context::forward);
} else {
// this might be happened when we remove an interface from VPLS
// just ignore this message
log.warn(CAN_NOT_FIND_VPLS, context.inPort(), context.vlan());
context.drop();
}
}
use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.
the class VplsOperationManager method addVplsOperation.
/**
* Adds a VPLS operation to the queue of pending operations.
*
* @param vplsOperation the VPLS operation to add
*/
private void addVplsOperation(VplsOperation vplsOperation) {
VplsData vplsData = vplsOperation.vpls();
pendingVplsOperations.compute(vplsData.name(), (name, opQueue) -> {
opQueue = opQueue == null ? Queues.newArrayDeque() : opQueue;
// If the operation already exist in queue, ignore it.
if (opQueue.contains(vplsOperation)) {
return opQueue;
}
opQueue.add(vplsOperation);
return opQueue;
});
}
use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.
the class VplsCommand method removeIface.
/**
* Removes an interface from a VPLS.
*
* @param vplsName the name of the VLPS
* @param ifaceName the name of the interface to remove
*/
protected void removeIface(String vplsName, String ifaceName) {
if (vplsName == null) {
print(INSERT_VPLS_NAME);
return;
}
if (ifaceName == null) {
print(INSERT_INTERFACE);
return;
}
VplsData vplsData = vpls.getVpls(vplsName);
Interface iface = getInterface(ifaceName);
if (vplsData == null) {
print(VPLS_NOT_FOUND, vplsName);
return;
}
if (CHANGING_STATE.contains(vplsData.state())) {
// when a VPLS is updating, we shouldn't try modify it.
print("VPLS %s still updating, please wait it finished", vplsData.name());
return;
}
if (iface == null) {
print(IFACE_NOT_FOUND, ifaceName);
return;
}
if (!vplsData.interfaces().contains(iface)) {
print(IFACE_NOT_ASSOCIATED, ifaceName, vplsName);
return;
}
vpls.removeInterface(vplsData, iface);
}
Aggregations