e26da225c7be7dcac2c6d98b4a2139e88b1483eb
[bgpcep.git] / bgp / flowspec / src / main / java / org / opendaylight / protocol / bgp / flowspec / SimpleFlowspecExtensionProviderContext.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. 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 package org.opendaylight.protocol.bgp.flowspec;
9
10 public class SimpleFlowspecExtensionProviderContext {
11     public enum AFI {
12         IPV4(0),
13         IPV6(1);
14
15         public final int index;
16
17         AFI(int i) {
18             this.index = i;
19         }
20     }
21
22     public enum SAFI {
23         FLOWSPEC(0),
24         FLOWSPEC_VPN(1);
25
26         public final int index;
27
28         SAFI(int i) {
29             this.index = i;
30         }
31     }
32
33     private final SimpleFlowspecTypeRegistry flowspecTypeRegistries[][] = new SimpleFlowspecTypeRegistry[2][2];
34
35     public SimpleFlowspecExtensionProviderContext() {
36         for (AFI afi : AFI.values()) {
37             for (SAFI safi : SAFI.values()) {
38                 this.flowspecTypeRegistries[afi.index][safi.index] = new SimpleFlowspecTypeRegistry();
39             }
40         }
41     }
42
43     public SimpleFlowspecTypeRegistry getFlowspecTypeRegistry(AFI afi, SAFI safi) {
44         return this.flowspecTypeRegistries[afi.index][safi.index];
45     }
46 }