use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port in project netvirt by opendaylight.
the class WeightedCentralizedSwitchScheduler method deleteFromDpnMaps.
private void deleteFromDpnMaps(String routerName, List<Uuid> deletedSubnetIds, BigInteger primarySwitchId) {
if (deletedSubnetIds == null || deletedSubnetIds.isEmpty()) {
LOG.debug("deleteFromDpnMaps no subnets associated with {}", routerName);
return;
}
WriteTransaction writeOperTxn = dataBroker.newWriteOnlyTransaction();
String primaryRd = NatUtil.getPrimaryRd(dataBroker, routerName);
for (Uuid subnetUuid : deletedSubnetIds) {
String routerPort = subnetIdToRouterPortMap.remove(subnetUuid.getValue());
if (routerPort == null) {
LOG.error("The router port was not found for {}", subnetUuid.getValue());
continue;
}
vpnFootprintService.updateVpnToDpnMapping(primarySwitchId, routerName, primaryRd, routerPort, null, false);
NatUtil.removeFromNeutronRouterDpnsMap(dataBroker, routerName, primarySwitchId, writeOperTxn);
NatUtil.removeFromDpnRoutersMap(dataBroker, routerName, routerName, interfaceManager, writeOperTxn);
}
writeOperTxn.submit();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port in project netvirt by opendaylight.
the class NeutronUtils method writePortStatus.
private static boolean writePortStatus(String uuid, String portStatus, DataBroker dataBroker, boolean create) {
Uuid uuidObj = new Uuid(uuid);
PortBuilder portBuilder = new PortBuilder();
portBuilder.setUuid(uuidObj);
portBuilder.setStatus(portStatus);
InstanceIdentifier iid = InstanceIdentifier.create(Neutron.class).child(Ports.class).child(Port.class, new PortKey(uuidObj));
SingleTransactionDataBroker tx = new SingleTransactionDataBroker(dataBroker);
try {
if (create) {
tx.syncWrite(LogicalDatastoreType.OPERATIONAL, iid, portBuilder.build());
} else {
tx.syncUpdate(LogicalDatastoreType.OPERATIONAL, iid, portBuilder.build());
}
} catch (TransactionCommitFailedException e) {
LOG.error("writePortStatus: failed neutron port status write. isCreate: {}", create, e);
return false;
}
return true;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port in project netvirt by opendaylight.
the class NeutronUtils method deletePortStatus.
/**
* Delete a Neutron Port status entry from the operational data store.
* @param uuid The uuid of the Neutron port
* @param dataBroker DataBroker instance
* @return true if transaction submitted successfully
*/
public static boolean deletePortStatus(String uuid, DataBroker dataBroker) {
Uuid uuidObj = new Uuid(uuid);
InstanceIdentifier iid = InstanceIdentifier.create(Neutron.class).child(Ports.class).child(Port.class, new PortKey(uuidObj));
SingleTransactionDataBroker tx = new SingleTransactionDataBroker(dataBroker);
try {
tx.syncDelete(LogicalDatastoreType.OPERATIONAL, iid);
} catch (TransactionCommitFailedException e) {
LOG.error("deletePortStatus: failed neutron port status delete", e);
return false;
}
return true;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port in project netvirt by opendaylight.
the class NeutronUtils method isPortVnicTypeNormal.
public static boolean isPortVnicTypeNormal(Port port) {
PortBindingExtension portBinding = port.getAugmentation(PortBindingExtension.class);
if (portBinding == null || portBinding.getVnicType() == null) {
// By default, VNIC_TYPE is NORMAL
return true;
}
String vnicType = portBinding.getVnicType().trim().toLowerCase(Locale.getDefault());
return vnicType.equals(VNIC_TYPE_NORMAL);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port in project netvirt by opendaylight.
the class Ipv6PktHandlerTest method testonPacketReceivedRouterSolicitationWithInvalidPayload.
@Test
public void testonPacketReceivedRouterSolicitationWithInvalidPayload() throws Exception {
// incorrect checksum in Router Solicitation
pktHandler.onPacketReceived(new PacketReceivedBuilder().setPayload(ipv6TestUtils.buildPacket(// Destination MAC
"33 33 FF F5 00 00", // Source MAC
"00 01 02 03 04 05", // IPv6
"86 DD", // Version 6, traffic class E0, no flowlabel
"6E 00 00 00", // Payload length
"00 18", // Next header is ICMPv6
"3A", // Hop limit
"FF", // Source IP
"00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // Destination IP
"FF 02 00 00 00 00 00 00 00 00 00 01 FF F5 00 00", // ICMPv6 router solicitation
"85", // Code
"00", // Checksum (invalid, should be 67 3C)
"69 3E", // ICMPv6 message body
"00 00 00 00", // Target
"FE 80 00 00 00 00 00 00 C0 00 54 FF FE F5 00 00")).build());
// wait on this thread until the async job is completed in the packet handler.
waitForPacketProcessing();
verify(pktProcessService, times(0)).transmitPacket(any(TransmitPacketInput.class));
// Request from an unknown port (i.e., unknown MAC Address)
when(ifMgrInstance.obtainV6Interface(any())).thenReturn(null);
counter = pktHandler.getPacketProcessedCounter();
pktHandler.onPacketReceived(new PacketReceivedBuilder().setPayload(ipv6TestUtils.buildPacket(// Destination MAC
"33 33 FF F5 00 00", // Source MAC
"00 01 02 03 04 05", // IPv6
"86 DD", // Version 6, traffic class E0, no flowlabel
"6E 00 00 00", // Payload length
"00 18", // Next header is ICMPv6
"3A", // Hop limit
"FF", // Source IP
"00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // Destination IP
"FF 02 00 00 00 00 00 00 00 00 00 01 FF F5 00 00", // ICMPv6 router solicitation
"85", // Code
"00", // Checksum (valid)
"69 3C", // ICMPv6 message body
"00 00 00 00", // Target
"FE 80 00 00 00 00 00 00 C0 00 54 FF FE F5 00 00")).build());
// wait on this thread until the async job is completed in the packet handler.
waitForPacketProcessing();
verify(pktProcessService, times(0)).transmitPacket(any(TransmitPacketInput.class));
}
Aggregations