Andreas Pantelopoulos | ab8d861 | 2018-01-24 15:28:37 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-present Open Networking Foundation |
| 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 | |
| 17 | package org.onosproject.driver.handshaker; |
| 18 | |
| 19 | import org.projectfloodlight.openflow.protocol.OFCapabilities; |
| 20 | import org.projectfloodlight.openflow.protocol.OFFeaturesReply; |
| 21 | |
| 22 | import java.util.HashSet; |
| 23 | import java.util.Set; |
| 24 | |
| 25 | /** |
| 26 | * Driver for ofdpa 3 switches |
| 27 | * TODO : Remove this and also remove the specific switch handler from |
| 28 | * onos-drivers.xml once bug with GROUP_STATS is fixed. |
| 29 | */ |
| 30 | public class Ofdpa3SwitchHandshaker extends DefaultSwitchHandshaker { |
| 31 | |
| 32 | @Override |
| 33 | public void setFeaturesReply(OFFeaturesReply featuresReply) { |
| 34 | |
| 35 | OFFeaturesReply.Builder builder = featuresReply.createBuilder(); |
| 36 | |
| 37 | // do not try to set PORTS or ACTIONS, |
| 38 | // they are not supported for this openflow version |
| 39 | builder.setAuxiliaryId(featuresReply.getAuxiliaryId()); |
| 40 | builder.setDatapathId(featuresReply.getDatapathId()); |
| 41 | builder.setNBuffers(featuresReply.getNBuffers()); |
| 42 | builder.setReserved(featuresReply.getReserved()); |
| 43 | builder.setXid(featuresReply.getXid()); |
| 44 | |
| 45 | Set<OFCapabilities> capabilities = new HashSet<>(featuresReply.getCapabilities()); |
| 46 | capabilities.add(OFCapabilities.GROUP_STATS); |
| 47 | builder.setCapabilities(capabilities); |
| 48 | |
| 49 | super.setFeaturesReply(builder.build()); |
| 50 | } |
| 51 | |
| 52 | } |