2 * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
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
9 package org.opendaylight.bgpmanager.commands;
11 import org.opendaylight.bgpmanager.BgpManager;
12 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.*;
14 public class Commands {
15 private static BgpManager bm;
16 public static final int IPADDR = 1;
17 public static final int INT = 2;
19 public Commands(BgpManager bgpm) {
23 public static BgpManager getBgpManager() {
27 public static boolean isValid(String val, int type, String name) {
31 int i = Integer.parseInt(val);
32 } catch (NumberFormatException nme) {
33 System.err.println("error: value of "+name+" is not an integer");
39 Ipv4Address addr = new Ipv4Address(val);
40 } catch (Exception e) {
41 System.err.println("error: value of "+name+" is not an IP address");
51 public static boolean bgpRunning() {
52 if (getBgpManager() == null) {
53 System.err.println("error: cannot run command, BgpManager not started");