blob: 33705db2ad2a9d3b9f953f8acc38c9f3b8be0a8b [file] [log] [blame]
Thomas Vachuska0d933862018-04-06 00:29:30 -07001/*
2 * Copyright 2018-present Open Networking Foundation
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 */
16package org.onosproject.layout;
17
18import org.apache.karaf.shell.commands.Argument;
19import org.apache.karaf.shell.commands.Command;
20import org.onosproject.cli.AbstractShellCommand;
21
22/**
23 * Lists all the default lease parameters offered by the DHCP Server.
24 */
25@Command(scope = "onos", name = "topo-layout",
26 description = "Lays out the elements in the topology using the specified algorithm")
27public class AutoLayoutCommand extends AbstractShellCommand {
28
29 @Argument(index = 0, name = "algorithm",
30 description = "Layout algorithm to use for the layout")
31 String algorithm = "access";
32
33 @Override
34 protected void execute() {
35 RoleBasedLayoutManager mgr = get(RoleBasedLayoutManager.class);
36 switch (algorithm) {
37 case "spine-leaf":
38 mgr.layout(new AccessNetworkLayout());
39 break;
40 case "access":
41 mgr.layout(new AccessNetworkLayout());
42 break;
43 case "hag-access":
44 mgr.layout(new AccessNetworkLayout());
45 break;
46 default:
47 print("Unsupported layout algorithm %s", algorithm);
48 }
49 }
50}