description "MAC address entry";
type yang:mac-address;
}
+ leaf mac-entry-uuid {
+ description "The unique identifier of the mac-entry";
+ type yang:uuid;
+ }
leaf logical-switch-ref {
description "The logical switch to which this mapping applies";
type hwvtep-logical-switch-ref;
/*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others. All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute 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,
setTunnelKey(logicalSwitch, lswitch);
if (!operationalSwitchOptional.isPresent()) {
setName(logicalSwitch, lswitch, operationalSwitchOptional);
+ LOG.trace("execute: creating LogicalSwitch entry: {}", logicalSwitch);
transaction.add(op.insert(logicalSwitch));
+ transaction.add(op.comment("Logical Switch: Creating " + lswitch.getHwvtepNodeName().getValue()));
} else {
LogicalSwitches updatedLSwitch = operationalSwitchOptional.get();
String existingLogicalSwitchName = updatedLSwitch.getHwvtepNodeName().getValue();
// Name is immutable, and so we *can't* update it. So we use extraBridge for the schema stuff
LogicalSwitch extraLogicalSwitch = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), LogicalSwitch.class);
extraLogicalSwitch.setName("");
+ LOG.trace("execute: updating LogicalSwitch entry: {}", logicalSwitch);
transaction.add(op.update(logicalSwitch)
.where(extraLogicalSwitch.getNameColumn().getSchema().opEqual(existingLogicalSwitchName))
.build());
+ transaction.add(op.comment("Logical Switch: Updating " + existingLogicalSwitchName));
}
}
}
/*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others. All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute 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.opendaylight.controller.md.sal.binding.api.DataObjectModification;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundConstants;
+import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
import org.opendaylight.ovsdb.schema.hardwarevtep.McastMacsLocal;
import com.google.common.base.Optional;
public class McastMacsLocalRemoveCommand extends AbstractTransactCommand {
- private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
+ private static final Logger LOG = LoggerFactory.getLogger(McastMacsLocalRemoveCommand.class);
public McastMacsLocalRemoveCommand(HwvtepOperationalState state,
Collection<DataTreeModification<Node>> changes) {
getOperationalState().getLocalMcastMacs(instanceIdentifier, mac.getKey());
McastMacsLocal mcastMacsLocal = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
McastMacsLocal.class, null);
- if (operationalMacOptional.isPresent()) {
+ if (operationalMacOptional.isPresent() && operationalMacOptional.get().getMacEntryUuid() != null) {
//when mac entry is deleted, its referenced locator set and locators are deleted automatically.
//TODO: locator in config DS is not deleted
- String macString = null;
- if (mac.getMacEntryKey().equals(HwvtepSouthboundConstants.UNKNOWN_DST_MAC)) {
- macString = HwvtepSouthboundConstants.UNKNOWN_DST_STRING;
- } else {
- macString = mac.getMacEntryKey().getValue();
- }
- transaction.add(op.delete(mcastMacsLocal.getSchema())
- .where(mcastMacsLocal.getMacColumn().getSchema().opEqual(macString)).build());
- transaction.add(op.comment("Local McastMacLocal: Deleting " + mac.getMacEntryKey().getValue()));
+ UUID macEntryUUID = new UUID(operationalMacOptional.get().getMacEntryUuid().getValue());
+ transaction.add(op.delete(mcastMacsLocal.getSchema()).
+ where(mcastMacsLocal.getUuidColumn().getSchema().opEqual(macEntryUUID)).build());
+ transaction.add(op.comment("McastMacLocal: Deleting " + mac.getMacEntryKey().getValue()));
} else {
LOG.warn("Unable to delete localMcastMacs {} because it was not found in the operational store",
mac.getMacEntryKey().getValue());
/*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others. All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute 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 com.google.common.base.Optional;
public class McastMacsLocalUpdateCommand extends AbstractTransactCommand {
- private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
+ private static final Logger LOG = LoggerFactory.getLogger(McastMacsLocalUpdateCommand.class);
public McastMacsLocalUpdateCommand(HwvtepOperationalState state,
Collection<DataTreeModification<Node>> changes) {
setLogicalSwitch(mcastMacsLocal, localMcastMac);
if (!operationalMacOptional.isPresent()) {
setMac(mcastMacsLocal, localMcastMac, operationalMacOptional);
+ LOG.trace("execute: create LocalMcastMac entry: {}", mcastMacsLocal);
transaction.add(op.insert(mcastMacsLocal));
+ transaction.add(op.comment("McastMacLocal: Creating " + localMcastMac.getMacEntryKey().getValue()));
} else {
LocalMcastMacs updatedMac = operationalMacOptional.get();
String existingMac = updatedMac.getMacEntryKey().getValue();
McastMacsLocal extraMac = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), McastMacsLocal.class);
- extraMac.setMac("");;
+ extraMac.setMac("");
+ LOG.trace("execute: update LocalMcastMac entry: {}", mcastMacsLocal);
transaction.add(op.update(mcastMacsLocal)
.where(extraMac.getMacColumn().getSchema().opEqual(existingMac))
.build());
+ transaction.add(op.comment("McastMacLocal: Updating " + localMcastMac.getMacEntryKey().getValue()));
}
}
}
/*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others. All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute 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.opendaylight.controller.md.sal.binding.api.DataObjectModification;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundConstants;
+import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
import org.opendaylight.ovsdb.schema.hardwarevtep.McastMacsRemote;
import com.google.common.base.Optional;
public class McastMacsRemoteRemoveCommand extends AbstractTransactCommand {
- private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
+ private static final Logger LOG = LoggerFactory.getLogger(McastMacsRemoteRemoveCommand.class);
public McastMacsRemoteRemoveCommand(HwvtepOperationalState state,
Collection<DataTreeModification<Node>> changes) {
getOperationalState().getRemoteMcastMacs(instanceIdentifier, mac.getKey());
McastMacsRemote mcastMacsRemote = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
McastMacsRemote.class, null);
- if (operationalMacOptional.isPresent()) {
+ if (operationalMacOptional.isPresent() && operationalMacOptional.get().getMacEntryUuid() != null) {
//when mac entry is deleted, its referenced locator set and locators are deleted automatically.
//TODO: locator in config DS is not deleted
- String macString = null;
- if (mac.getMacEntryKey().equals(HwvtepSouthboundConstants.UNKNOWN_DST_MAC)) {
- macString = HwvtepSouthboundConstants.UNKNOWN_DST_STRING;
- } else {
- macString = mac.getMacEntryKey().getValue();
- }
- transaction.add(op.delete(mcastMacsRemote.getSchema())
- .where(mcastMacsRemote.getMacColumn().getSchema().opEqual(macString)).build());
- transaction.add(op.comment("Remote McastMacRemote: Deleting " + mac.getMacEntryKey().getValue()));
+ UUID macEntryUUID = new UUID(operationalMacOptional.get().getMacEntryUuid().getValue());
+ transaction.add(op.delete(mcastMacsRemote.getSchema()).
+ where(mcastMacsRemote.getUuidColumn().getSchema().opEqual(macEntryUUID)).build());
+ transaction.add(op.comment("McastMacRemote: Deleting " + mac.getMacEntryKey().getValue()));
} else {
LOG.warn("Unable to delete remoteMcastMacs {} because it was not found in the operational store",
mac.getMacEntryKey().getValue());
/*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others. All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute 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 com.google.common.base.Optional;
public class McastMacsRemoteUpdateCommand extends AbstractTransactCommand {
- private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
+ private static final Logger LOG = LoggerFactory.getLogger(McastMacsRemoteUpdateCommand.class);
public McastMacsRemoteUpdateCommand(HwvtepOperationalState state,
Collection<DataTreeModification<Node>> changes) {
setLogicalSwitch(mcastMacsRemote, mac);
if (!operationalMacOptional.isPresent()) {
setMac(mcastMacsRemote, mac, operationalMacOptional);
+ LOG.trace("execute: create RemoteMcastMac entry: {}", mcastMacsRemote);
transaction.add(op.insert(mcastMacsRemote));
+ transaction.add(op.comment("McastMacRemote: Creating " + mac.getMacEntryKey().getValue()));
} else {
RemoteMcastMacs updatedMac = operationalMacOptional.get();
String existingMac = updatedMac.getMacEntryKey().getValue();
McastMacsRemote extraMac = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), McastMacsRemote.class);
- extraMac.setMac("");;
+ extraMac.setMac("");
+ LOG.trace("execute: update RemoteMcastMac entry: {}", mcastMacsRemote);
transaction.add(op.update(mcastMacsRemote)
.where(extraMac.getMacColumn().getSchema().opEqual(existingMac))
.build());
+ transaction.add(op.comment("McastMacRemote: Updating " + mac.getMacEntryKey().getValue()));
}
}
}
/*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others. All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute 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,
//create a physical port
setName(physicalPort, port, operationalPhysicalPortOptional);
String portUuid = "PhysicalPort_" + HwvtepSouthboundMapper.getRandomUUID();
+ LOG.trace("execute: creating physical port: {}", physicalPort);
transaction.add(op.insert(physicalPort).withId(portUuid));
+ transaction.add(op.comment("Physical Port: Creating " + port.getHwvtepNodeName().getValue()));
//update physical switch table
PhysicalSwitch physicalSwitch = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), PhysicalSwitch.class);
physicalSwitch.setName(physicalSwitchBelong.getHwvtepNodeName().getValue());
physicalSwitch.setPorts(Sets.newHashSet(new UUID(portUuid)));
- LOG.info("execute: physical switch: {}", physicalSwitch);
+ LOG.trace("execute: mutating physical switch: {}", physicalSwitch);
transaction.add(op.mutate(physicalSwitch)
.addMutation(physicalSwitch.getPortsColumn().getSchema(), Mutator.INSERT,
physicalSwitch.getPortsColumn().getData())
.where(physicalSwitch.getNameColumn().getSchema().opEqual(physicalSwitch.getNameColumn().getData()))
.build());
+ transaction.add(op.comment("Physical Switch: Mutating " +
+ port.getHwvtepNodeName().getValue() + " " + portUuid));
} else {
//updated physical port only
HwvtepPhysicalPortAugmentation updatedPhysicalPort = operationalPhysicalPortOptional.get();
PhysicalPort extraPhyscialPort =
TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), PhysicalPort.class);
extraPhyscialPort.setName("");
+ LOG.trace("execute: updating physical port: {}", physicalPort);
transaction.add(op.update(physicalPort)
.where(extraPhyscialPort.getNameColumn().getSchema().opEqual(existingPhysicalPortName))
.build());
+ transaction.add(op.comment("Physical Port: Updating " + existingPhysicalPortName));
}
}
}
/*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others. All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute 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,
setDescription(physicalSwitch, physicalSwitchAugmentation);
setManagementIps(physicalSwitch, physicalSwitchAugmentation);
setTunnuleIps(physicalSwitch, physicalSwitchAugmentation);
- setTunnels(transaction, iid, physicalSwitch, physicalSwitchAugmentation);
+ setTunnels(transaction, iid, physicalSwitch, physicalSwitchAugmentation,
+ operationalPhysicalSwitchOptional.isPresent());
if (!operationalPhysicalSwitchOptional.isPresent()) {
//create a physical switch
setName(physicalSwitch, physicalSwitchAugmentation, operationalPhysicalSwitchOptional);
String pswitchUuid = "PhysicalSwitch_" + HwvtepSouthboundMapper.getRandomUUID();
transaction.add(op.insert(physicalSwitch).withId(pswitchUuid));
+ transaction.add(op.comment("Physical Switch: Creating " +
+ physicalSwitchAugmentation.getHwvtepNodeName().getValue()));
//update global table
Global global = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Global.class);
global.setSwitches(Sets.newHashSet(new UUID(pswitchUuid)));
- LOG.debug("execute: physical switch: {}", physicalSwitch);
+ LOG.trace("execute: create physical switch: {}", physicalSwitch);
transaction.add(op.mutate(global)
.addMutation(global.getSwitchesColumn().getSchema(), Mutator.INSERT,
global.getSwitchesColumn().getData()));
+ transaction.add(op.comment("Global: Mutating " +
+ physicalSwitchAugmentation.getHwvtepNodeName().getValue() + " " + pswitchUuid));
} else {
PhysicalSwitchAugmentation updatedPhysicalSwitch = operationalPhysicalSwitchOptional.get();
String existingPhysicalSwitchName = updatedPhysicalSwitch.getHwvtepNodeName().getValue();
+ /* In case TOR devices don't allow creation of PhysicalSwitch name might be null
+ * as user is only adding configurable parameters to MDSAL like BFD params
+ *
+ * TODO Note: Consider handling tunnel udpate/remove in separate command
+ */
+ if(existingPhysicalSwitchName == null) {
+ existingPhysicalSwitchName = operationalPhysicalSwitchOptional.get().getHwvtepNodeName().getValue();
+ }
// Name is immutable, and so we *can't* update it. So we use extraPhysicalSwitch for the schema stuff
PhysicalSwitch extraPhysicalSwitch = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), PhysicalSwitch.class);
extraPhysicalSwitch.setName("");
+ LOG.trace("execute: updating physical switch: {}", physicalSwitch);
transaction.add(op.update(physicalSwitch)
.where(extraPhysicalSwitch.getNameColumn().getSchema().opEqual(existingPhysicalSwitchName))
.build());
+ transaction.add(op.comment("Physical Switch: Updating " + existingPhysicalSwitchName));
}
}
@SuppressWarnings("unchecked")
private void setTunnels(TransactionBuilder transaction, InstanceIdentifier<Node> iid,
- PhysicalSwitch physicalSwitch, PhysicalSwitchAugmentation physicalSwitchAugmentation) {
+ PhysicalSwitch physicalSwitch, PhysicalSwitchAugmentation physicalSwitchAugmentation,
+ boolean pSwitchExists) {
//TODO: revisit this code for optimizations
//TODO: needs more testing
if(physicalSwitchAugmentation.getTunnels() != null) {
- Set<UUID> tunnels = Sets.newHashSet();
for(Tunnels tunnel: physicalSwitchAugmentation.getTunnels()) {
Optional<Tunnels> opTunnelOpt = getOperationalState().getTunnels(iid, tunnel.getKey());
Tunnel newTunnel = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Tunnel.class);
- String tunnelUuid = null;
- if(!opTunnelOpt.isPresent()) {
- tunnelUuid = "Tunnel_" + HwvtepSouthboundMapper.getRandomUUID();
- } else {
- tunnelUuid = opTunnelOpt.get().getTunnelUuid().getValue();
- }
+
UUID localUUID = getLocatorUUID(transaction,
(InstanceIdentifier<TerminationPoint>) tunnel.getLocalLocatorRef().getValue());
UUID remoteUUID = getLocatorUUID(transaction,
(InstanceIdentifier<TerminationPoint>) tunnel.getRemoteLocatorRef().getValue());
if(localUUID != null && remoteUUID != null) {
+ UUID uuid;
// local and remote must exist
newTunnel.setLocal(localUUID);
newTunnel.setRemote(remoteUUID);
setBfdParams(newTunnel, tunnel);
setBfdLocalConfigs(newTunnel, tunnel);
setBfdRemoteConfigs(newTunnel, tunnel);
- transaction.add(op.insert(newTunnel).withId(tunnelUuid));
- tunnels.add(new UUID(tunnelUuid));
+ if(!opTunnelOpt.isPresent()) {
+ String tunnelUuid = "Tunnel_" + HwvtepSouthboundMapper.getRandomUUID();
+ transaction.add(op.insert(newTunnel).withId(tunnelUuid));
+ transaction.add(op.comment("Tunnel: Creating " + tunnelUuid));
+ if(!pSwitchExists) {
+ //TODO: Figure out a way to handle this
+ LOG.warn("Tunnel configuration requires pre-existing physicalSwitch");
+ } else {
+ // TODO: Can we reuse physicalSwitch instead?
+ PhysicalSwitch pSwitch =
+ TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
+ PhysicalSwitch.class);
+ pSwitch.setTunnels(Sets.newHashSet(new UUID(tunnelUuid)));
+ pSwitch.setName(physicalSwitchAugmentation.getHwvtepNodeName().getValue());
+ transaction.add(op.mutate(pSwitch)
+ .addMutation(pSwitch.getTunnels().getSchema(), Mutator.INSERT,
+ pSwitch.getTunnels().getData())
+ .where(pSwitch.getNameColumn().getSchema().
+ opEqual(pSwitch.getNameColumn().getData()))
+ .build());
+ transaction.add(op.comment("PhysicalSwitch: Mutating " + tunnelUuid));
+ }
+ uuid = new UUID(tunnelUuid);
+ } else {
+ uuid = new UUID (opTunnelOpt.get().getTunnelUuid().getValue());
+ Tunnel extraTunnel =
+ TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Tunnel.class, null);
+ extraTunnel.getUuidColumn().setData(uuid);
+ transaction.add(op.update(newTunnel)
+ .where(extraTunnel.getUuidColumn().getSchema().opEqual(uuid))
+ .build());
+ transaction.add(op.comment("Tunnel: Updating " + uuid));
+ }
}
}
- physicalSwitch.setTunnels(tunnels);
}
}
/*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others. All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute 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.opendaylight.controller.md.sal.binding.api.DataObjectModification;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
+import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
import org.opendaylight.ovsdb.schema.hardwarevtep.UcastMacsLocal;
import com.google.common.base.Optional;
public class UcastMacsLocalRemoveCommand extends AbstractTransactCommand {
- private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
+ private static final Logger LOG = LoggerFactory.getLogger(UcastMacsLocalRemoveCommand.class);
public UcastMacsLocalRemoveCommand(HwvtepOperationalState state,
Collection<DataTreeModification<Node>> changes) {
LOG.debug("Removing remoteUcastMacs, mac address: {}", mac.getMacEntryKey().getValue());
Optional<LocalUcastMacs> operationalMacOptional =
getOperationalState().getLocalUcastMacs(instanceIdentifier, mac.getKey());
- UcastMacsLocal mcastMacsLocal = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
+ UcastMacsLocal ucastMacsLocal = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
UcastMacsLocal.class, null);
- if (operationalMacOptional.isPresent()) {
+ if (operationalMacOptional.isPresent() && operationalMacOptional.get().getMacEntryUuid() != null) {
//when mac entry is deleted, its referenced locators are deleted automatically.
//locators in config DS is not deleted and user need to be removed explicitly by user.
- transaction.add(op.delete(mcastMacsLocal.getSchema())
- .where(mcastMacsLocal.getMacColumn().getSchema().opEqual(mac.getMacEntryKey().getValue())).build());
- transaction.add(op.comment("Local UcastMacLocal: Deleting " + mac.getMacEntryKey().getValue()));
+ UUID macEntryUUID = new UUID(operationalMacOptional.get().getMacEntryUuid().getValue());
+ transaction.add(op.delete(ucastMacsLocal.getSchema()).
+ where(ucastMacsLocal.getUuidColumn().getSchema().opEqual(macEntryUUID)).build());
+ transaction.add(op.comment("UcastMacLocal: Deleting " + mac.getMacEntryKey().getValue()));
} else {
LOG.warn("Unable to delete remoteUcastMacs {} because it was not found in the operational store",
mac.getMacEntryKey().getValue());
/*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others. All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute 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 com.google.common.base.Optional;
public class UcastMacsLocalUpdateCommand extends AbstractTransactCommand {
- private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
+ private static final Logger LOG = LoggerFactory.getLogger(UcastMacsLocalUpdateCommand.class);
public UcastMacsLocalUpdateCommand(HwvtepOperationalState state,
Collection<DataTreeModification<Node>> changes) {
setLogicalSwitch(ucastMacsLocal, localUcastMac);
if (!operationalMacOptional.isPresent()) {
setMac(ucastMacsLocal, localUcastMac, operationalMacOptional);
+ LOG.trace("execute: creating LocalUcastMac entry: {}", ucastMacsLocal);
transaction.add(op.insert(ucastMacsLocal));
+ transaction.add(op.comment("UcastMacLocal: Creating " + localUcastMac.getMacEntryKey().getValue()));
} else {
LocalUcastMacs updatedMac = operationalMacOptional.get();
String existingMac = updatedMac.getMacEntryKey().getValue();
UcastMacsLocal extraMac = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), UcastMacsLocal.class);
- extraMac.setMac("");;
+ extraMac.setMac("");
+ LOG.trace("execute: updating LocalUcastMac entry: {}", ucastMacsLocal);
transaction.add(op.update(ucastMacsLocal)
.where(extraMac.getMacColumn().getSchema().opEqual(existingMac))
.build());
+ transaction.add(op.comment("UcastMacLocal: Updating " + localUcastMac.getMacEntryKey().getValue()));
}
}
}
/*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others. All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute 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.opendaylight.controller.md.sal.binding.api.DataObjectModification;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
+import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
import org.opendaylight.ovsdb.schema.hardwarevtep.UcastMacsRemote;
import com.google.common.base.Optional;
public class UcastMacsRemoteRemoveCommand extends AbstractTransactCommand {
- private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
+ private static final Logger LOG = LoggerFactory.getLogger(UcastMacsRemoteRemoveCommand.class);
public UcastMacsRemoteRemoveCommand(HwvtepOperationalState state,
Collection<DataTreeModification<Node>> changes) {
LOG.debug("Removing remoteUcastMacs, mac address: {}", mac.getMacEntryKey().getValue());
Optional<RemoteUcastMacs> operationalMacOptional =
getOperationalState().getRemoteUcastMacs(instanceIdentifier, mac.getKey());
- UcastMacsRemote mcastMacsRemote = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
+ UcastMacsRemote ucastMacsRemote = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
UcastMacsRemote.class, null);
- if (operationalMacOptional.isPresent()) {
+ if (operationalMacOptional.isPresent() && operationalMacOptional.get().getMacEntryUuid() != null) {
//when mac entry is deleted, its referenced locators are deleted automatically.
//locators in config DS is not deleted and need to be removed explicitly by user.
- transaction.add(op.delete(mcastMacsRemote.getSchema())
- .where(mcastMacsRemote.getMacColumn().getSchema().opEqual(mac.getMacEntryKey().getValue())).build());
- transaction.add(op.comment("Remote UcastMacRemote: Deleting " + mac.getMacEntryKey().getValue()));
+ UUID macEntryUUID = new UUID(operationalMacOptional.get().getMacEntryUuid().getValue());
+ transaction.add(op.delete(ucastMacsRemote.getSchema()).
+ where(ucastMacsRemote.getUuidColumn().getSchema().opEqual(macEntryUUID)).build());
+ transaction.add(op.comment("UcastMacRemote: Deleting " + mac.getMacEntryKey().getValue()));
} else {
LOG.warn("Unable to delete remoteUcastMacs {} because it was not found in the operational store",
mac.getMacEntryKey().getValue());
/*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others. All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute 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.opendaylight.ovsdb.schema.hardwarevtep.UcastMacsRemote;
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.HwvtepGlobalAugmentation;
-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.HwvtepPhysicalLocatorAugmentation;
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.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.TerminationPoint;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import com.google.common.base.Optional;
public class UcastMacsRemoteUpdateCommand extends AbstractTransactCommand {
- private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
+ private static final Logger LOG = LoggerFactory.getLogger(UcastMacsRemoteUpdateCommand.class);
public UcastMacsRemoteUpdateCommand(HwvtepOperationalState state,
Collection<DataTreeModification<Node>> changes) {
setLogicalSwitch(ucastMacsRemote, remoteUcastMac);
if (!operationalMacOptional.isPresent()) {
setMac(ucastMacsRemote, remoteUcastMac, operationalMacOptional);
+ LOG.trace("execute: creating RemotUcastMac entry: {}", ucastMacsRemote);
transaction.add(op.insert(ucastMacsRemote));
+ transaction.add(op.comment("UcastMacRemote: Creating " + remoteUcastMac.getMacEntryKey().getValue()));
} else {
RemoteUcastMacs updatedMac = operationalMacOptional.get();
String existingMac = updatedMac.getMacEntryKey().getValue();
UcastMacsRemote extraMac = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), UcastMacsRemote.class);
- extraMac.setMac("");;
+ extraMac.setMac("");
+ LOG.trace("execute: updating RemotUcastMac entry: {}", ucastMacsRemote);
transaction.add(op.update(ucastMacsRemote)
.where(extraMac.getMacColumn().getSchema().opEqual(existingMac))
.build());
+ transaction.add(op.comment("UcastMacRemote: Updating " + remoteUcastMac.getMacEntryKey().getValue()));
}
}
}
/*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2015, 2016 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.opendaylight.ovsdb.schema.hardwarevtep.PhysicalLocatorSet;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
+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.HwvtepGlobalAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepLogicalSwitchRef;
} else {
mMacLocalBuilder.setMacEntryKey(new MacAddress(mMacLocal.getMac()));
}
+ mMacLocalBuilder.setMacEntryUuid(new Uuid(mMacLocal.getUuid().toString()));
setIpAddress(mMacLocalBuilder, mMacLocal);
setLocatorSet(mMacLocalBuilder, mMacLocal);
setLogicalSwitch(mMacLocalBuilder, mMacLocal);
/*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2015, 2016 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.opendaylight.ovsdb.schema.hardwarevtep.PhysicalLocatorSet;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
+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.HwvtepGlobalAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepLogicalSwitchRef;
} else {
mMacRemoteBuilder.setMacEntryKey(new MacAddress(mMacRemote.getMac()));
}
+ mMacRemoteBuilder.setMacEntryUuid(new Uuid(mMacRemote.getUuid().toString()));
setIpAddress(mMacRemoteBuilder, mMacRemote);
setLocatorSet(mMacRemoteBuilder, mMacRemote);
setLogicalSwitch(mMacRemoteBuilder, mMacRemote);
HwvtepSouthboundMapper.createInstanceIdentifier(node.getNodeId()), pLoc);
tBuilder.setLocalLocatorRef(new HwvtepPhysicalLocatorRef(tpPath));
}
-
+ tBuilder.setTunnelUuid(new Uuid(uuid.toString()));
setBfdLocalConfigs(tBuilder, tunnel);
setBfdRemoteConfigs(tBuilder, tunnel);
setBfdParams(tBuilder, tunnel);
/*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2015, 2016 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,
package org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md;
import com.google.common.base.Optional;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepConnectionInstance;
import org.opendaylight.ovsdb.schema.hardwarevtep.UcastMacsLocal;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
+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.HwvtepGlobalAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepLogicalSwitchRef;
ucmlBuilder.setIpaddr(new IpAddress(ucml.getIpAddr().toCharArray()));
}
ucmlBuilder.setMacEntryKey(new MacAddress(ucml.getMac()));
+ ucmlBuilder.setMacEntryUuid(new Uuid(ucml.getUuid().toString()));
if (ucml.getLocatorColumn() != null && ucml.getLocatorColumn().getData() != null) {
UUID plocUUID = ucml.getLocatorColumn().getData();
PhysicalLocator physicalLocator = updatedPLocRows.get(plocUUID);
/*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2015, 2016 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.opendaylight.ovsdb.schema.hardwarevtep.UcastMacsRemote;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
+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.HwvtepGlobalAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepLogicalSwitchRef;
List<RemoteUcastMacs> remoteUMacs = new ArrayList<>();
RemoteUcastMacsBuilder rumBuilder = new RemoteUcastMacsBuilder();
rumBuilder.setMacEntryKey(new MacAddress(uMacRemote.getMac()));
+ rumBuilder.setMacEntryUuid(new Uuid(uMacRemote.getUuid().toString()));
if (uMacRemote.getIpAddr() != null && !uMacRemote.getIpAddr().isEmpty()) {
rumBuilder.setIpaddr(new IpAddress(uMacRemote.getIpAddr().toCharArray()));
}