Thomas Vachuska
Committed by Gerrit Code Review

Added agglink null topology to test aggregate links.

Change-Id: Iba442e5da925f4c065538eff4f71a856670ffc75
1 +/*
2 + * Copyright 2015 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 +package org.onosproject.provider.nil;
17 +
18 +import static com.google.common.base.Preconditions.checkArgument;
19 +
20 +/**
21 + * Simple triangle topology with multiple links between same devices.
22 + */
23 +public class AggLinkTopologySimulator extends CentipedeTopologySimulator {
24 +
25 + @Override
26 + protected void processTopoShape(String shape) {
27 + super.processTopoShape(shape);
28 + infrastructurePorts = 2 * deviceCount - 1;
29 + }
30 +
31 + @Override
32 + public void setUpTopology() {
33 + checkArgument(deviceCount > 2, "There must be at least 3 devices");
34 + super.setUpTopology();
35 + }
36 +
37 + @Override
38 + protected void createLinks() {
39 + int srcPortOffset = deviceCount + 1;
40 + for (int i = 0, n = deviceCount; i < n; i++) {
41 + int dstPortOffset = 1;
42 + for (int j = 0; j <= i; j++) {
43 + createLink(i, (i + 1) % n, srcPortOffset + j, dstPortOffset + j);
44 + }
45 + srcPortOffset = dstPortOffset + i + 1;
46 + }
47 + }
48 +
49 +}
...@@ -323,6 +323,8 @@ public class NullProviders { ...@@ -323,6 +323,8 @@ public class NullProviders {
323 return new RerouteTopologySimulator(); 323 return new RerouteTopologySimulator();
324 } else if (topoShape.matches("tree([,].*|$)")) { 324 } else if (topoShape.matches("tree([,].*|$)")) {
325 return new TreeTopologySimulator(); 325 return new TreeTopologySimulator();
326 + } else if (topoShape.matches("agglink([,].*|$)")) {
327 + return new AggLinkTopologySimulator();
326 } else if (topoShape.matches("spineleaf([,].*|$)")) { 328 } else if (topoShape.matches("spineleaf([,].*|$)")) {
327 return new SpineLeafTopologySimulator(); 329 return new SpineLeafTopologySimulator();
328 } else if (topoShape.matches("mesh([,].*|$)")) { 330 } else if (topoShape.matches("mesh([,].*|$)")) {
......