fix add and update commands
[unimgr.git] / cli / src / main / java / org / opendaylight / unimgr / cli / Utils.java
1 /*
2  * Copyright (c) 2016 CableLabs and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.unimgr.cli;
10
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.Speed;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed100MBuilder;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed10GBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed10MBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed1GBuilder;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.uni.SpeedBuilder;
17
18 public final class Utils {
19
20     private Utils() {
21
22     }
23
24     public static final Speed getSpeed(final String speed) {
25         Speed speedObject = null;
26         if (speed.equals("10M")) {
27             speedObject = new Speed10MBuilder().setSpeed10M(true)
28                                                .build();
29         }
30         else if (speed.equals("100M")) {
31             speedObject = new Speed100MBuilder().setSpeed100M(true)
32                                                 .build();
33         }
34         else if (speed.equals("1G")) {
35             speedObject = new Speed1GBuilder().setSpeed1G(true)
36                                               .build();
37         }
38         else if (speed.equals("10G")) {
39             speedObject = new Speed10GBuilder().setSpeed10G(true)
40                                                .build();
41         }
42         return speedObject;
43     }
44
45 }