1 package org.onosproject.segmentrouting.config;
3 import org.onosproject.net.DeviceId;
4 import org.slf4j.Logger;
5 import org.slf4j.LoggerFactory;
8 * NetworkConfigExceptions specifies a set of unchecked runtime exceptions that
9 * can be thrown by the {@link NetworkConfigManager}. It indicates errors that
10 * must be fixed in the config file before controller execution can proceed.
12 public class NetworkConfigException extends RuntimeException {
14 private static final long serialVersionUID = 4959684709803000652L;
15 protected static final Logger log = LoggerFactory
16 .getLogger(NetworkConfigException.class);
19 * Exception for duplicate device identifier configuration.
21 public static class DuplicateDpid extends RuntimeException {
22 private static final long serialVersionUID = 5491113234592145335L;
24 public DuplicateDpid(DeviceId dpid) {
26 log.error("Duplicate dpid found in switch-config Dpid:{}",
32 * Exception for duplicate device name configuration.
34 public static class DuplicateName extends RuntimeException {
35 private static final long serialVersionUID = -4090171438031376129L;
37 public DuplicateName(String name) {
39 log.error("Duplicate name found in switch-config name:{}", name);
44 * Exception for unspecified device identifier for a switch.
46 public static class DpidNotSpecified extends RuntimeException {
47 private static final long serialVersionUID = -8494418855597117254L;
49 public DpidNotSpecified(String name) {
51 log.error("Dpid not specified for switch-config name:{}", name);
56 * Exception for unspecified device name for a switch.
58 public static class NameNotSpecified extends RuntimeException {
59 private static final long serialVersionUID = -3518881744110422891L;
61 public NameNotSpecified(DeviceId dpid) {
63 log.error("Name not specified for switch-config dpid:{}",
69 * Exception for unspecified device type for a switch.
71 public static class SwitchTypeNotSpecified extends RuntimeException {
72 private static final long serialVersionUID = 2527453336226053753L;
74 public SwitchTypeNotSpecified(DeviceId dpid) {
76 log.error("Switch type not specified for switch-config dpid:{}",
82 * Exception for unknown device type configured for a switch.
84 public static class UnknownSwitchType extends RuntimeException {
85 private static final long serialVersionUID = 7758418165512249170L;
87 public UnknownSwitchType(String type, String name) {
89 log.error("Unknown switch type {} for switch name:{}", type, name);
94 * Exception for missing required parameter configuration for a switch.
96 public static class ParamsNotSpecified extends RuntimeException {
97 private static final long serialVersionUID = 6247582323691265513L;
99 public ParamsNotSpecified(String name) {
101 log.error("Params required - not specified for switch:{}", name);
106 * Reserved for future use.
108 public static class LinkTypeNotSpecified extends RuntimeException {
109 private static final long serialVersionUID = -2089470389588542215L;
111 public LinkTypeNotSpecified(String dpid1, String dpid2) {
113 log.error("Link type not specified for link-config between "
114 + "dpid1:{} and dpid2:{}", dpid1, dpid2);
119 * Reserved for future use.
121 public static class LinkDpidNotSpecified extends RuntimeException {
122 private static final long serialVersionUID = -5701825916378616004L;
124 public LinkDpidNotSpecified(String dpid1, String dpid2) {
127 log.error("nodeDpid1 not specified for link-config ");
130 log.error("nodeDpid2 not specified for link-config ");
136 * Reserved for future use.
138 public static class LinkForUnknownSwitchConfig extends RuntimeException {
139 private static final long serialVersionUID = -2910458439881964094L;
141 public LinkForUnknownSwitchConfig(String dpid) {
143 log.error("Link configuration was specified for a switch-dpid {} "
144 + "that has not been configured", dpid);
149 * Reserved for future use.
151 public static class UnknownLinkType extends RuntimeException {
152 private static final long serialVersionUID = -5505376193106542305L;
154 public UnknownLinkType(String linktype, String dpid1, String dpid2) {
156 log.error("unknown link type {} for links between dpid1:{} "
157 + "and dpid2:{}", linktype, dpid1, dpid2);
162 * Exception for generic configuration errors.
164 public static class ErrorConfig extends RuntimeException {
165 private static final long serialVersionUID = -2827406314700193147L;
167 public ErrorConfig(String errorMsg) {
175 * Reserved for future use.
177 public static class SwitchDpidNotConverted extends RuntimeException {
178 private static final long serialVersionUID = 5640347104590170426L;
180 public SwitchDpidNotConverted(String name) {
182 log.error("Switch dpid specified as a HexString {} does not match "
183 + "with long value", name);
188 * Reserved for future use.
190 public static class LinkDpidNotConverted extends RuntimeException {
191 private static final long serialVersionUID = 2397245646094080774L;
193 public LinkDpidNotConverted(String dpid1, String dpid2) {
194 log.error("Dpids expressed as HexStrings for links between dpid1:{} "
195 + "and dpid2:{} do not match with long values", dpid1, dpid2);