* @author bartosz.michalik@amartus.com
*/
public class TopologyDataHandler implements DataTreeChangeListener<Node> {
- private static final Logger log = LoggerFactory.getLogger(TopologyDataHandler.class);
+ private static final Logger LOG = LoggerFactory.getLogger(TopologyDataHandler.class);
public static final InstanceIdentifier<Topology> NETCONF_TOPO_IID =
InstanceIdentifier
.create(NetworkTopology.class)
}
public void init() {
- log.debug("initializing topology handler for {}", DriverConstants.XR_NODE);
+ LOG.debug("initializing topology handler for {}", DriverConstants.XR_NODE);
ReadWriteTransaction tx = dataBroker.newReadWriteTransaction();
NrpDao dao = new NrpDao(tx);
Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
@Override
public void onSuccess(@Nullable Void result) {
- log.info("Node {} created", DriverConstants.XR_NODE);
+ LOG.info("Node {} created", DriverConstants.XR_NODE);
capabilitiesService = new CapabilitiesService(dataBroker);
registerNetconfTreeListener();
@Override
public void onFailure(Throwable t) {
- log.error("No node created due to the error", t);
+ LOG.error("No node created due to the error", t);
try {
TimeUnit.SECONDS.sleep(3);
} catch (InterruptedException _e) {
}
- log.info("retrying initialization of Topology handler for {}", DriverConstants.XR_NODE);
+ LOG.info("retrying initialization of Topology handler for {}", DriverConstants.XR_NODE);
init();
}
});
public void close() {
if(registration != null) {
- log.info("closing netconf tree listener");
+ LOG.info("closing netconf tree listener");
registration.close();
}
InstanceIdentifier<Node> nodeId = NETCONF_TOPO_IID.child(Node.class);
registration = dataBroker.registerDataTreeChangeListener(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, nodeId), this);
- log.info("netconf tree listener registered");
+ LOG.info("netconf tree listener registered");
}
onAddedNodes(addedNodes);
} catch(Exception e) {
//TODO improve error handling
- log.error("error while processing new Cisco nodes", e);
+ LOG.error("error while processing new Cisco nodes", e);
}
}
private void onAddedNodes(@Nonnull Collection<Node> added) throws ReadFailedException {
if(added.isEmpty()) return;
- log.debug("found {} added XR nodes", added.size());
+ LOG.debug("found {} added XR nodes", added.size());
final ReadWriteTransaction topoTx = dataBroker.newReadWriteTransaction();
NrpDao dao = new NrpDao(topoTx);
.build();
dao.addSip(sip);
nep = new OwnedNodeEdgePointBuilder(nep).setMappedServiceInterfacePoint(Collections.singletonList(sip.getUuid())).build();
- log.trace("Adding nep {} to {} node", nep.getUuid(), DriverConstants.XR_NODE);
+ LOG.trace("Adding nep {} to {} node", nep.getUuid(), DriverConstants.XR_NODE);
dao.updateNep(DriverConstants.XR_NODE, nep);
});
@Override
public void onSuccess(@Nullable Void result) {
- log.debug("TAPI node upadate successful");
+ LOG.debug("TAPI node upadate successful");
}
@Override
public void onFailure(Throwable t) {
- log.warn("TAPI node upadate failed due to an error", t);
+ LOG.warn("TAPI node upadate failed due to an error", t);
}
});
}
Optional<MountPoint> mountPoint = mountService.getMountPoint(id);
if(mountPoint.isPresent()) {
DataBroker deviceBroker = mountPoint.get().getService(DataBroker.class).get();
- log.debug(deviceBroker.toString());
+ LOG.debug(deviceBroker.toString());
List<OwnedNodeEdgePoint> tps;
try(ReadOnlyTransaction tx = deviceBroker.newReadOnlyTransaction()) {
tps = ports(tx)
.filter(isNep::test)
.map(i -> {
InterfaceConfigurationKey ikey = i.getKey();
- log.debug("found {} interface", ikey);
+ LOG.debug("found {} interface", ikey);
Uuid tpId = new Uuid(cn.getNodeId().getValue() + ":" + ikey.getInterfaceName().getValue());
return tpBuilder
return tps.stream();
} else {
- log.warn("no mount point for {}", key);
+ LOG.warn("no mount point for {}", key);
}
} catch (Exception e) {
- log.warn("error while processing " + key, e);
+ LOG.warn("error while processing " + key, e);
}
return Stream.empty();
}).collect(Collectors.toList());
@RunWith(PowerMockRunner.class)
@PrepareForTest(MountPointHelper.class)
public class L2vpnLocalConnectionActivatorTest extends AbstractDataBrokerTest{
- private static final Logger log = LoggerFactory.getLogger(L2vpnLocalConnectionActivatorTest.class);
+ private static final Logger LOG = LoggerFactory.getLogger(L2vpnLocalConnectionActivatorTest.class);
private L2vpnLocalConnectActivator l2VpnLocalConnectActivator;
private MountPointService mountService;
}
private void activate(){
- log.debug("activate L2VPN");
+ LOG.debug("activate L2VPN");
try {
l2VpnLocalConnectActivator.activate(endPoints,serviceId);
} catch (TransactionCommitFailedException e) {
public class EdgeAssureActivator implements ResourceActivator {
- private static final Logger log = LoggerFactory.getLogger(EdgeAssureActivator.class);
+ private static final Logger LOG = LoggerFactory.getLogger(EdgeAssureActivator.class);
private MountPointService mountService;
DataBroker baseDataBroker;
@Override
public void activate(List<EndPoint> endPoints, String serviceName) throws ResourceNotAvailableException, TransactionCommitFailedException {
- log.info("Activation called on EdgeAssureActivator");
+ LOG.info("Activation called on EdgeAssureActivator");
Uuid sip = endPoints.get(0).getEndpoint().getServiceInterfacePoint();
String nodeName = SipHandler.getDeviceName(sip);
long evcId = 1;
WriteTransaction w = netconfDataBroker.newWriteOnlyTransaction();
w.merge(LogicalDatastoreType.CONFIGURATION, evcConfigId, evcBuilder.build());
} else {
- log.error("");
+ LOG.error("");
}
}
@Override
public void deactivate(List<EndPoint> endPoints, String serviceName) throws TransactionCommitFailedException, ResourceNotAvailableException {
- log.info("Deactivation called on EdgeAssureActivator. Not yet implemented.");
+ LOG.info("Deactivation called on EdgeAssureActivator. Not yet implemented.");
}
}
\ No newline at end of file
* @author bartosz.michalik@amartus.com
*/
public class NrpDao {
- private static final Logger log = LoggerFactory.getLogger(NrpDao.class);
+ private static final Logger LOG = LoggerFactory.getLogger(NrpDao.class);
private final ReadWriteTransaction tx;
private final ReadTransaction rtx;
}
}
} catch (ReadFailedException e) {
- log.error("Cannot read {} with id {}",OwnedNodeEdgePoint.class, nodeId);
+ LOG.error("Cannot read {} with id {}",OwnedNodeEdgePoint.class, nodeId);
}
}
return rtx.read(LogicalDatastoreType.OPERATIONAL,
ctx().child(ServiceInterfacePoint.class, new ServiceInterfacePointKey(universalId))).checkedGet().isPresent();
} catch (ReadFailedException e) {
- log.error("Cannot read sip with id {}", universalId.getValue());
+ LOG.error("Cannot read sip with id {}", universalId.getValue());
}
return false;
}
verifyTx();
if(uuids == null) return ;
uuids.forEach(sip -> {
- log.debug("removing ServiceInterfacePoint with id {}", sip);
+ LOG.debug("removing ServiceInterfacePoint with id {}", sip);
tx.delete(LogicalDatastoreType.OPERATIONAL, ctx().child(ServiceInterfacePoint.class, new ServiceInterfacePointKey(sip)));
});
}
));
}
} catch (ReadFailedException e) {
- log.error("Cannot read node with id {}", nodeId);
+ LOG.error("Cannot read node with id {}", nodeId);
}
}
ctx().augmentation(org.opendaylight.yang.gen.v1.urn.mef.yang.tapi.connectivity.rev170712.Context1.class))
.checkedGet().orNull().getConnectivityService();
} catch (ReadFailedException e) {
- log.warn("reading connectivity services failed", e);
+ LOG.warn("reading connectivity services failed", e);
return null;
}
}
.checkedGet().orNull();
} catch (ReadFailedException e) {
- log.warn("reading connectivity service failed", e);
+ LOG.warn("reading connectivity service failed", e);
return null;
}
}
.checkedGet().orNull();
} catch (ReadFailedException e) {
- log.warn("reading connectivity service failed", e);
+ LOG.warn("reading connectivity service failed", e);
return null;
}
}
* @author bartosz.michalik@amartus.com
*/
public class NrpInitializer {
- private static final Logger log = LoggerFactory.getLogger(NrpInitializer.class);
+ private static final Logger LOG = LoggerFactory.getLogger(NrpInitializer.class);
private final DataBroker dataBroker;
Optional<? extends DataObject> context = result.checkedGet();
if(! context.isPresent()) {
- log.info("initialize Presto NRP context");
+ LOG.info("initialize Presto NRP context");
Context ctx = new ContextBuilder()
.setUuid(new Uuid(PRESTO_CTX))
.addAugmentation(org.opendaylight.yang.gen.v1.urn.mef.yang.tapi.topology.rev170712.Context1.class, context())
tx.put(LogicalDatastoreType.OPERATIONAL, ctxId, ctx);
try {
tx.submit().checkedGet();
- log.debug("Presto context model created");
+ LOG.debug("Presto context model created");
} catch (TransactionCommitFailedException e) {
- log.error("Failed to create presto context model");
+ LOG.error("Failed to create presto context model");
throw new IllegalStateException("cannot create presto context", e);
}
}
private Topology extTopo() {
Uuid topoId = new Uuid(PRESTO_EXT_TOPO);
- log.debug("Adding {}", PRESTO_EXT_TOPO);
+ LOG.debug("Adding {}", PRESTO_EXT_TOPO);
return new TopologyBuilder()
.setLayerProtocolName(Collections.singletonList(Eth.class))
.setUuid(topoId)
private Topology systemTopo() {
Uuid topoId = new Uuid(PRESTO_SYSTEM_TOPO);
- log.debug("Adding {}", PRESTO_SYSTEM_TOPO);
+ LOG.debug("Adding {}", PRESTO_SYSTEM_TOPO);
return new TopologyBuilder()
.setLayerProtocolName(Collections.singletonList(Eth.class))
.setUuid(topoId)
* @author bartosz.michalik@amartus.com
*/
class CreateConnectivityAction implements Callable<RpcResult<CreateConnectivityServiceOutput>> {
- private static final Logger log = LoggerFactory.getLogger(CreateConnectivityAction.class);
+ private static final Logger LOG = LoggerFactory.getLogger(CreateConnectivityAction.class);
private TapiConnectivityServiceImpl service;
private final CreateConnectivityServiceInput input;
@Override
public RpcResult<CreateConnectivityServiceOutput> call() throws Exception {
- log.debug("running CreateConnectivityService task");
+ LOG.debug("running CreateConnectivityService task");
try {
RequestValidator.ValidationResult validationResult = validateInput();
if (tx != null) {
ActivationTransaction.Result txResult = tx.activate();
if (txResult.isSuccessful()) {
- log.info("ConnectivityService construct activated successfully, request = {} ", input);
+ LOG.info("ConnectivityService construct activated successfully, request = {} ", input);
ConnectivityService service = createConnectivityModel(uniqueStamp);
CreateConnectivityServiceOutput result = new CreateConnectivityServiceOutputBuilder()
.setService(new ServiceBuilder(service).build()).build();
return RpcResultBuilder.success(result).build();
} else {
- log.warn("CreateConnectivityService failed, reason = {}, request = {}", txResult.getMessage(), input);
+ LOG.warn("CreateConnectivityService failed, reason = {}, request = {}", txResult.getMessage(), input);
}
}
throw new IllegalStateException("no transaction created for create connectivity request");
} catch (Exception e) {
- log.warn("Exception in create connectivity service", e);
+ LOG.warn("Exception in create connectivity service", e);
return RpcResultBuilder
.<CreateConnectivityServiceOutput>failed()
.withError(ErrorType.APPLICATION, e.getMessage())
}
private ActivationTransaction prepareTransaction(String serviceId) throws FailureResult {
- log.debug("decompose request");
+ LOG.debug("decompose request");
decomposedRequest = service.getDecomposer().decompose(endpoints, null);
ActivationTransaction tx = new ActivationTransaction();
throw new IllegalStateException(MessageFormat.format("driver {} cannot be created", s.getNodeUuid()));
}
driver.get().initialize(s.getEndpoints(), serviceId, null);
- log.debug("driver {} added to activation transaction", driver.get());
+ LOG.debug("driver {} added to activation transaction", driver.get());
return driver.get();
}).forEach(tx::addDriver);
assert decomposedRequest != null : "this method can be only run after request was successfuly decomposed";
//sort of unique ;)
- log.debug("Preparing connectivity related model for {}", uniqueStamp);
+ LOG.debug("Preparing connectivity related model for {}", uniqueStamp);
List<Connection> systemConnections = decomposedRequest.stream().map(s -> new ConnectionBuilder()
.setUuid(new Uuid("conn:" + s.getNodeUuid().getValue() + ":" + uniqueStamp))
tx.put(LogicalDatastoreType.OPERATIONAL, TapiConnectivityServiceImpl.connectivityCtx.child(Connection.class, new ConnectionKey(globalConnection.getUuid())), globalConnection);
- log.debug("Storing connectivity related model for {} to operational data store", uniqueStamp);
+ LOG.debug("Storing connectivity related model for {} to operational data store", uniqueStamp);
Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
@Override
public void onSuccess(@Nullable Void result) {
- log.info("Success with serializing Connections and Connectivity Service for {}", uniqueStamp);
+ LOG.info("Success with serializing Connections and Connectivity Service for {}", uniqueStamp);
}
@Override
public void onFailure(Throwable t) {
- log.error("Error with serializing Connections and Connectivity Service for " + uniqueStamp, t);
+ LOG.error("Error with serializing Connections and Connectivity Service for " + uniqueStamp, t);
}
});
* @author bartosz.michalik@amartus.com
*/
public class DeleteConnectivityAction implements Callable<RpcResult<DeleteConnectivityServiceOutput>> {
- private static final Logger log = LoggerFactory.getLogger(DeleteConnectivityAction.class);
+ private static final Logger LOG = LoggerFactory.getLogger(DeleteConnectivityAction.class);
private final DeleteConnectivityServiceInput input;
private final TapiConnectivityServiceImpl service;
try {
data = prepareData(cs, nrpDao);
} catch(Exception e) {
- log.info("Service {} does not exists", input.getServiceIdOrName());
+ LOG.info("Service {} does not exists", input.getServiceIdOrName());
return RpcResultBuilder
.<DeleteConnectivityServiceOutput>failed()
.withError(RpcError.ErrorType.APPLICATION, MessageFormat.format("error while preparing data for service {0} ", input.getServiceIdOrName()))
if (tx != null) {
ActivationTransaction.Result txResult = tx.deactivate();
if (txResult.isSuccessful()) {
- log.info("ConnectivityService construct deactivated successfully, request = {} ", input);
+ LOG.info("ConnectivityService construct deactivated successfully, request = {} ", input);
removeConnectivity();
DeleteConnectivityServiceOutput result = new DeleteConnectivityServiceOutputBuilder()
.setService(new ServiceBuilder(response).build()).build();
return RpcResultBuilder.success(result).build();
} else {
- log.warn("CreateConnectivityService deactivation failed, reason = {}, request = {}", txResult.getMessage(), input);
+ LOG.warn("CreateConnectivityService deactivation failed, reason = {}, request = {}", txResult.getMessage(), input);
}
}
throw new IllegalStateException("no transaction created for delete connectivity request");
} catch(Exception e) {
- log.warn("Exception in create connectivity service", e);
+ LOG.warn("Exception in create connectivity service", e);
return RpcResultBuilder
.<DeleteConnectivityServiceOutput>failed()
.build();
private void removeConnectivity() throws TransactionCommitFailedException {
WriteTransaction tx = service.getBroker().newWriteOnlyTransaction();
InstanceIdentifier<Context1> conCtx = NrpDao.ctx().augmentation(Context1.class);
- log.debug("Removing connectivity service {}", serviceId.getValue());
+ LOG.debug("Removing connectivity service {}", serviceId.getValue());
tx.delete(LogicalDatastoreType.OPERATIONAL, conCtx.child(ConnectivityService.class, new ConnectivityServiceKey(serviceId)));
connectionIds.forEach(csId -> {
- log.debug("Removing connection {}", csId.getValue());
+ LOG.debug("Removing connection {}", csId.getValue());
tx.delete(LogicalDatastoreType.OPERATIONAL, conCtx.child(Connection.class, new ConnectionKey(csId)));
});
//TODO should be transactional with operations on deactivation
throw new IllegalStateException(MessageFormat.format("driver {} cannot be created", e.getKey()));
}
driver.get().initialize(e.getValue(), serviceId.getValue(), null);
- log.debug("driver {} added to deactivation transaction", driver.get());
+ LOG.debug("driver {} added to deactivation transaction", driver.get());
return driver.get();
}).forEach(tx::addDriver);
return tx;
*/
public class TapiConnectivityServiceImpl implements TapiConnectivityService, AutoCloseable {
- private static final Logger log = LoggerFactory.getLogger(TapiConnectivityServiceImpl.class);
+ private static final Logger LOG = LoggerFactory.getLogger(TapiConnectivityServiceImpl.class);
private ActivationDriverRepoService driverRepo;
private RequestDecomposer decomposer;
private RequestValidator validator;
Objects.requireNonNull(validator);
Objects.requireNonNull(broker);
Objects.requireNonNull(serviceIdPool);
- log.info("TapiConnectivityService initialized");
+ LOG.info("TapiConnectivityService initialized");
}
@Override
*
*/
public class BasicDecomposer implements RequestDecomposer {
- private static final Logger log = LoggerFactory.getLogger(BasicDecomposer.class);
+ private static final Logger LOG = LoggerFactory.getLogger(BasicDecomposer.class);
private final DataBroker broker;
public BasicDecomposer(DataBroker broker) {
this.broker = broker;
- log.trace("basic decomposer initialized");
+ LOG.trace("basic decomposer initialized");
}
/**
* @author bartosz.michalik@amartus.com
*/
public class DecompositionAction {
- private static final Logger log = LoggerFactory.getLogger(DecompositionAction.class);
+ private static final Logger LOG = LoggerFactory.getLogger(DecompositionAction.class);
private final List<EndPoint> endpoints;
private final DataBroker broker;
private HashMap<Uuid, Vertex> sipToNep = new HashMap<>();
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));
});
public class EvcListener extends UnimgrDataTreeChangeListener<Evc> implements IUniAwareService {
- private static final Logger log = LoggerFactory.getLogger(EvcListener.class);
+ private static final Logger LOG = LoggerFactory.getLogger(EvcListener.class);
private ListenerRegistration<EvcListener> evcListenerRegistration;
private final IUniPortManager uniPortManager;
private final UniQosManager uniQosManager;
final DataTreeIdentifier<Evc> dataTreeIid = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION,
MefServicesUtils.getEvcsInstanceIdentifier());
evcListenerRegistration = dataBroker.registerDataTreeChangeListener(dataTreeIid, this);
- log.info("EvcDataTreeChangeListener created and registered");
+ LOG.info("EvcDataTreeChangeListener created and registered");
} catch (final Exception e) {
- log.error("Evc DataChange listener registration failed !", e);
+ LOG.error("Evc DataChange listener registration failed !", e);
throw new IllegalStateException("Evc registration Listener failed.", e);
}
}
@Override
public void add(DataTreeModification<Evc> newDataObject) {
if (newDataObject.getRootPath() != null && newDataObject.getRootNode() != null) {
- log.info("evc {} created", newDataObject.getRootNode().getIdentifier());
+ LOG.info("evc {} created", newDataObject.getRootNode().getIdentifier());
addEvc(newDataObject);
}
}
@Override
public void remove(DataTreeModification<Evc> removedDataObject) {
if (removedDataObject.getRootPath() != null && removedDataObject.getRootNode() != null) {
- log.info("evc {} deleted", removedDataObject.getRootNode().getIdentifier());
+ LOG.info("evc {} deleted", removedDataObject.getRootNode().getIdentifier());
removeEvc(removedDataObject);
}
}
@Override
public void update(DataTreeModification<Evc> modifiedDataObject) {
if (modifiedDataObject.getRootPath() != null && modifiedDataObject.getRootNode() != null) {
- log.info("evc {} updated", modifiedDataObject.getRootNode().getIdentifier());
+ LOG.info("evc {} updated", modifiedDataObject.getRootNode().getIdentifier());
updateEvc(modifiedDataObject);
}
}
NetvirtUtils.createElanInstance(dataBroker, instanceName, isEtree, evc.getSegmentationId());
evcElan = getOperEvcElan(evcId);
if (evcElan == null) {
- log.error("Evc {} has not been created as required. Nothing to reconnect", evcId);
+ LOG.error("Evc {} has not been created as required. Nothing to reconnect", evcId);
return;
}
}
EvcElan evcElan = getOperEvcElan(evcId);
if (evcElan == null) {
- log.error("Evc {} has not been created as required. Nothing to disconnect", evcId);
+ LOG.error("Evc {} has not been created as required. Nothing to disconnect", evcId);
return;
}
// Create interfaces
if (data.getUnis() == null) {
- log.info("No UNI's in service {}, exiting", instanceName);
+ LOG.info("No UNI's in service {}, exiting", instanceName);
return;
}
for (Uni uni : data.getUnis().getUni()) {
updateQos(data.getUnis().getUni());
}
} catch (final Exception e) {
- log.error("Add evc failed !", e);
+ LOG.error("Add evc failed !", e);
}
}
updateQos(uniToRemove);
EvcElan evcElan = getOperEvcElan(evcId);
if (evcElan == null) {
- log.error("Evc {} has not been created as required. Nothing to remove", data.getEvcId().getValue());
+ LOG.error("Evc {} has not been created as required. Nothing to remove", data.getEvcId().getValue());
return;
}
removeUniElanInterfaces(evcId, instanceName, uni);
}
- log.info("Removing elan instance: " + instanceName);
+ LOG.info("Removing elan instance: " + instanceName);
NetvirtUtils.deleteElanInstance(dataBroker, instanceName);
removeOperEvcElan(evcId);
}
} catch (final Exception e) {
- log.error("Remove evc failed !", e);
+ LOG.error("Remove evc failed !", e);
}
}
String instanceName = original.getEvcId().getValue();
boolean isEtree = update.getEvcType() == EvcType.RootedMultipoint;
- log.info("Updating {} instance: {}", isEtree ? "etree" : "elan", instanceName);
+ LOG.info("Updating {} instance: {}", isEtree ? "etree" : "elan", instanceName);
// Changed Uni will be deleted / recreated
List<Uni> uniToRemove = new ArrayList<>(originalUni);
updateUnis(uniToUpdate);
}
} catch (final Exception e) {
- log.error("Update evc failed !", e);
+ LOG.error("Update evc failed !", e);
}
}
throw new UnsupportedOperationException(errorMessage);
}
if (isOperEvcElanPort(evcId, interfaceName)) {
- log.info("elan interface for elan {} vlan {} interface {} exists already", instanceName, 0,
+ LOG.info("elan interface for elan {} vlan {} interface {} exists already", instanceName, 0,
interfaceName);
return;
}
- log.info("Creting elan interface for elan {} vlan {} interface {}", instanceName, 0, interfaceName);
+ LOG.info("Creting elan interface for elan {} vlan {} interface {}", instanceName, 0, interfaceName);
NetvirtUtils.createElanInterface(dataBroker, instanceName, interfaceName, roleToInterfaceType(role),
isEtree);
if (uni.isPortSecurityEnabled() && uni.getSecurityGroups() != null && !uni.getSecurityGroups().isEmpty()) {
throw new UnsupportedOperationException(errorMessage);
}
if (isOperEvcElanPort(evcId, interfaceName)) {
- log.info("elan interface for elan {} vlan {} interface {} exists already", instanceName, 0,
+ LOG.info("elan interface for elan {} vlan {} interface {} exists already", instanceName, 0,
interfaceName);
return;
}
- log.info("Creting elan interface for elan {} vlan {} interface {}", instanceName, 0, interfaceName);
+ LOG.info("Creting elan interface for elan {} vlan {} interface {}", instanceName, 0, interfaceName);
NetvirtUtils.createElanInterface(dataBroker, instanceName, interfaceName, roleToInterfaceType(role),
isEtree);
if (uni.isPortSecurityEnabled() && uni.getSecurityGroups() != null && !uni.getSecurityGroups().isEmpty()) {
if (evcUniCeVlan.isEmpty()) {
String interfaceName = uniPortManager.getUniVlanInterface(uni.getUniId().getValue(), Long.valueOf(0));
if (interfaceName == null || !isOperEvcElanPort(evcId, interfaceName)) {
- log.info("elan interface for elan {} vlan {} is not operational, nothing to remove", instanceName, 0,
+ LOG.info("elan interface for elan {} vlan {} is not operational, nothing to remove", instanceName, 0,
interfaceName);
interfaceName = uniPortManager.getUniVlanInterfaceName(uni.getUniId().getValue(), null);
}
Long vlan = safeCastVlan(ceVlan.getVid());
String interfaceName = uniPortManager.getUniVlanInterface(uni.getUniId().getValue(), vlan);
if (interfaceName == null || !isOperEvcElanPort(evcId, interfaceName)) {
- log.info("elan interface for elan {} vlan {} is not operational, nothing to remove", instanceName,
+ LOG.info("elan interface for elan {} vlan {} is not operational, nothing to remove", instanceName,
vlan, interfaceName);
interfaceName = uniPortManager.getUniVlanInterfaceName(uni.getUniId().getValue(), vlan);
}
}
private void removeElanInterface(InstanceIdentifier<Evc> identifier, String uniId, String interfaceName) {
- log.info("Removing elan interface: " + interfaceName);
+ LOG.info("Removing elan interface: " + interfaceName);
uniQosManager.unMapUniPortBandwidthLimits(uniId, interfaceName);
NetvirtUtils.deleteElanInterface(dataBroker, interfaceName);
EvcElan evcElan = getOperEvcElan(identifier);
if (evcElan == null) {
- log.error("Removing non-operational Elan interface {}", interfaceName);
+ LOG.error("Removing non-operational Elan interface {}", interfaceName);
}
deleteOperEvcElanPort(identifier, interfaceName);
private Long safeCastVlan(Object vid) {
if (!(vid instanceof Long)) {
String errorMessage = String.format("vlan id %s cannot be cast to Long", vid);
- log.error(errorMessage);
+ LOG.error(errorMessage);
throw new UnsupportedOperationException(errorMessage);
}
return (Long) vid;
private static final String BRIDGE_PREFIX = "br-";
private static final String TUNNEL_PREFIX = "tun";
- private static final Logger log = LoggerFactory.getLogger(NodeConnectorListener.class);
+ private static final Logger LOG = LoggerFactory.getLogger(NodeConnectorListener.class);
private static boolean generateMac = false;
private final UniPortManager uniPortManager;
private ListenerRegistration<NodeConnectorListener> nodeConnectorListenerRegistration;
final DataTreeIdentifier<FlowCapableNodeConnector> dataTreeIid = new DataTreeIdentifier<>(
LogicalDatastoreType.OPERATIONAL, getInstanceIdentifier());
nodeConnectorListenerRegistration = dataBroker.registerDataTreeChangeListener(dataTreeIid, this);
- log.info("NodeConnectorListener created and registered");
+ LOG.info("NodeConnectorListener created and registered");
configIntegrationBridge();
} catch (final Exception e) {
- log.error("Node connector listener registration failed !", e);
+ LOG.error("Node connector listener registration failed !", e);
throw new IllegalStateException("Node connector listener registration failed.", e);
}
}
@Override
public void add(DataTreeModification<FlowCapableNodeConnector> newDataObject) {
if (newDataObject.getRootPath() != null && newDataObject.getRootNode() != null) {
- log.info("node connector {} created", newDataObject.getRootNode().getIdentifier());
+ LOG.info("node connector {} created", newDataObject.getRootNode().getIdentifier());
addFlowCapableNodeConnector(newDataObject);
}
}
@Override
public void remove(DataTreeModification<FlowCapableNodeConnector> removedDataObject) {
if (removedDataObject.getRootPath() != null && removedDataObject.getRootNode() != null) {
- log.info("node connector {} deleted", removedDataObject.getRootNode().getIdentifier());
+ LOG.info("node connector {} deleted", removedDataObject.getRootNode().getIdentifier());
removeFlowCapableNodeConnector(removedDataObject);
}
}
@Override
public void update(DataTreeModification<FlowCapableNodeConnector> modifiedDataObject) {
if (modifiedDataObject.getRootPath() != null && modifiedDataObject.getRootNode() != null) {
- log.info("node connector {} updated", modifiedDataObject.getRootNode().getIdentifier());
+ LOG.info("node connector {} updated", modifiedDataObject.getRootNode().getIdentifier());
updateFlowCapableNodeConnector(modifiedDataObject);
}
}
handleNodeConnectorAdded(dataBroker, dpnFromNodeConnectorId, data);
} catch (final Exception e) {
- log.error("Add node connector failed !", e);
+ LOG.error("Add node connector failed !", e);
}
}
handleNodeConnectorRemoved(dataBroker, dpnFromNodeConnectorId, data);
} catch (final Exception e) {
- log.error("Remove node connector failed !", e);
+ LOG.error("Remove node connector failed !", e);
}
}
handleNodeConnectorUpdated(dataBroker, dpnFromNodeConnectorId, original, update);
} catch (final Exception e) {
- log.error("Update node connector failed !", e);
+ LOG.error("Update node connector failed !", e);
}
}
String uniName = MefInterfaceUtils.getDeviceInterfaceName(dpnId, nodeConnector.getName());
if (shouldFilterOutNodeConnector(uniName)) {
- log.info("filtered out interface {} with device {}", nodeConnector.getName(), dpnId);
+ LOG.info("filtered out interface {} with device {}", nodeConnector.getName(), dpnId);
return;
}
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
- log.info("Adding mef uni/device interface {} with device {}", nodeConnector.getName(), dpnId);
+ LOG.info("Adding mef uni/device interface {} with device {}", nodeConnector.getName(), dpnId);
InstanceIdentifier<Interface> interfacePath = MefInterfaceUtils.getDeviceInterfaceInstanceIdentifier(dpnId,
uniName);
try {
futures.get();
} catch (InterruptedException | ExecutionException e) {
- log.error("Error writing to datastore (path, data) : ({}, {}), ({}, {})", interfacePath, deviceInterface,
+ LOG.error("Error writing to datastore (path, data) : ({}, {}), ({}, {})", interfacePath, deviceInterface,
uniPath, uni);
throw new RuntimeException(e.getMessage());
}
public class UniPortManager extends UnimgrDataTreeChangeListener<Uni> implements IUniPortManager {
- private static final Logger log = LoggerFactory.getLogger(UniPortManager.class);
+ private static final Logger LOG = LoggerFactory.getLogger(UniPortManager.class);
private ListenerRegistration<UniPortManager> uniListenerRegistration;
private static int maxWaitRetries = 3;
private static long noVlan = 0l;
final DataTreeIdentifier<Uni> dataTreeIid = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION,
getInstanceIdentifier());
uniListenerRegistration = dataBroker.registerDataTreeChangeListener(dataTreeIid, this);
- log.info("UniPortListener created and registered");
+ LOG.info("UniPortListener created and registered");
} catch (final Exception e) {
- log.error("UniPortListener registration failed !", e);
+ LOG.error("UniPortListener registration failed !", e);
throw new IllegalStateException("UniPortListener registration failed.", e);
}
}
@Override
public void add(DataTreeModification<Uni> newDataObject) {
if (newDataObject.getRootPath() != null && newDataObject.getRootNode() != null) {
- log.info("uni node {} created", newDataObject.getRootNode().getIdentifier());
+ LOG.info("uni node {} created", newDataObject.getRootNode().getIdentifier());
}
Uni confUni = newDataObject.getRootNode().getDataAfter();
String uniId = confUni.getUniId().getValue();
@Override
public void remove(DataTreeModification<Uni> removedDataObject) {
if (removedDataObject.getRootPath() != null && removedDataObject.getRootNode() != null) {
- log.info("uni node {} deleted", removedDataObject.getRootNode().getIdentifier());
+ LOG.info("uni node {} deleted", removedDataObject.getRootNode().getIdentifier());
}
Uni confUni = removedDataObject.getRootNode().getDataBefore();
String uniId = confUni.getUniId().getValue();
@Override
public void update(DataTreeModification<Uni> modifiedDataObject) {
if (modifiedDataObject.getRootPath() != null && modifiedDataObject.getRootNode() != null) {
- log.info("node connector {} updated", modifiedDataObject.getRootNode().getIdentifier());
+ LOG.info("node connector {} updated", modifiedDataObject.getRootNode().getIdentifier());
}
Uni confUni = modifiedDataObject.getRootNode().getDataAfter();
String uniId = confUni.getUniId().getValue();
public void updateOperUni(String uniId) {
Uni confUni = MefInterfaceUtils.getUni(dataBroker, uniId, LogicalDatastoreType.CONFIGURATION);
if (confUni == null) {
- log.debug("No UNI {} exists, nothing to update");
+ LOG.debug("No UNI {} exists, nothing to update");
return;
}
synchronized (uniId.intern()) {
if (!checkOperUni(uniId)) {
return;
}
- log.info("UNI {} ports updated", uniId);
+ LOG.info("UNI {} ports updated", uniId);
removeCheckUniPorts(confUni);
addCheckUniPorts(confUni);
public void removeUniPorts(String uniId) {
Uni confUni = MefInterfaceUtils.getUni(dataBroker, uniId, LogicalDatastoreType.CONFIGURATION);
if (confUni == null) {
- log.debug("No UNI {} exists, nothing to update");
+ LOG.debug("No UNI {} exists, nothing to update");
return;
}
synchronized (uniId.intern()) {
private boolean checkOperUni(String uniId) {
Uni operUni = MefInterfaceUtils.getUni(dataBroker, uniId, LogicalDatastoreType.OPERATIONAL);
if (operUni == null) {
- log.info("Uni {} is not operational", uniId);
+ LOG.info("Uni {} is not operational", uniId);
return false;
}
return true;
}
private VlanToPort addTrunkInterface(String interfaceName, String parentInterfaceName, WriteTransaction tx) {
- log.info("Adding VLAN trunk {} ParentRef {}", interfaceName, parentInterfaceName);
+ LOG.info("Adding VLAN trunk {} ParentRef {}", interfaceName, parentInterfaceName);
Interface trunkInterface = NetvirtUtils.createTrunkInterface(interfaceName, parentInterfaceName);
NetvirtUtils.writeInterface(trunkInterface, tx);
return createOperTrunkInterfaceMapping(Long.valueOf(0), trunkInterface.getName());
private VlanToPort addTrunkMemberInterface(String interfaceName, String parentInterfaceName, Long vlan,
WriteTransaction tx) {
- log.info("Adding VLAN trunk member {} ParentRef {}", interfaceName, parentInterfaceName);
+ LOG.info("Adding VLAN trunk member {} ParentRef {}", interfaceName, parentInterfaceName);
Interface trunkInterface = NetvirtUtils.createTrunkMemberInterface(interfaceName, parentInterfaceName,
vlan.intValue());
NetvirtUtils.writeInterface(trunkInterface, tx);
}
private VlanToPort removeTrunkInterface(String interfaceName, Long vlan, WriteTransaction tx) {
- log.info("Delete VLAN trunk {}", interfaceName);
+ LOG.info("Delete VLAN trunk {}", interfaceName);
NetvirtUtils.deleteInterface(interfaceName, tx);
return createOperTrunkInterfaceMapping(vlan, interfaceName);
}
@Override
public void addCeVlan(String uniId, Long vlanId) {
if (getUniVlanInterfaceNoRetry(uniId, vlanId) != null) {
- log.debug("UNI {} Port for vlan {} exists already, nothing to update", uniId, vlanId);
+ LOG.debug("UNI {} Port for vlan {} exists already, nothing to update", uniId, vlanId);
return;
}
synchronized (uniId.intern()) {
Uni confUni = MefInterfaceUtils.getUni(dataBroker, uniId, LogicalDatastoreType.CONFIGURATION);
if (confUni == null) {
- log.debug("No UNI {} exists, nothing to update");
+ LOG.debug("No UNI {} exists, nothing to update");
return;
}
if (!checkOperUni(uniId)) {
return;
}
- log.info("UNI {} Vlan {} adding", uniId, vlanId);
+ LOG.info("UNI {} Vlan {} adding", uniId, vlanId);
List<CeVlan> ceVlans = confUni.getCeVlans() != null ? confUni.getCeVlans().getCeVlan() : new ArrayList<>();
CeVlanBuilder ceVlanBuilder = new CeVlanBuilder();
ceVlanBuilder.setVid(new VlanIdType(vlanId));
@Override
public void removeCeVlan(String uniId, Long vlanId) {
if (getUniVlanInterfaceNoRetry(uniId, vlanId) == null) {
- log.debug("No UNI {} Port for vlan {} dosn't exist already, nothing to delete", uniId, vlanId);
+ LOG.debug("No UNI {} Port for vlan {} dosn't exist already, nothing to delete", uniId, vlanId);
return;
}
synchronized (uniId.intern()) {
Uni confUni = MefInterfaceUtils.getUni(dataBroker, uniId, LogicalDatastoreType.CONFIGURATION);
if (confUni == null) {
- log.debug("No UNI {} exists, nothing to update");
+ LOG.debug("No UNI {} exists, nothing to update");
return;
}
if (!checkOperUni(uniId)) {
return;
}
- log.info("UNI {} Vlan {} deleting", uniId, vlanId);
+ LOG.info("UNI {} Vlan {} deleting", uniId, vlanId);
UniBuilder uniBuilder = new UniBuilder(confUni);
if (vlanId != null && vlanId != noVlan) {
}
private String getUniVlanInterfaceRetry(String uniId, Long vlanId, int retries) {
- log.trace("Retry {} to wait for uniId {} vlan {} interface", retries, uniId, vlanId);
+ LOG.trace("Retry {} to wait for uniId {} vlan {} interface", retries, uniId, vlanId);
List<VlanToPort> vlanToPorts = getOperTrunkInterfaces(uniId);
java.util.Optional<String> toReturn = vlanToPorts.stream()
.filter(port -> port.getVlan().getValue().equals(vlanId)).map(port -> port.getVlanPortId()).findFirst();
* @author bartosz.michalik@amartus.com
*/
public class TemplateDriver implements ActivationDriverBuilder {
- private static final Logger log = LoggerFactory.getLogger(TemplateDriver.class);
+ private static final Logger LOG = LoggerFactory.getLogger(TemplateDriver.class);
@Override
public Optional<ActivationDriver> driverFor(BuilderContext context) {
// build a stateful driver
@Override
public void commit() {
- log.info("commit was triggered for {}", serviceId);
+ LOG.info("commit was triggered for {}", serviceId);
}
@Override
public void rollback() {
- log.info("rollback was triggered for {}", serviceId);
+ LOG.info("rollback was triggered for {}", serviceId);
}
@Override
@Override
public void activate() throws TransactionCommitFailedException, ResourceActivatorException {
// method can fail if you wish
- log.info("activate was triggered for {}", serviceId);
+ LOG.info("activate was triggered for {}", serviceId);
}
@Override
public void deactivate() throws TransactionCommitFailedException, ResourceActivatorException {
// method can fail if you wish
- log.info("adectivate was triggered for {}", serviceId);
+ LOG.info("adectivate was triggered for {}", serviceId);
}
@Override
* @author bartosz.michalik@amartus.com
*/
public class TopologyDataHandler {
- private static final Logger log = LoggerFactory.getLogger(TopologyDataHandler.class);
+ private static final Logger LOG = LoggerFactory.getLogger(TopologyDataHandler.class);
private DataBroker dataBroker;
public TopologyDataHandler(DataBroker dataBroker) {
public void init() {
Objects.requireNonNull(dataBroker);
- log.info("Starting topology handler");
+ LOG.info("Starting topology handler");
// this is a static and simplistic topology push to the TAPI system topology
ReadWriteTransaction tx = dataBroker.newReadWriteTransaction();
tx.submit().checkedGet();
} catch (TransactionCommitFailedException e) {
- log.error("Adding node to system topology has failed", e);
+ LOG.error("Adding node to system topology has failed", e);
}
}
}
public void close() {
- log.info("Closing topology handler");
+ LOG.info("Closing topology handler");
}
}