alshabib
Committed by Gerrit Code Review

Initial sketch of driver based configuration api.

Change-Id: I82468aea5d698b28a4fd996142f9c88d7a56e31f
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.net.behaviour;
17 +
18 +import java.util.List;
19 +
20 +/**
21 + * Device behaviour to obtain and set controllers at the device.
22 + */
23 +public interface ControllerConfig {
24 +
25 + //TODO: add other controller parameters as needed.
26 +
27 + /**
28 + * Obtain the list of controller which are currently configured.
29 + * @return a list for controller descriptions
30 + */
31 + List<ControllerInfo> getControllers();
32 +
33 + /**
34 + * Set a list of controllers on a device.
35 + * @param controllers a list of controller descriptions
36 + */
37 + void setControllers(List<ControllerInfo> controllers);
38 +
39 +}
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.net.behaviour;
17 +
18 +import org.onlab.packet.IpAddress;
19 +
20 +/**
21 + * Represents information for a device to connect to a controller.
22 + */
23 +public class ControllerInfo {
24 +
25 + public final IpAddress ip;
26 + public final int tcpPort;
27 +
28 + public ControllerInfo(IpAddress ip, int tcpPort) {
29 + this.ip = ip;
30 + this.tcpPort = tcpPort;
31 + }
32 +}
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.net.behaviour;
17 +
18 +import com.google.common.primitives.UnsignedInteger;
19 +import org.onosproject.net.PortNumber;
20 +
21 +/**
22 + * Means to configure a logical port at the device.
23 + */
24 +public interface PortConfig {
25 +
26 + /**
27 + * Apply QoS configuration on a device.
28 + * @param port a port number
29 + * @param queueId an unsigned integer
30 + */
31 + void applyQoS(PortNumber port, UnsignedInteger queueId);
32 +
33 + /**
34 + * Remove a QoS configuration.
35 + * @param port a port number
36 + */
37 + void removeQoS(PortNumber port);
38 +
39 + /**
40 + * Enable/disable administratively a port.
41 + * @param port a port number
42 + * @param state a boolean indicating state
43 + */
44 + void setEnabled(PortNumber port, boolean state);
45 +
46 +}
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.net.behaviour;
17 +
18 +import com.google.common.primitives.UnsignedInteger;
19 +
20 +import java.util.Set;
21 +
22 +/**
23 + * Means to alter a device's dataplane queues.
24 + */
25 +public interface QueueConfig {
26 +
27 + /**
28 + * Obtain all queues configured on a device.
29 + *
30 + * @return a list of queue descriptions
31 + */
32 + Set<QueueInfo> getQueues();
33 +
34 + /**
35 + * Obtain a specific queue given a queue id.
36 + *
37 + * @param queueId an unsigned integer representing a queue id
38 + * @return a queue description
39 + */
40 + QueueInfo getQueue(UnsignedInteger queueId);
41 +
42 + /**
43 + * Add a queue to a device.
44 + *
45 + * @param queue a queue description
46 + */
47 + void addQueue(QueueInfo queue);
48 +
49 + /**
50 + * Remove a queue from a device.
51 + *
52 + * @param queueId an unsigned integer
53 + */
54 + void removeQueue(UnsignedInteger queueId);
55 +
56 +}
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.net.behaviour;
17 +
18 +import com.google.common.primitives.UnsignedInteger;
19 +
20 +/**
21 + * Represents a dataplane queue.
22 + */
23 +public class QueueInfo {
24 +
25 + public enum Type {
26 + /**
27 + * Supports burst and priority as well as min and max rates.
28 + */
29 + FULL,
30 +
31 + /**
32 + * Only support min and max rates.
33 + */
34 + MINMAX
35 + }
36 +
37 + private final UnsignedInteger queueId;
38 + private final Type type;
39 + private final long minRate;
40 + private final long maxRate;
41 + private final long burst;
42 + private final long priority;
43 +
44 + public QueueInfo(UnsignedInteger queueId, Type type, long minRate,
45 + long maxRate, long burst, long priority) {
46 + this.queueId = queueId;
47 + this.type = type;
48 + this.minRate = minRate;
49 + this.maxRate = maxRate;
50 + this.burst = burst;
51 + this.priority = priority;
52 + }
53 +
54 + //TODO builder
55 + // public static QueueInfoBuilder builder() {}
56 +}