783a37e6435d22464acd4548cd36a70e32044688
[onosfw.git] /
1 /*
2  * Copyright 2015 Open Networking Laboratory
3  *
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  */
16 package org.onosproject.openflow.drivers;
17
18 import org.onosproject.openflow.controller.Dpid;
19 import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
20 import org.projectfloodlight.openflow.types.TableId;
21
22 /**
23  * OFDescriptionStatistics Vendor (Manufacturer Desc.): Dell Make (Hardware
24  * Desc.) : OpenFlow 1.3 Reference Userspace Switch Model (Datapath Desc.) :
25  * None Software : Serial : None.
26  */
27 //TODO: Knock-off this class as we don't need any switch/app specific
28 //drivers in the south bound layers.
29 public class OFSwitchImplSpringOpenTTPDellOSR extends OFSwitchImplSpringOpenTTP {
30
31     /* Table IDs to be used for Dell Open Segment Routers*/
32     private static final int DELL_TABLE_VLAN = 17;
33     private static final int DELL_TABLE_TMAC = 18;
34     private static final int DELL_TABLE_IPV4_UNICAST = 30;
35     private static final int DELL_TABLE_MPLS = 25;
36     private static final int DELL_TABLE_ACL = 40;
37
38     public OFSwitchImplSpringOpenTTPDellOSR(Dpid dpid, OFDescStatsReply desc) {
39         super(dpid, desc);
40         vlanTableId = DELL_TABLE_VLAN;
41         tmacTableId = DELL_TABLE_TMAC;
42         ipv4UnicastTableId = DELL_TABLE_IPV4_UNICAST;
43         mplsTableId = DELL_TABLE_MPLS;
44         aclTableId = DELL_TABLE_ACL;
45     }
46
47     @Override
48     public TableType getTableType(TableId tid) {
49         switch (tid.getValue()) {
50             case DELL_TABLE_IPV4_UNICAST:
51                 return TableType.IP;
52             case DELL_TABLE_MPLS:
53                 return TableType.MPLS;
54             case DELL_TABLE_ACL:
55                 return TableType.ACL;
56             case DELL_TABLE_VLAN:
57                 return TableType.VLAN;
58             case DELL_TABLE_TMAC:
59                 return TableType.ETHER;
60             default:
61                 log.error("Table type for Table id {} is not supported in the driver", tid);
62                 return TableType.NONE;
63         }
64     }
65 }