@Test public void testCreatePeerSequence() throws Exception { List<NodeId> nodeIdList = new ArrayList<>(); nodeIdList.add(NodeIdConv.createNodeId("192.168.0.1")); nodeIdList.add(NodeIdConv.createNodeId("192.168.5.1")); Attribute attribute = AttributeFactory.createPeerSequence(nodeIdList); assertEquals(AttributeType.PeerSequence, attribute.getType()); assertEquals(AttributeVariant.Compact, attribute.getAttributeVariant()); PeerSequenceAttribute peerSequenceAttribute = (PeerSequenceAttribute) attribute.getAttributeOptionalFields(); assertNotNull(peerSequenceAttribute); assertEquals(nodeIdList, peerSequenceAttribute.getPeerSequenceAttributes().getNodeId()); }
public static Attribute createPeerSequence(List<NodeId> nodesIds) { AttributeBuilder attributeBuilder = new AttributeBuilder(); attributeBuilder.setFlags(getFlags(COMPACT)); attributeBuilder.setAttributeVariant(AttributeVariant.Compact); attributeBuilder.setType(AttributeType.PeerSequence); byte[] value = NodeIdConv.toBytes(nodesIds); attributeBuilder.setLength(value.length); attributeBuilder.setValue(value); PeerSequenceAttributeBuilder _attributeBuilder = new PeerSequenceAttributeBuilder(); PeerSequenceAttributesBuilder _attributesBuilder = new PeerSequenceAttributesBuilder(); _attributesBuilder.setNodeId(nodesIds); _attributeBuilder.setPeerSequenceAttributes(_attributesBuilder.build()); attributeBuilder.setAttributeOptionalFields(_attributeBuilder.build()); return attributeBuilder.build(); }
AttributeFactory { public static Attribute createPeerSequence(List<NodeId> nodesIds) { AttributeBuilder attributeBuilder = new AttributeBuilder(); attributeBuilder.setFlags(getFlags(COMPACT)); attributeBuilder.setAttributeVariant(AttributeVariant.Compact); attributeBuilder.setType(AttributeType.PeerSequence); byte[] value = NodeIdConv.toBytes(nodesIds); attributeBuilder.setLength(value.length); attributeBuilder.setValue(value); PeerSequenceAttributeBuilder _attributeBuilder = new PeerSequenceAttributeBuilder(); PeerSequenceAttributesBuilder _attributesBuilder = new PeerSequenceAttributesBuilder(); _attributesBuilder.setNodeId(nodesIds); _attributeBuilder.setPeerSequenceAttributes(_attributesBuilder.build()); attributeBuilder.setAttributeOptionalFields(_attributeBuilder.build()); return attributeBuilder.build(); } }
AttributeFactory { public static Attribute createPeerSequence(List<NodeId> nodesIds) { AttributeBuilder attributeBuilder = new AttributeBuilder(); attributeBuilder.setFlags(getFlags(COMPACT)); attributeBuilder.setAttributeVariant(AttributeVariant.Compact); attributeBuilder.setType(AttributeType.PeerSequence); byte[] value = NodeIdConv.toBytes(nodesIds); attributeBuilder.setLength(value.length); attributeBuilder.setValue(value); PeerSequenceAttributeBuilder _attributeBuilder = new PeerSequenceAttributeBuilder(); PeerSequenceAttributesBuilder _attributesBuilder = new PeerSequenceAttributesBuilder(); _attributesBuilder.setNodeId(nodesIds); _attributeBuilder.setPeerSequenceAttributes(_attributesBuilder.build()); attributeBuilder.setAttributeOptionalFields(_attributeBuilder.build()); return attributeBuilder.build(); }  }
AttributeFactory { public static Attribute createPeerSequence(List<NodeId> nodesIds) { AttributeBuilder attributeBuilder = new AttributeBuilder(); attributeBuilder.setFlags(getFlags(COMPACT)); attributeBuilder.setAttributeVariant(AttributeVariant.Compact); attributeBuilder.setType(AttributeType.PeerSequence); byte[] value = NodeIdConv.toBytes(nodesIds); attributeBuilder.setLength(value.length); attributeBuilder.setValue(value); PeerSequenceAttributeBuilder _attributeBuilder = new PeerSequenceAttributeBuilder(); PeerSequenceAttributesBuilder _attributesBuilder = new PeerSequenceAttributesBuilder(); _attributesBuilder.setNodeId(nodesIds); _attributeBuilder.setPeerSequenceAttributes(_attributesBuilder.build()); attributeBuilder.setAttributeOptionalFields(_attributeBuilder.build()); return attributeBuilder.build(); }  static Attribute createCapabilities(Version version); static Attribute createHoldTime(int holdTimeMin); static Attribute createHoldTime(int holdTimeMin, int holdTimeMax); static Attribute createIpv4AddPrefix(List<IpPrefix> prefixes, byte flags); static Attribute createIpv4DeletePrefix(List<IpPrefix> prefixes, byte flags); static Attribute createIpv6AddPrefix(List<IpPrefix> prefixes, byte flags); static Attribute createIpv6DeletePrefix(List<IpPrefix> prefixes, byte flags); static Attribute createPeerSequence(List<NodeId> nodesIds); static Attribute createSourceGroupTag(int sgt); static Attribute createSxpNodeId(NodeId nodeId); static byte[] encodeCapability(Capabilities capability); }
AttributeFactory { public static Attribute createPeerSequence(List<NodeId> nodesIds) { AttributeBuilder attributeBuilder = new AttributeBuilder(); attributeBuilder.setFlags(getFlags(COMPACT)); attributeBuilder.setAttributeVariant(AttributeVariant.Compact); attributeBuilder.setType(AttributeType.PeerSequence); byte[] value = NodeIdConv.toBytes(nodesIds); attributeBuilder.setLength(value.length); attributeBuilder.setValue(value); PeerSequenceAttributeBuilder _attributeBuilder = new PeerSequenceAttributeBuilder(); PeerSequenceAttributesBuilder _attributesBuilder = new PeerSequenceAttributesBuilder(); _attributesBuilder.setNodeId(nodesIds); _attributeBuilder.setPeerSequenceAttributes(_attributesBuilder.build()); attributeBuilder.setAttributeOptionalFields(_attributeBuilder.build()); return attributeBuilder.build(); }  static Attribute createCapabilities(Version version); static Attribute createHoldTime(int holdTimeMin); static Attribute createHoldTime(int holdTimeMin, int holdTimeMax); static Attribute createIpv4AddPrefix(List<IpPrefix> prefixes, byte flags); static Attribute createIpv4DeletePrefix(List<IpPrefix> prefixes, byte flags); static Attribute createIpv6AddPrefix(List<IpPrefix> prefixes, byte flags); static Attribute createIpv6DeletePrefix(List<IpPrefix> prefixes, byte flags); static Attribute createPeerSequence(List<NodeId> nodesIds); static Attribute createSourceGroupTag(int sgt); static Attribute createSxpNodeId(NodeId nodeId); static byte[] encodeCapability(Capabilities capability); static final byte COMPACT; static final byte OPTIONAL_COMPACT; static final byte NONTRANSITIVE_COMPACT; }