/*
- * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2016, 2017 Ericsson India Global Services Pvt Ltd. 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,
}
public LogicalSwitch getLogicalSwitch(UUID uuid) {
- return (LogicalSwitch) getDeviceOpData(LogicalSwitches.class, uuid);
+ return (LogicalSwitch) getDeviceOperData(LogicalSwitches.class, uuid);
}
public Map<UUID, LogicalSwitch> getLogicalSwitches() {
}
public PhysicalLocator getPhysicalLocator(UUID uuid) {
- return (PhysicalLocator) getDeviceOpData(TerminationPoint.class, uuid);
+ return (PhysicalLocator) getDeviceOperData(TerminationPoint.class, uuid);
}
public Map<UUID, PhysicalLocator> getPhysicalLocators() {
public void markKeyAsInTransit(Class<? extends Identifiable> cls, InstanceIdentifier key) {
LOG.debug("Marking device data as intransit {}", key);
- DeviceData deviceData = getDeviceOpData(cls, key);
+ DeviceData deviceData = getDeviceOperData(cls, key);
UUID uuid = null;
Object data = null;
if (deviceData != null) {
new DeviceData(key, uuid, data, DeviceDataStatus.IN_TRANSIT));
}
- public void updateDeviceOpData(Class<? extends Identifiable> cls, InstanceIdentifier key, UUID uuid, Object data) {
+ public void updateDeviceOperData(Class<? extends Identifiable> cls, InstanceIdentifier key, UUID uuid, Object data) {
LOG.debug("Updating device data {}", key);
HwvtepSouthboundUtil.updateData(opKeyVsData, cls, key,
new DeviceData(key, uuid, data, DeviceDataStatus.AVAILABLE));
HwvtepSouthboundUtil.updateData(uuidVsData, cls, uuid, data);
}
- public void clearDeviceOpData(Class<? extends Identifiable> cls, InstanceIdentifier key) {
+ public void clearDeviceOperData(Class<? extends Identifiable> cls, InstanceIdentifier key) {
DeviceData deviceData = HwvtepSouthboundUtil.getData(opKeyVsData, cls, key);
if (deviceData != null && deviceData.uuid != null) {
HwvtepSouthboundUtil.clearData(uuidVsData, cls, deviceData.uuid);
HwvtepSouthboundUtil.clearData(opKeyVsData, cls, key);
}
- public Object getDeviceOpData(Class<? extends Identifiable> cls, UUID uuid) {
+ public Object getDeviceOperData(Class<? extends Identifiable> cls, UUID uuid) {
return HwvtepSouthboundUtil.getData(uuidVsData, cls, uuid);
}
- public DeviceData getDeviceOpData(Class<? extends Identifiable> cls, InstanceIdentifier key) {
+ public DeviceData getDeviceOperData(Class<? extends Identifiable> cls, InstanceIdentifier key) {
return HwvtepSouthboundUtil.getData(opKeyVsData, cls, key);
}
dependencyQueue.processReadyJobsFromConfigQueue(connectionInstance);
}
- public void onOpDataAvailable() {
+ public void onOperDataAvailable() {
dependencyQueue.processReadyJobsFromOpQueue(connectionInstance);
}
}
}
}
- onOpDataAvailable();
+ onOperDataAvailable();
}
}
/*
- * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2016, 2017 Ericsson India Global Services Pvt Ltd. 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,
@Override
protected boolean isDependencyMet(HwvtepDeviceInfo deviceInfo, Class cls, InstanceIdentifier iid) {
- HwvtepDeviceInfo.DeviceData deviceData = deviceInfo.getDeviceOpData(cls, iid);
+ HwvtepDeviceInfo.DeviceData deviceData = deviceInfo.getDeviceOperData(cls, iid);
return deviceData == null || deviceData.getStatus() != HwvtepDeviceInfo.DeviceDataStatus.IN_TRANSIT;
}
}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.base.Optional;
-
public class UcastMacsRemoteRemoveCommand extends AbstractTransactCommand<RemoteUcastMacs, HwvtepGlobalAugmentation> {
private static final Logger LOG = LoggerFactory.getLogger(UcastMacsRemoteRemoveCommand.class);
InstanceIdentifier<RemoteUcastMacs> macIid = instanceIdentifier.augmentation(HwvtepGlobalAugmentation.class).
child(RemoteUcastMacs.class, mac.getKey());
HwvtepDeviceInfo.DeviceData deviceData =
- getOperationalState().getDeviceInfo().getDeviceOpData(RemoteUcastMacs.class, macIid);
+ getOperationalState().getDeviceInfo().getDeviceOperData(RemoteUcastMacs.class, macIid);
UcastMacsRemote ucastMacsRemote = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
UcastMacsRemote.class, null);
if (deviceData != null && deviceData.getUuid() != null) {
package org.opendaylight.ovsdb.hwvtepsouthbound.transact;
-import com.google.common.base.Optional;
import com.google.common.collect.Lists;
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
import org.opendaylight.ovsdb.schema.hardwarevtep.UcastMacsRemote;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.EncapsulationTypeBase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.EncapsulationTypeVxlanOverIpv4;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorAugmentationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteUcastMacs;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import static org.opendaylight.ovsdb.lib.operations.Operations.op;
-
public class UcastMacsRemoteUpdateCommand extends AbstractTransactCommand<RemoteUcastMacs, HwvtepGlobalAugmentation> {
private static final Logger LOG = LoggerFactory.getLogger(UcastMacsRemoteUpdateCommand.class);
private static final UcastMacUnMetDependencyGetter UCAST_MAC_DATA_VALIDATOR = new UcastMacUnMetDependencyGetter();
Object... extraData) {
LOG.debug("Creating remoteUcastMacs, mac address: {}", remoteUcastMac.getMacEntryKey().getValue());
HwvtepDeviceInfo.DeviceData deviceData =
- getOperationalState().getDeviceInfo().getDeviceOpData(RemoteUcastMacs.class, macKey);
+ getOperationalState().getDeviceInfo().getDeviceOperData(RemoteUcastMacs.class, macKey);
UcastMacsRemote ucastMacsRemote = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), UcastMacsRemote.class);
setIpAddress(ucastMacsRemote, remoteUcastMac);
@SuppressWarnings("unchecked")
InstanceIdentifier<LogicalSwitches> lswitchIid =
(InstanceIdentifier<LogicalSwitches>) inputMac.getLogicalSwitchRef().getValue();
- HwvtepDeviceInfo.DeviceData deviceData = getOperationalState().getDeviceInfo().getDeviceOpData(
+ HwvtepDeviceInfo.DeviceData deviceData = getOperationalState().getDeviceInfo().getDeviceOperData(
LogicalSwitches.class, lswitchIid);
if (deviceData != null && deviceData.getUuid() != null) {
ucastMacsRemote.setLogicalSwitch(deviceData.getUuid());
@SuppressWarnings("unchecked")
InstanceIdentifier<TerminationPoint> iid = (InstanceIdentifier<TerminationPoint>) inputMac.getLocatorRef().getValue();
//try to find locator in operational DS
- HwvtepDeviceInfo.DeviceData deviceData = getOperationalState().getDeviceInfo().getDeviceOpData(TerminationPoint.class, iid);
+ HwvtepDeviceInfo.DeviceData deviceData = getOperationalState().getDeviceInfo().getDeviceOperData(TerminationPoint.class, iid);
if (deviceData != null) {
//if exist, get uuid
locatorUuid = deviceData.getUuid();
/*
- * Copyright (c) 2015, 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2015, 2017 Ericsson India Global Services Pvt Ltd. 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,
.child(LogicalSwitches.class, new LogicalSwitchesKey(new HwvtepNodeName(lSwitch.getName())));
// TODO Delete any references
transaction.delete(LogicalDatastoreType.OPERATIONAL, switchIid);
- getOvsdbConnectionInstance().getDeviceInfo().clearDeviceOpData(LogicalSwitches.class, switchIid);
+ getOvsdbConnectionInstance().getDeviceInfo().clearDeviceOperData(LogicalSwitches.class, switchIid);
}
}
/*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2015, 2017 Ericsson India Global Services Pvt Ltd. 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,
InstanceIdentifier<LogicalSwitches> switchIid = getOvsdbConnectionInstance().getInstanceIdentifier()
.augmentation(HwvtepGlobalAugmentation.class)
.child(LogicalSwitches.class, new LogicalSwitchesKey(new HwvtepNodeName(lSwitch.getName())));
- getOvsdbConnectionInstance().getDeviceInfo().updateDeviceOpData(LogicalSwitches.class, switchIid,
+ getOvsdbConnectionInstance().getDeviceInfo().updateDeviceOperData(LogicalSwitches.class, switchIid,
lSwitch.getUuid(), lSwitch);
// TODO: Delete entries that are no longer needed
}
new RemoteUcastMacsKey(getLogicalSwitchRef(rum.getLogicalSwitchColumn().getData()),
getMacAddress(rum.getMac())));
transaction.delete(LogicalDatastoreType.OPERATIONAL, rumId);
- getOvsdbConnectionInstance().getDeviceInfo().clearDeviceOpData(RemoteUcastMacs.class, rumId);
+ getOvsdbConnectionInstance().getDeviceInfo().clearDeviceOperData(RemoteUcastMacs.class, rumId);
} else {
LOG.debug("Failed to delete UcastMacRemote entry {}", rum.getUuid());
}
new RemoteMcastMacsKey(getLogicalSwitchRef(rmm.getLogicalSwitchColumn().getData()),
getMacAddress(rmm.getMac())));
transaction.delete(LogicalDatastoreType.OPERATIONAL, lumId);
- getOvsdbConnectionInstance().getDeviceInfo().clearDeviceOpData(RemoteMcastMacs.class, lumId);
+ getOvsdbConnectionInstance().getDeviceInfo().clearDeviceOperData(RemoteMcastMacs.class, lumId);
} else {
LOG.debug("Failed to delete McastMacRemote entry {}", rmm.getUuid());
}
/*
- * Copyright (c) 2015, 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2015, 2017 Ericsson India Global Services Pvt Ltd. 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,
Node connectionNode = buildConnectionNode(mMacRemote);
transaction.merge(LogicalDatastoreType.OPERATIONAL, connectionIId, connectionNode);
InstanceIdentifier<RemoteMcastMacs> macIid = getMacIid(connectionIId, connectionNode);
- getOvsdbConnectionInstance().getDeviceInfo().updateDeviceOpData(RemoteMcastMacs.class,
+ getOvsdbConnectionInstance().getDeviceInfo().updateDeviceOperData(RemoteMcastMacs.class,
macIid, mMacRemote.getUuid(), mMacRemote);
// TODO: Delete entries that are no longer needed
}
/*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2015, 2017 Ericsson India Global Services Pvt Ltd. 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,
for (TransactionCommand command: commands) {
command.execute(transaction);
}
- connectionInstance.getDeviceInfo().onOpDataAvailable();
+ connectionInstance.getDeviceInfo().onOperDataAvailable();
}
}
/*
- * Copyright (c) 2015 - 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2015 - 2017 Ericsson India Global Services Pvt Ltd. 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,
final InstanceIdentifier<TerminationPoint> nodePath = HwvtepSouthboundMapper
.createInstanceIdentifier(connectionIId, pLoc);
transaction.delete(LogicalDatastoreType.OPERATIONAL, nodePath);
- getOvsdbConnectionInstance().getDeviceInfo().clearDeviceOpData(TerminationPoint.class, nodePath);
+ getOvsdbConnectionInstance().getDeviceInfo().clearDeviceOperData(TerminationPoint.class, nodePath);
//TODO: Check if any cleanup is required
}
/*
- * Copyright (c) 2015 - 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2015 - 2017 Ericsson India Global Services Pvt Ltd. 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,
transaction.put(LogicalDatastoreType.OPERATIONAL,
tpPath, tpBuilder.build());
}
- getOvsdbConnectionInstance().getDeviceInfo().updateDeviceOpData(
+ getOvsdbConnectionInstance().getDeviceInfo().updateDeviceOperData(
TerminationPoint.class, tpPath, pLoc.getUuid(), pLoc);
}
}
/*
- * Copyright (c) 2015, 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2015, 2017 Ericsson India Global Services Pvt Ltd. 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,
Node connectionNode = buildConnectionNode(ucastMacsRemote);
transaction.merge(LogicalDatastoreType.OPERATIONAL, connectionIId, connectionNode);
InstanceIdentifier<RemoteUcastMacs> macIid = getMacIid(connectionIId, connectionNode);
- getOvsdbConnectionInstance().getDeviceInfo().updateDeviceOpData(RemoteUcastMacs.class, macIid,
+ getOvsdbConnectionInstance().getDeviceInfo().updateDeviceOperData(RemoteUcastMacs.class, macIid,
ucastMacsRemote.getUuid(), ucastMacsRemote);
//TODO: Handle any deletes
}
/*
- * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2016, 2017 Ericsson India Global Services Pvt Ltd. 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,
latch.countDown();
}
});
- opState.getDeviceInfo().onOpDataAvailable();
+ opState.getDeviceInfo().onOperDataAvailable();
assertEquals(1, latch.getCount());
- opState.getDeviceInfo().updateDeviceOpData(LogicalSwitches.class, lsIid, new UUID("ls0"), "ls0");
- opState.getDeviceInfo().onOpDataAvailable();
+ opState.getDeviceInfo().updateDeviceOperData(LogicalSwitches.class, lsIid, new UUID("ls0"), "ls0");
+ opState.getDeviceInfo().onOperDataAvailable();
assertEquals(0, latch.getCount());
}
/*
- * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2016, 2017 Ericsson India Global Services Pvt Ltd. 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,
resetOperations();
addData(OPERATIONAL, TerminationPoint.class, terminationPoints);
addData(OPERATIONAL, RemoteUcastMacs.class, ucastMacs);
- connectionInstance.getDeviceInfo().onOpDataAvailable();
+ connectionInstance.getDeviceInfo().onOperDataAvailable();
//2 mcast mac + 2 locator sets ( termination point already added )
verify(Operations.op, times(4)).insert(Matchers.<McastMacsRemote>any());
addData(CONFIGURATION, RemoteMcastMacs.class, mcastMac2);
verify(Operations.op, times(0)).insert(Matchers.<McastMacsRemote>any());
addData(OPERATIONAL, RemoteMcastMacs.class, mcastMacs);
- connectionInstance.getDeviceInfo().onOpDataAvailable();
+ connectionInstance.getDeviceInfo().onOperDataAvailable();
verify(Operations.op, times(2)).insert(Matchers.<McastMacsRemote>any());
verify(Operations.op, times(2)).update(Matchers.<McastMacsRemote>any());
}
/*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2016, 2017 Ericsson India Global Services Pvt Ltd. 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,
InstanceIdentifier instanceIdentifier = getKey(key, mod, mod.getDataAfter());
switch(type) {
case WRITE:
- connectionInstance.getDeviceInfo().updateDeviceOpData(childClass, instanceIdentifier,
+ connectionInstance.getDeviceInfo().updateDeviceOperData(childClass, instanceIdentifier,
new UUID("uuid"), mod.getDataAfter());
break;
case DELETE:
- connectionInstance.getDeviceInfo().clearDeviceOpData(childClass, instanceIdentifier);
+ connectionInstance.getDeviceInfo().clearDeviceOperData(childClass, instanceIdentifier);
break;
case SUBTREE_MODIFIED:
}
/*
- * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2016, 2017 Ericsson India Global Services Pvt Ltd. 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,
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.opendaylight.controller.md.sal.binding.test.AbstractDataBrokerTest;
import org.opendaylight.ovsdb.hwvtepsouthbound.transact.HwvtepOperationalState;
import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.lib.operations.Operations;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepNodeName;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitchesKey;
-import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNotNull;
-import static org.mockito.Mockito.when;
-import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION;
@RunWith(PowerMockRunner.class)
@PrepareForTest({HwvtepConnectionInstance.class, HwvtepConnectionManager.class, Operations.class})
result = opState.getDeviceInfo().isKeyInTransit(LogicalSwitches.class, lsIid);
assertTrue(result);
- opState.getDeviceInfo().updateDeviceOpData(LogicalSwitches.class, lsIid, uuid, lsIid);
+ opState.getDeviceInfo().updateDeviceOperData(LogicalSwitches.class, lsIid, uuid, lsIid);
result = opState.getDeviceInfo().isKeyInTransit(LogicalSwitches.class, lsIid);
assertFalse(result);
/*
- * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2016, 2017 Ericsson India Global Services Pvt Ltd. 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,
unMetDependencies = MCAST_MAC_DATA_VALIDATOR.getInTransitDependencies(opState, mac);
assertEquals(1, unMetDependencies.size());
- opState.getDeviceInfo().updateDeviceOpData(LogicalSwitches.class, lsIid, new UUID("ls0"), "ls0");
+ opState.getDeviceInfo().updateDeviceOperData(LogicalSwitches.class, lsIid, new UUID("ls0"), "ls0");
unMetDependencies = MCAST_MAC_DATA_VALIDATOR.getInTransitDependencies(opState, mac);
assertEquals(0, unMetDependencies.size());
}