use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder in project netvirt by opendaylight.
the class CoeUtils method updateElanInterfaceWithStaticMac.
public static void updateElanInterfaceWithStaticMac(String macAddress, IpAddress ipAddress, String elanInterfaceName, WriteTransaction wrtConfigTxn) {
InstanceIdentifier<ElanInterface> id = InstanceIdentifier.builder(ElanInterfaces.class).child(ElanInterface.class, new ElanInterfaceKey(elanInterfaceName)).build();
PhysAddress physAddress = PhysAddress.getDefaultInstance(macAddress);
List<StaticMacEntries> staticMacEntriesList = new ArrayList<>();
StaticMacEntries staticMacEntries = new StaticMacEntriesBuilder().setKey(new StaticMacEntriesKey(physAddress)).setMacAddress(physAddress).setIpPrefix(ipAddress).build();
staticMacEntriesList.add(staticMacEntries);
ElanInterface elanInterface = new ElanInterfaceBuilder().setName(elanInterfaceName).setKey(new ElanInterfaceKey(elanInterfaceName)).setStaticMacEntries(staticMacEntriesList).build();
wrtConfigTxn.merge(LogicalDatastoreType.CONFIGURATION, id, elanInterface);
LOG.debug("Updating ELAN Interface with static mac {}", elanInterface);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder in project netvirt by opendaylight.
the class ElanServiceTestBase method addElanInterface.
public void addElanInterface(String elanInstanceName, InterfaceInfo interfaceInfo, String prefix) {
ElanInstance existingElanInstance = elanInstanceCache.get(elanInstanceName).orNull();
String interfaceName = interfaceInfo.getInterfaceName();
if (existingElanInstance != null) {
ElanInterfaceBuilder elanInterfaceBuilder = new ElanInterfaceBuilder().setElanInstanceName(elanInstanceName).setName(interfaceName).setKey(new ElanInterfaceKey(interfaceName));
StaticMacEntriesBuilder staticMacEntriesBuilder = new StaticMacEntriesBuilder();
List<StaticMacEntries> staticMacEntries = new ArrayList<>();
List<PhysAddress> physAddressList = Collections.singletonList(new PhysAddress(interfaceInfo.getMacAddress()));
for (PhysAddress physAddress : physAddressList) {
staticMacEntries.add(staticMacEntriesBuilder.setMacAddress(physAddress).setIpPrefix(new IpAddress(new Ipv4Address(prefix))).build());
}
elanInterfaceBuilder.setStaticMacEntries(staticMacEntries);
ElanInterface elanInterface = elanInterfaceBuilder.build();
MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, ElanUtils.getElanInterfaceConfigurationDataPathId(interfaceName), elanInterface);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder in project netvirt by opendaylight.
the class AclLiveStatisticsRpcServiceTest method newElanInterface.
protected void newElanInterface(String elanName, String portName, boolean isWrite) throws TransactionCommitFailedException {
ElanInterface elanInterface = new ElanInterfaceBuilder().setName(portName).setElanInstanceName(elanName).build();
InstanceIdentifier<ElanInterface> id = AclServiceUtils.getElanInterfaceConfigurationDataPathId(portName);
if (isWrite) {
singleTransactionDataBroker.syncWrite(CONFIGURATION, id, elanInterface);
} else {
singleTransactionDataBroker.syncDelete(CONFIGURATION, id);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder in project netvirt by opendaylight.
the class NeutronPortChangeListener method createElanInterface.
private void createElanInterface(Port port, String name, WriteTransaction wrtConfigTxn) {
String elanInstanceName = port.getNetworkId().getValue();
List<StaticMacEntries> staticMacEntries = NeutronvpnUtils.buildStaticMacEntry(port);
InstanceIdentifier<ElanInterface> id = InstanceIdentifier.builder(ElanInterfaces.class).child(ElanInterface.class, new ElanInterfaceKey(name)).build();
ElanInterface elanInterface = new ElanInterfaceBuilder().setElanInstanceName(elanInstanceName).setName(name).setStaticMacEntries(staticMacEntries).setKey(new ElanInterfaceKey(name)).build();
wrtConfigTxn.put(LogicalDatastoreType.CONFIGURATION, id, elanInterface);
LOG.debug("Creating new ELan Interface {}", elanInterface);
}
Aggregations