blob: 081ea105fdf354134b69f482fdbe208a9e202adb [file] [log] [blame]
tom9ccd7812014-08-25 22:43:19 -07001package org.onlab.onos.of.controller.impl;
alshabib1f44e8e2014-08-14 15:19:57 -07002
3import org.projectfloodlight.openflow.protocol.OFControllerRole;
4
5/**
6 * The role of the controller as it pertains to a particular switch.
7 * Note that this definition of the role enum is different from the
8 * OF1.3 definition. It is maintained here to be backward compatible to
9 * earlier versions of the controller code. This enum is translated
10 * to the OF1.3 enum, before role messages are sent to the switch.
11 * See sendRoleRequestMessage method in OFSwitchImpl
12 */
13public enum Role {
14 EQUAL(OFControllerRole.ROLE_EQUAL),
15 MASTER(OFControllerRole.ROLE_MASTER),
16 SLAVE(OFControllerRole.ROLE_SLAVE);
17
18 private Role(OFControllerRole nxRole) {
19 nxRole.ordinal();
20 }
21 /*
22 private static Map<Integer,Role> nxRoleToEnum
23 = new HashMap<Integer,Role>();
24 static {
25 for(Role r: Role.values())
26 nxRoleToEnum.put(r.toNxRole(), r);
27 }
28 public int toNxRole() {
29 return nxRole;
30 }
31 // Return the enum representing the given nxRole or null if no
32 // such role exists
33 public static Role fromNxRole(int nxRole) {
34 return nxRoleToEnum.get(nxRole);
35 }*/
36}