blob: b31545f6b01ff65d812af13f19378351c068aa69 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
package io.fd.honeycomb.v3po.translate.v3po.initializers;
import com.google.common.collect.Lists;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.SubInterfaceStatus;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.SubinterfaceAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.SubinterfaceAugmentationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.SubinterfaceStateAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces._interface.sub.interfaces.SubInterfaceKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces.state._interface.SubInterfaces;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces.state._interface.sub.interfaces.SubInterface;
/**
* Utility class for sub interface initialization
*/
final class SubInterfaceInitializationUtils {
private SubInterfaceInitializationUtils() {
throw new UnsupportedOperationException("Utility class cannot be instantiated");
}
static void initializeSubinterfaceStateAugmentation(
final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface input,
final InterfaceBuilder builder) {
final SubinterfaceStateAugmentation subIfcAugmentation =
input.getAugmentation(SubinterfaceStateAugmentation.class);
if (subIfcAugmentation != null) {
final SubinterfaceAugmentationBuilder augmentBuilder = new SubinterfaceAugmentationBuilder();
final SubInterfaces subInterfaces = subIfcAugmentation.getSubInterfaces();
if (subInterfaces != null) {
setSubInterfaces(augmentBuilder, subInterfaces);
}
builder.addAugmentation(SubinterfaceAugmentation.class, augmentBuilder.build());
}
}
private static void setSubInterfaces(final SubinterfaceAugmentationBuilder augmentBuilder,
final SubInterfaces operationalData) {
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces._interface.SubInterfacesBuilder
subInterfacesCfgBuilder =
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces._interface.SubInterfacesBuilder();
subInterfacesCfgBuilder.setSubInterface(Lists.transform(operationalData.getSubInterface(),
SubInterfaceInitializationUtils::convertSubInterface));
augmentBuilder.setSubInterfaces(subInterfacesCfgBuilder.build());
}
private static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces._interface.sub.interfaces.SubInterface convertSubInterface(
final SubInterface operationalData) {
org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces._interface.sub.interfaces.SubInterfaceBuilder subInterfaceCfgBuilder =
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces._interface.sub.interfaces.SubInterfaceBuilder();
subInterfaceCfgBuilder.setEnabled(SubInterfaceStatus.Up.equals(operationalData.getAdminStatus()));
subInterfaceCfgBuilder.setIdentifier(operationalData.getIdentifier());
subInterfaceCfgBuilder.setKey(new SubInterfaceKey(operationalData.getIdentifier()));
subInterfaceCfgBuilder.setL2(operationalData.getL2());
subInterfaceCfgBuilder.setMatch(operationalData.getMatch());
subInterfaceCfgBuilder.setTags(operationalData.getTags());
subInterfaceCfgBuilder.setVlanType(operationalData.getVlanType());
return subInterfaceCfgBuilder.build();
}
}
|