blob: f34bdb73abc023d8bfd28abf6c74e712ccd2da3d [file] [log] [blame]
Hyunsun Moon0d457362017-06-27 17:19:41 +09001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Hyunsun Moon0d457362017-06-27 17:19:41 +09003 *
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.openstacknode.api;
17
18/**
19 * Defines the initialization states of OpenStack node.
20 */
21public enum NodeState {
22
23 /**
24 * Indicates the node is newly added.
25 */
26 INIT {
27 @Override
28 public void process(OpenstackNodeHandler handler, OpenstackNode osNode) {
29 handler.processInitState(osNode);
30 }
31
32 @Override
33 public NodeState nextState() {
34 return DEVICE_CREATED;
35 }
36 },
37 /**
38 * Indicates bridge devices are added according to the node state.
39 */
40 DEVICE_CREATED {
41 @Override
42 public void process(OpenstackNodeHandler handler, OpenstackNode osNode) {
43 handler.processDeviceCreatedState(osNode);
44 }
45
46 @Override
47 public NodeState nextState() {
Hyunsun Moon0d457362017-06-27 17:19:41 +090048 return COMPLETE;
49 }
50 },
51 /**
52 * Indicates node initialization is done.
53 */
54 COMPLETE {
55 @Override
56 public void process(OpenstackNodeHandler handler, OpenstackNode osNode) {
57 handler.processCompleteState(osNode);
58 }
59
60 @Override
61 public NodeState nextState() {
62 return COMPLETE;
63 }
64
65 },
66 /**
67 * Indicates node is broken.
68 */
69 INCOMPLETE {
70 @Override
71 public void process(OpenstackNodeHandler handler, OpenstackNode osNode) {
72 handler.processIncompleteState(osNode);
73 }
74
75 @Override
76 public NodeState nextState() {
77 return INIT;
78 }
79 };
80
81 public abstract void process(OpenstackNodeHandler handler, OpenstackNode osNode);
82 public abstract NodeState nextState();
83}