use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.neutron.vpn.port.id.subport.data.PortIdToSubport in project netvirt by opendaylight.
the class NeutronPortChangeListener method createInterface.
private Interface createInterface(Port port) {
String interfaceName = port.getUuid().getValue();
IfL2vlan.L2vlanMode l2VlanMode = IfL2vlan.L2vlanMode.Trunk;
InterfaceBuilder interfaceBuilder = new InterfaceBuilder();
IfL2vlanBuilder ifL2vlanBuilder = new IfL2vlanBuilder();
Network network = neutronvpnUtils.getNeutronNetwork(port.getNetworkId());
Boolean isVlanTransparent = network.isVlanTransparent();
if (isVlanTransparent != null && isVlanTransparent) {
l2VlanMode = IfL2vlan.L2vlanMode.Transparent;
} else {
PortIdToSubport portIdToSubport = neutronvpnUtils.getPortIdToSubport(port.getUuid());
if (portIdToSubport != null) {
l2VlanMode = IfL2vlan.L2vlanMode.TrunkMember;
ifL2vlanBuilder.setVlanId(new VlanId(portIdToSubport.getVlanId().intValue()));
String parentRefName = portIdToSubport.getTrunkPortId().getValue();
ParentRefsBuilder parentRefsBuilder = new ParentRefsBuilder().setParentInterface(parentRefName);
interfaceBuilder.addAugmentation(parentRefsBuilder.build());
SplitHorizon splitHorizon = new SplitHorizonBuilder().setOverrideSplitHorizonProtection(true).build();
interfaceBuilder.addAugmentation(splitHorizon);
}
}
ifL2vlanBuilder.setL2vlanMode(l2VlanMode);
interfaceBuilder.setEnabled(true).setName(interfaceName).setType(L2vlan.class).addAugmentation(ifL2vlanBuilder.build());
if (NeutronvpnUtils.getPortSecurityEnabled(port)) {
InterfaceAclBuilder interfaceAclBuilder = new InterfaceAclBuilder();
interfaceAclBuilder.setPortSecurityEnabled(true);
neutronvpnUtils.populateInterfaceAclBuilder(interfaceAclBuilder, port);
interfaceBuilder.addAugmentation(interfaceAclBuilder.build());
} else if (neutronvpnConfig.isLimitBumtrafficToDhcpserver() && NeutronvpnUtils.isDhcpServerPort(port)) {
interfaceBuilder.addAugmentation(neutronvpnUtils.getDhcpInterfaceAcl(port));
}
return interfaceBuilder.build();
}
Aggregations