blob: 40e54c126fc6d36f215b7bb4ae9b91416954cf25 [file] [log] [blame]
Andreas Pantelopoulosab8d8612018-01-24 15:28:37 -08001/*
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
17package org.onosproject.driver.handshaker;
18
19import org.projectfloodlight.openflow.protocol.OFCapabilities;
20import org.projectfloodlight.openflow.protocol.OFFeaturesReply;
21
22import java.util.HashSet;
23import 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 */
30public 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}