public ChannelBuilder setChannelAlarms(final java.lang.Long value) { if (value != null) { checkChannelAlarmsRange(value); } this._channelAlarms = value; return this; }
public ChannelBuilder setBytesIn(final java.lang.Long value) { if (value != null) { checkBytesInRange(value); } this._bytesIn = value; return this; }
public ChannelBuilder setBytesOut(final java.lang.Long value) { if (value != null) { checkBytesOutRange(value); } this._bytesOut = value; return this; }
public ChannelBuilder(Channel base) { if (base.getKey() == null) { this._key = new ChannelKey( base.getChannelId() ); this._channelId = base.getChannelId(); } else { this._key = base.getKey(); this._channelId = _key.getChannelId(); this._bytesIn = base.getBytesIn(); this._bytesOut = base.getBytesOut(); this._callHome = base.getCallHome(); this._channelAlarm = base.getChannelAlarm(); this._channelAlarms = base.getChannelAlarms(); this._channelType = base.getChannelType(); this._destination = base.getDestination(); this._session = base.getSession(); this._sessions = base.getSessions(); this._source = base.getSource(); if (base instanceof ChannelImpl) { ChannelImpl impl = (ChannelImpl) base;
public synchronized void updateChannel(Channel channel, Session session, boolean removeFlag) { Session oldSession = getSession(channel, session.getSessionId().getValue()); if (oldSession != null) { channel.getSession().remove(oldSession); } if (!removeFlag) { channel.getSession().add(session); } String destinationId = channel.getDestination().getDestNode().getValue(); Node deviceNode = UscTopologyFactory.createNode(destinationId, UscTopologyService.NODE_TYPE_NETWORK_DEVICE); channel = UscTopologyFactory.createChannel(getLocalController(), deviceNode, channel.getKey().getChannelId() .getValue(), channel.getChannelType(), UscTopologyFactory.isCallHome(channel.getCallHome()), channel.getBytesIn(), channel.getBytesOut(), channel.getChannelAlarm(), channel.getSession()); updateChannel(channel); }
public NodeBuilder(Node base) { if (base.getKey() == null) { this._key = new NodeKey( base.getNodeId() ); this._nodeId = base.getNodeId(); } else { this._key = base.getKey(); this._nodeId = _key.getNodeId(); } this._nodeType = base.getNodeType(); if (base instanceof NodeImpl) { NodeImpl impl = (NodeImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.usc.channel.rev150101.topology.attributes.Node> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.usc.channel.rev150101.topology.attributes.Node>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
private void initLocalController() { NodeBuilder nodeBuilder = new NodeBuilder(); NodeId nodeId = new NodeId(localHostName); localController = nodeBuilder.setNodeType(NODE_TYPE_CONTROLLER).setNodeId(nodeId).setKey(new NodeKey(nodeId)) .build(); }
/** * add a node to local topology, when the node exists in node list of * topology, then only update the refer number of the node * * @param node * the adding node */ public synchronized void addNode(Node node) { if (node != null) { String nodeId = node.getKey().getNodeId().getValue(); Integer num = nodeReferList.get(nodeId); // filter same node using nodeId // Note: here only has the nodes related with current controller, // but all of nodes including nodes related with other controllers // should have unique nodeId if (num == null) { // not exsits, add node and one refer number localNodeList.add(node); nodeReferList.put(nodeId, 1); } else { // exsits,only add refer number nodeReferList.put(nodeId, num + 1); } } }
/** * update channel information, and update the shard data of local topology * * @param channel * the new channel * @return old channel */ public synchronized Channel updateChannel(Channel channel) { if (channel != null) { Channel oldChannel = removeChannelWithoutUpdateShard(channel.getDestination().getDestNode().getValue(), channel.getChannelType()); addChannelWithoutUpdateShard(channel); updateShard(); return oldChannel; } return null; }
/** * check the node has same id with the specified id * * @param id * a node id * @param node * a node * @return if the node has same id with the specified id then return * true,other wise return false */ public synchronized boolean sameNodeId(String id, Node node) { return id.equals(node.getNodeId().getValue()); }
/** * get session from the channel with specified session id * * @param channel * the target channel for getting * @param sessionId * specified session id * @return if find the session which has the session id, return the session * other wise return null */ public synchronized Session getSession(Channel channel, String sessionId) { for (Session session : channel.getSession()) { if (session.getSessionId().getValue().equals(sessionId)) { return session; } } return null; }
/** * get the Channel identifier belongs to a particular topology * * @param topologyId * topology id * @param ChannelId * Channel id * @return Channel identifier */ public static InstanceIdentifier<Channel> getChannelIdentifier(String topologyId, String ChannelId) { return InstanceIdentifier.builder(UscTopology.class) .child(Topology.class, new TopologyKey(new TopologyId(topologyId))) .child(Channel.class, new ChannelKey(new ChannelId(ChannelId))).build(); }
/** * get the node identifier belongs to a particular topology * * @param topologyId * topology id * @param nodeId * node id * @return node identifier */ public static InstanceIdentifier<Node> getNodeIdentifier(String topologyId, String nodeId) { return InstanceIdentifier.builder(UscTopology.class) .child(Topology.class, new TopologyKey(new TopologyId(topologyId))) .child(Node.class, new NodeKey(new NodeId(nodeId))).build(); }
public ChannelBuilder setSessions(final java.lang.Long value) { if (value != null) { checkSessionsRange(value); } this._sessions = value; return this; }
public Node build() { return new NodeImpl(this); }
public Channel build() { return new ChannelImpl(this); }
public ChannelBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.usc.channel.rev150101.topology.attributes.Channel>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.usc.channel.rev150101.topology.attributes.Channel> augmentation) { if (augmentation == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentation); return this; }
public NodeBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.usc.channel.rev150101.topology.attributes.Node>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.usc.channel.rev150101.topology.attributes.Node> augmentation) { if (augmentation == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentation); return this; }
public synchronized void updateTransaction(Channel channel, Session session, long bytesIn, long bytesOut) { Session oldSession = getSession(channel, session.getSessionId().getValue()); if (oldSession != null) { channel.getSession().remove(oldSession); } channel.getSession().add(session); String destinationId = channel.getDestination().getDestNode().getValue(); Node deviceNode = UscTopologyFactory.createNode(destinationId, UscTopologyService.NODE_TYPE_NETWORK_DEVICE); channel = UscTopologyFactory.createChannel(getLocalController(), deviceNode, channel.getKey().getChannelId() .getValue(), channel.getChannelType(), UscTopologyFactory.isCallHome(channel.getCallHome()), channel.getBytesIn() + bytesIn, channel.getBytesOut() + bytesOut, channel.getChannelAlarm(), channel.getSession()); updateChannel(channel); }
/** * Builds a node for the provided id. Passes node attributes to NodeBuilder * to build a node. * * @param id * node id * @param type * node type * @return new node */ public static Node createNode(String id, String type) { NodeId nodeId = new NodeId(id); NodeKey nodeKey = new NodeKey(nodeId); NodeBuilder nodeBuilder = new NodeBuilder(); nodeBuilder.setNodeId(nodeId); nodeBuilder.setKey(nodeKey); nodeBuilder.setNodeType(type); return nodeBuilder.build(); }