use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.PortKey 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.neutron.ports.rev150712.ports.attributes.ports.PortKey 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.neutron.ports.rev150712.ports.attributes.ports.PortKey in project netvirt by opendaylight.
the class NeutronvpnUtils method getNeutronPort.
protected Port getNeutronPort(Uuid portId) {
Port prt = portMap.get(portId);
if (prt != null) {
return prt;
}
LOG.debug("getNeutronPort for {}", portId.getValue());
InstanceIdentifier<Port> inst = InstanceIdentifier.create(Neutron.class).child(Ports.class).child(Port.class, new PortKey(portId));
Optional<Port> port = read(LogicalDatastoreType.CONFIGURATION, inst);
if (port.isPresent()) {
prt = port.get();
}
return prt;
}
Aggregations