use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.DomainName in project bgpcep by opendaylight.
the class LinkstateTopologyBuilder method createNode.
private void createNode(final WriteTransaction trans, final UriBuilder base, final LinkstateRoute value, final NodeCase nodeCase, final Attributes attributes) {
final NodeAttributes na;
// defensive lookup
final Attributes1 attr = attributes.getAugmentation(Attributes1.class);
if (attr != null) {
final LinkStateAttribute attrType = attr.getLinkStateAttribute();
if (attrType != null) {
na = ((NodeAttributesCase) attrType).getNodeAttributes();
} else {
LOG.debug("Missing attribute type in node {} route {}, skipping it", nodeCase, value);
na = null;
}
} else {
LOG.debug("Missing attributes in node {} route {}, skipping it", nodeCase, value);
na = null;
}
final IgpNodeAttributesBuilder inab = new IgpNodeAttributesBuilder();
final List<IpAddress> ids = new ArrayList<>();
if (na != null) {
if (na.getIpv4RouterId() != null) {
ids.add(new IpAddress(na.getIpv4RouterId()));
}
if (na.getIpv6RouterId() != null) {
ids.add(new IpAddress(na.getIpv6RouterId()));
}
if (na.getDynamicHostname() != null) {
inab.setName(new DomainName(na.getDynamicHostname()));
}
}
if (!ids.isEmpty()) {
inab.setRouterId(ids);
}
ProtocolUtil.augmentProtocolId(value, inab, na, nodeCase.getNodeDescriptors());
final NodeId nid = buildNodeId(base, nodeCase.getNodeDescriptors());
final NodeHolder nh = getNode(nid);
/*
* Eventhough the the holder creates a dummy structure, we need to duplicate it here,
* as that is the API requirement. The reason for it is the possible presence of supporting
* node -- something which the holder does not track.
*/
final NodeBuilder nb = new NodeBuilder();
nb.setNodeId(nid);
nb.setKey(new NodeKey(nb.getNodeId()));
nh.advertized(nb, inab);
putNode(trans, nh);
}
Aggregations