blob: e2dc7fd2c44cb81698e6e011d22bd3c4f065f910 [file] [log] [blame]
Simon Huntc13082f2016-08-03 21:20:23 -07001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.ui.model.topo;
18
Simon Huntc13082f2016-08-03 21:20:23 -070019/**
20 * Designates a link between a device and a host; that is, an edge link.
21 */
22public class UiEdgeLink extends UiLink {
23
Simon Huntb7fd0802016-10-27 12:21:40 -070024 private final String hostId;
25 private final String edgeDevice;
26 private final String edgePort;
Simon Huntc13082f2016-08-03 21:20:23 -070027
28 /**
29 * Creates a UI link.
30 *
31 * @param topology parent topology
32 * @param id canonicalized link identifier
33 */
34 public UiEdgeLink(UiTopology topology, UiLinkId id) {
35 super(topology, id);
Simon Huntb7fd0802016-10-27 12:21:40 -070036 hostId = id.idA();
37 edgeDevice = id.elementB().toString();
38 edgePort = id.portB().toString();
Simon Huntc13082f2016-08-03 21:20:23 -070039 }
40
41 @Override
42 public String endPointA() {
Simon Huntb7fd0802016-10-27 12:21:40 -070043 return hostId;
Simon Huntc13082f2016-08-03 21:20:23 -070044 }
45
46 @Override
47 public String endPointB() {
Simon Huntb7fd0802016-10-27 12:21:40 -070048 return edgeDevice;
Simon Huntc13082f2016-08-03 21:20:23 -070049 }
50
Simon Hunt3d712522016-08-11 11:20:44 -070051 // no port for end-point A
52
53 @Override
54 public String endPortB() {
Simon Huntb7fd0802016-10-27 12:21:40 -070055 return edgePort;
Simon Hunt3d712522016-08-11 11:20:44 -070056 }
Simon Huntc13082f2016-08-03 21:20:23 -070057}