use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries in project netvirt by opendaylight.
the class NeutronvpnUtils method buildStaticMacEntry.
public static List<StaticMacEntries> buildStaticMacEntry(Port port) {
PhysAddress physAddress = new PhysAddress(port.getMacAddress().getValue());
List<FixedIps> fixedIps = port.getFixedIps();
IpAddress ipAddress = null;
if (isNotEmpty(fixedIps)) {
ipAddress = port.getFixedIps().get(0).getIpAddress();
}
StaticMacEntriesBuilder staticMacEntriesBuilder = new StaticMacEntriesBuilder();
List<StaticMacEntries> staticMacEntries = new ArrayList<>();
if (ipAddress != null) {
staticMacEntries.add(staticMacEntriesBuilder.setMacAddress(physAddress).setIpPrefix(ipAddress).build());
} else {
staticMacEntries.add(staticMacEntriesBuilder.setMacAddress(physAddress).build());
}
return staticMacEntries;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries 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