initial import
Change-Id: Ief25aef0066ea96bd2c329ccef974c072b3a5a73
Showing
170 changed files
with
3939 additions
and
0 deletions
features.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright (c) 2014 Hewlett-Packard Development Company, L.P. | ||
4 | + ~ | ||
5 | + ~ This program and the accompanying materials are made available under the | ||
6 | + ~ terms of the Eclipse Public License v1.0 which accompanies this distribution, | ||
7 | + ~ and is available at http://www.eclipse.org/legal/epl-v10.html | ||
8 | + --> | ||
9 | + | ||
10 | +<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" | ||
11 | + name="net.onrc.onos-1.0.0"> | ||
12 | + <repository>mvn:net.onrc.onos/onos-features/1.0.0-SNAPSHOT/xml/features</repository> | ||
13 | + | ||
14 | + <feature name="thirdparty" version="1.0.0" | ||
15 | + description="ONOS 3rd party dependencies"> | ||
16 | + <bundle>mvn:com.google.code.findbugs/annotations/2.0.2</bundle> | ||
17 | + <bundle>mvn:io.netty/netty/3.9.2.Final</bundle> | ||
18 | + <bundle>mvn:com.google.guava/guava/17.0</bundle> | ||
19 | + <bundle>mvn:com.google.guava/guava/15.0</bundle> | ||
20 | + | ||
21 | + </feature> | ||
22 | + | ||
23 | + <feature name="base" version="1.0.0" | ||
24 | + description="ONOS Base"> | ||
25 | + <feature>scr</feature> | ||
26 | + <feature>thirdparty</feature> | ||
27 | + <bundle>mvn:net.onrc.onos.sb/onos-sb/0.0.1</bundle> | ||
28 | + <bundle>mvn:org.projectfloodlight/openflowj/0.3.6-SNAPSHOT</bundle> | ||
29 | + </feature> | ||
30 | + | ||
31 | +</features> |
1 | +package net.onrc.onos.api; | ||
2 | + | ||
3 | +import java.net.URI; | ||
4 | + | ||
5 | +/** | ||
6 | + * Immutable representaion of a device identity. | ||
7 | + */ | ||
8 | +public class DeviceId { | ||
9 | + | ||
10 | + private final URI uri; | ||
11 | + | ||
12 | + public DeviceId(URI uri) { | ||
13 | + this.uri = uri; | ||
14 | + } | ||
15 | + | ||
16 | + /** | ||
17 | + * Returns the backing URI. | ||
18 | + * | ||
19 | + * @return backing device URI | ||
20 | + */ | ||
21 | + public URI uri() { | ||
22 | + return uri; | ||
23 | + } | ||
24 | + | ||
25 | +} |
1 | +package net.onrc.onos.api; | ||
2 | + | ||
3 | +/** | ||
4 | + * Broker used for registering/unregistering information providers with the core. | ||
5 | + * | ||
6 | + * @param <T> type of the information provider | ||
7 | + * @param <S> type of the provider service | ||
8 | + */ | ||
9 | +public interface ProviderBroker<T extends Provider, S extends ProviderService> { | ||
10 | + | ||
11 | + /** | ||
12 | + * Registers the supplied provider with the core. | ||
13 | + * | ||
14 | + * @param provider provider to be registered | ||
15 | + * @return provider service for injecting information into core | ||
16 | + */ | ||
17 | + S register(T provider); | ||
18 | + | ||
19 | + /** | ||
20 | + * Unregisters the supplied provider. As a result the previously issued | ||
21 | + * provider service will be invalidated. | ||
22 | + * | ||
23 | + * @param provider provider to be unregistered | ||
24 | + */ | ||
25 | + void unregister(T provider); | ||
26 | + | ||
27 | +} |
1 | +package net.onrc.onos.api; | ||
2 | + | ||
3 | +/** | ||
4 | + * Notion of provider identity. | ||
5 | + */ | ||
6 | +public class ProviderId { | ||
7 | + | ||
8 | + private final String id; | ||
9 | + | ||
10 | + public ProviderId(String id) { | ||
11 | + this.id = id; | ||
12 | + } | ||
13 | + | ||
14 | + @Override | ||
15 | + public boolean equals(Object o) { | ||
16 | + if (this == o) { | ||
17 | + return true; | ||
18 | + } | ||
19 | + if (o == null || getClass() != o.getClass()) { | ||
20 | + return false; | ||
21 | + } | ||
22 | + | ||
23 | + ProviderId that = (ProviderId) o; | ||
24 | + | ||
25 | + if (!id.equals(that.id)) { | ||
26 | + return false; | ||
27 | + } | ||
28 | + | ||
29 | + return true; | ||
30 | + } | ||
31 | + | ||
32 | + @Override | ||
33 | + public int hashCode() { | ||
34 | + return id.hashCode(); | ||
35 | + } | ||
36 | + | ||
37 | + @Override | ||
38 | + public String toString() { | ||
39 | + return "ProviderId{" + | ||
40 | + "id='" + id + '\'' + | ||
41 | + '}'; | ||
42 | + } | ||
43 | +} |
1 | +package net.onrc.onos.api.device; | ||
2 | + | ||
3 | +import net.onrc.onos.api.Description; | ||
4 | + | ||
5 | +import java.net.URI; | ||
6 | + | ||
7 | +/** | ||
8 | + * Carrier of immutable information about a device. | ||
9 | + */ | ||
10 | +public interface DeviceDescription extends Description { | ||
11 | + | ||
12 | + /** | ||
13 | + * Protocol/provider specific URI that can be used to encode the identity | ||
14 | + * information required to communicate with the device externally, e.g. | ||
15 | + * datapath ID. | ||
16 | + * | ||
17 | + * @return provider specific URI for the device | ||
18 | + */ | ||
19 | + URI deviceURI(); | ||
20 | + | ||
21 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +package net.onrc.onos.api.device; | ||
2 | + | ||
3 | +import net.onrc.onos.api.ProviderService; | ||
4 | + | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | +/** | ||
8 | + * Service through which device providers can inject device information into | ||
9 | + * the core. | ||
10 | + */ | ||
11 | +public interface DeviceProviderService extends ProviderService { | ||
12 | + | ||
13 | + // TODO: define suspend and remove actions on the mezzanine administrative API | ||
14 | + | ||
15 | + /** | ||
16 | + * Signals the core that a device has connected or has been detected somehow. | ||
17 | + * | ||
18 | + * @param deviceDescription information about network device | ||
19 | + */ | ||
20 | + void deviceConnected(DeviceDescription deviceDescription); | ||
21 | + | ||
22 | + /** | ||
23 | + * Signals the core that a device has disconnected or is no longer reachable. | ||
24 | + * | ||
25 | + * @param deviceDescription device to be removed | ||
26 | + */ | ||
27 | + void deviceDisconnected(DeviceDescription deviceDescription); | ||
28 | + | ||
29 | + /** | ||
30 | + * Sends information about all ports of a device. It is up to the core to | ||
31 | + * determine what has changed. | ||
32 | + * | ||
33 | + * @param ports list of device ports | ||
34 | + */ | ||
35 | + void updatePorts(List<PortDescription> ports); | ||
36 | + | ||
37 | + /** | ||
38 | + * Used to notify the core about port status change of a single port. | ||
39 | + * | ||
40 | + * @param port description of the port that changed | ||
41 | + */ | ||
42 | + void portStatusChanged(PortDescription port); | ||
43 | + | ||
44 | +} |
1 | +package net.onrc.onos.api.link; | ||
2 | + | ||
3 | +/** | ||
4 | + * Describes an infrastructure link. | ||
5 | + */ | ||
6 | +public interface LinkDescription { | ||
7 | + | ||
8 | + // TODO: src, dst connection points, which are pairs of (DeviceId, PortNumber) | ||
9 | + | ||
10 | +// On the north: | ||
11 | +// Link = (ConnectPoint src, ConnectPoint dst); | ||
12 | +// ConnectPoint = (DeviceId, PortNumber); | ||
13 | + | ||
14 | +// On the south | ||
15 | +// LinkDescription ~ Link | ||
16 | + | ||
17 | +} |
1 | +package net.onrc.onos.api.link; | ||
2 | + | ||
3 | +import net.onrc.onos.api.ProviderService; | ||
4 | + | ||
5 | +/** | ||
6 | + * Means for injecting link information into the core. | ||
7 | + */ | ||
8 | +public interface LinkProviderService extends ProviderService { | ||
9 | + | ||
10 | + /** | ||
11 | + * Signals that an infrastructure link has been connected. | ||
12 | + * | ||
13 | + * @param linkDescription link information | ||
14 | + */ | ||
15 | + void linkConnected(LinkDescription linkDescription); | ||
16 | + | ||
17 | + /** | ||
18 | + * Signals that an infrastructure link has been disconnected. | ||
19 | + * | ||
20 | + * @param linkDescription link information | ||
21 | + */ | ||
22 | + void linkDisconnected(LinkDescription linkDescription); | ||
23 | + | ||
24 | +} |
of/ctl/conf/checkstyle/sun_checks.xml
0 → 100644
This diff is collapsed. Click to expand it.
of/ctl/conf/checkstyle/suppressions.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE suppressions PUBLIC "-//Puppy Crawl//DTD Suppressions 1.1//EN" "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd"> | ||
3 | + | ||
4 | +<suppressions> | ||
5 | + <!-- | ||
6 | + Note: Exclusion definition exists in multiple places. | ||
7 | + - In file ${findbugs.excludeFilterFile} defined at top of pom.xml | ||
8 | + - In file conf/checkstyle/onos_suppressions.xml (this file) | ||
9 | + - maven-pmd-plugin configuration in pom.xml | ||
10 | + (under build and reporting) | ||
11 | + --> | ||
12 | + | ||
13 | + <suppress files=".*" checks="FinalParametersCheck"/> | ||
14 | + <suppress files=".*" checks="MagicNumbersCheck"/> | ||
15 | + <suppress files=".*" checks="DesignForExtensionCheck"/> | ||
16 | + <suppress files=".*" checks="TodoCommentCheck"/> | ||
17 | + <suppress files=".*" checks="AvoidInlineConditionalsCheck"/> | ||
18 | + <suppress files=".*" checks="OperatorWrapCheck"/> | ||
19 | +</suppressions> | ||
20 | + |
of/ctl/conf/findbugs/exclude.xml
0 → 100644
1 | +<FindBugsFilter> | ||
2 | + <!-- | ||
3 | + Note: Exclusion definition exists in multiple places. | ||
4 | + - In file ${findbugs.excludeFilterFile} defined at top of pom.xml (this file) | ||
5 | + - In file conf/checkstyle/onos_suppressions.xml | ||
6 | + - maven-pmd-plugin configuration in pom.xml | ||
7 | + (under build and reporting) | ||
8 | + --> | ||
9 | + <Match> | ||
10 | + <Class name="~net\.onrc\.onos\.core\.datastore\.serializers\..*" /> | ||
11 | + </Match> | ||
12 | + <Match> | ||
13 | + <Class name="~.*edu\.stanford\..*"/> | ||
14 | + </Match> | ||
15 | + <Match> | ||
16 | + <Class name="~.org\.projectfloodlight\..*"/> | ||
17 | + </Match> | ||
18 | +</FindBugsFilter> |
of/ctl/pom.xml
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 | +package net.onrc.onos.of.ctl; | ||
2 | + | ||
3 | +import org.projectfloodlight.openflow.protocol.OFVersion; | ||
4 | + | ||
5 | +import net.onrc.onos.of.ctl.registry.IControllerRegistry; | ||
6 | + | ||
7 | +/** | ||
8 | + * Interface to passed to controller class in order to allow | ||
9 | + * it to spawn the appropriate type of switch and furthermore | ||
10 | + * specify a registry object (ie. ZooKeeper). | ||
11 | + * | ||
12 | + */ | ||
13 | +public interface IOFSwitchManager { | ||
14 | + | ||
15 | + /** | ||
16 | + * Given a description string for a switch spawn the | ||
17 | + * concrete representation of that switch. | ||
18 | + * | ||
19 | + * @param mfr manufacturer description | ||
20 | + * @param hwDesc hardware description | ||
21 | + * @param swDesc software description | ||
22 | + * @param ofv openflow version | ||
23 | + * @return A switch of type IOFSwitch. | ||
24 | + */ | ||
25 | + public IOFSwitch getSwitchImpl(String mfr, String hwDesc, String swDesc, OFVersion ofv); | ||
26 | + | ||
27 | + /** | ||
28 | + * Returns the mastership registry used during controller-switch role election. | ||
29 | + * @return the registry | ||
30 | + */ | ||
31 | + public IControllerRegistry getRegistry(); | ||
32 | + | ||
33 | +} |
1 | +package net.onrc.onos.of.ctl; | ||
2 | + | ||
3 | +import org.projectfloodlight.openflow.protocol.OFControllerRole; | ||
4 | + | ||
5 | +/** | ||
6 | + * The role of the controller as it pertains to a particular switch. | ||
7 | + * Note that this definition of the role enum is different from the | ||
8 | + * OF1.3 definition. It is maintained here to be backward compatible to | ||
9 | + * earlier versions of the controller code. This enum is translated | ||
10 | + * to the OF1.3 enum, before role messages are sent to the switch. | ||
11 | + * See sendRoleRequestMessage method in OFSwitchImpl | ||
12 | + */ | ||
13 | +public enum Role { | ||
14 | + EQUAL(OFControllerRole.ROLE_EQUAL), | ||
15 | + MASTER(OFControllerRole.ROLE_MASTER), | ||
16 | + SLAVE(OFControllerRole.ROLE_SLAVE); | ||
17 | + | ||
18 | + private Role(OFControllerRole nxRole) { | ||
19 | + nxRole.ordinal(); | ||
20 | + } | ||
21 | + /* | ||
22 | + private static Map<Integer,Role> nxRoleToEnum | ||
23 | + = new HashMap<Integer,Role>(); | ||
24 | + static { | ||
25 | + for(Role r: Role.values()) | ||
26 | + nxRoleToEnum.put(r.toNxRole(), r); | ||
27 | + } | ||
28 | + public int toNxRole() { | ||
29 | + return nxRole; | ||
30 | + } | ||
31 | + // Return the enum representing the given nxRole or null if no | ||
32 | + // such role exists | ||
33 | + public static Role fromNxRole(int nxRole) { | ||
34 | + return nxRoleToEnum.get(nxRole); | ||
35 | + }*/ | ||
36 | +} |
1 | +/** | ||
2 | + * Copyright 2012, Big Switch Networks, Inc. | ||
3 | + * Originally created by David Erickson, Stanford University | ||
4 | + * | ||
5 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
6 | + * not use this file except in compliance with the License. You may obtain | ||
7 | + * a copy of the License at | ||
8 | + * | ||
9 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + * | ||
11 | + * Unless required by applicable law or agreed to in writing, software | ||
12 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
13 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
14 | + * License for the specific language governing permissions and limitations | ||
15 | + * under the License. | ||
16 | + **/ | ||
17 | + | ||
18 | +package net.onrc.onos.of.ctl.annotations; | ||
19 | + | ||
20 | +import java.lang.annotation.ElementType; | ||
21 | +import java.lang.annotation.Target; | ||
22 | + | ||
23 | +/** | ||
24 | + * Annotation used to set the category for log messages for a class. | ||
25 | + * | ||
26 | + */ | ||
27 | +@Target({ ElementType.TYPE, ElementType.METHOD }) | ||
28 | +public @interface LogMessageCategory { | ||
29 | + | ||
30 | + /** | ||
31 | + * The category for the log messages for this class. | ||
32 | + * | ||
33 | + * @return | ||
34 | + */ | ||
35 | + String value() default "Core"; | ||
36 | +} |
1 | +/** | ||
2 | + * Copyright 2012, Big Switch Networks, Inc. | ||
3 | + * Originally created by David Erickson, Stanford University | ||
4 | + * | ||
5 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
6 | + * not use this file except in compliance with the License. You may obtain | ||
7 | + * a copy of the License at | ||
8 | + * | ||
9 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + * | ||
11 | + * Unless required by applicable law or agreed to in writing, software | ||
12 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
13 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
14 | + * License for the specific language governing permissions and limitations | ||
15 | + * under the License. | ||
16 | + **/ | ||
17 | + | ||
18 | +package net.onrc.onos.of.ctl.annotations; | ||
19 | + | ||
20 | +import java.lang.annotation.ElementType; | ||
21 | +import java.lang.annotation.Target; | ||
22 | + | ||
23 | +/** | ||
24 | + * Annotation used to document log messages. This can be used to generate | ||
25 | + * documentation on syslog output. | ||
26 | + * | ||
27 | + */ | ||
28 | +@Target({ ElementType.TYPE, ElementType.METHOD }) | ||
29 | +public @interface LogMessageDoc { | ||
30 | + public static final String NO_ACTION = "No action is required."; | ||
31 | + public static final String UNKNOWN_ERROR = "An unknown error occured"; | ||
32 | + public static final String GENERIC_ACTION = | ||
33 | + "Examine the returned error or exception and take " + | ||
34 | + "appropriate action."; | ||
35 | + public static final String CHECK_SWITCH = | ||
36 | + "Check the health of the indicated switch. " + | ||
37 | + "Test and troubleshoot IP connectivity."; | ||
38 | + public static final String CHECK_CONTROLLER = | ||
39 | + "Verify controller system health, CPU usage, and memory. " + | ||
40 | + "Rebooting the controller node may help if the controller " + | ||
41 | + "node is in a distressed state."; | ||
42 | + public static final String REPORT_CONTROLLER_BUG = | ||
43 | + "This is likely a defect in the controller. Please report this " + | ||
44 | + "issue. Restarting the controller or switch may help to " + | ||
45 | + "alleviate."; | ||
46 | + public static final String REPORT_SWITCH_BUG = | ||
47 | + "This is likely a defect in the switch. Please report this " + | ||
48 | + "issue. Restarting the controller or switch may help to " + | ||
49 | + "alleviate."; | ||
50 | + | ||
51 | + /** | ||
52 | + * The log level for the log message. | ||
53 | + * | ||
54 | + * @return the log level as a tring | ||
55 | + */ | ||
56 | + String level() default "INFO"; | ||
57 | + | ||
58 | + /** | ||
59 | + * The message that will be printed. | ||
60 | + * | ||
61 | + * @return the message | ||
62 | + */ | ||
63 | + String message() default UNKNOWN_ERROR; | ||
64 | + | ||
65 | + /** | ||
66 | + * An explanation of the meaning of the log message. | ||
67 | + * | ||
68 | + * @return the explanation | ||
69 | + */ | ||
70 | + String explanation() default UNKNOWN_ERROR; | ||
71 | + | ||
72 | + /** | ||
73 | + * The recommendated action associated with the log message. | ||
74 | + * | ||
75 | + * @return the recommendation | ||
76 | + */ | ||
77 | + String recommendation() default NO_ACTION; | ||
78 | +} |
1 | +/** | ||
2 | + * Copyright 2012, Big Switch Networks, Inc. | ||
3 | + * Originally created by David Erickson, Stanford University | ||
4 | + * | ||
5 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
6 | + * not use this file except in compliance with the License. You may obtain | ||
7 | + * a copy of the License at | ||
8 | + * | ||
9 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + * | ||
11 | + * Unless required by applicable law or agreed to in writing, software | ||
12 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
13 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
14 | + * License for the specific language governing permissions and limitations | ||
15 | + * under the License. | ||
16 | + **/ | ||
17 | + | ||
18 | +package net.onrc.onos.of.ctl.annotations; | ||
19 | + | ||
20 | +import java.lang.annotation.ElementType; | ||
21 | +import java.lang.annotation.Target; | ||
22 | + | ||
23 | +/** | ||
24 | + * Annotation used to document log messages. This can be used to generate | ||
25 | + * documentation on syslog output. This version allows multiple log messages | ||
26 | + * to be documentated on an interface. | ||
27 | + * | ||
28 | + */ | ||
29 | +@Target({ ElementType.TYPE, ElementType.METHOD }) | ||
30 | +public @interface LogMessageDocs { | ||
31 | + /** | ||
32 | + * A list of {@link LogMessageDoc} elements. | ||
33 | + * | ||
34 | + * @return the list of log message doc | ||
35 | + */ | ||
36 | + LogMessageDoc[] value(); | ||
37 | +} |
This diff is collapsed. Click to expand it.
1 | +package net.onrc.onos.of.ctl.debugcounter; | ||
2 | + | ||
3 | +public interface IDebugCounter { | ||
4 | + /** | ||
5 | + * Increments the counter by 1 thread-locally, and immediately flushes to | ||
6 | + * the global counter storage. This method should be used for counters that | ||
7 | + * are updated outside the OF message processing pipeline. | ||
8 | + */ | ||
9 | + void updateCounterWithFlush(); | ||
10 | + | ||
11 | + /** | ||
12 | + * Increments the counter by 1 thread-locally. Flushing to the global | ||
13 | + * counter storage is delayed (happens with flushCounters() in IDebugCounterService), | ||
14 | + * resulting in higher performance. This method should be used for counters | ||
15 | + * updated in the OF message processing pipeline. | ||
16 | + */ | ||
17 | + void updateCounterNoFlush(); | ||
18 | + | ||
19 | + /** | ||
20 | + * Increments the counter thread-locally by the 'incr' specified, and immediately | ||
21 | + * flushes to the global counter storage. This method should be used for counters | ||
22 | + * that are updated outside the OF message processing pipeline. | ||
23 | + */ | ||
24 | + void updateCounterWithFlush(int incr); | ||
25 | + | ||
26 | + /** | ||
27 | + * Increments the counter thread-locally by the 'incr' specified. Flushing to the global | ||
28 | + * counter storage is delayed (happens with flushCounters() in IDebugCounterService), | ||
29 | + * resulting in higher performance. This method should be used for counters | ||
30 | + * updated in the OF message processing pipeline. | ||
31 | + */ | ||
32 | + void updateCounterNoFlush(int incr); | ||
33 | + | ||
34 | + /** | ||
35 | + * Retrieve the value of the counter from the global counter store. | ||
36 | + */ | ||
37 | + long getCounterValue(); | ||
38 | +} |
This diff is collapsed. Click to expand it.
1 | +package net.onrc.onos.of.ctl.debugcounter; | ||
2 | + | ||
3 | +import java.util.Collections; | ||
4 | +import java.util.List; | ||
5 | + | ||
6 | +import net.onrc.onos.of.ctl.debugcounter.DebugCounter.DebugCounterInfo; | ||
7 | + | ||
8 | +public class NullDebugCounter implements IDebugCounterService { | ||
9 | + | ||
10 | + @Override | ||
11 | + public void flushCounters() { | ||
12 | + | ||
13 | + } | ||
14 | + | ||
15 | + @Override | ||
16 | + public void resetAllCounters() { | ||
17 | + | ||
18 | + } | ||
19 | + | ||
20 | + @Override | ||
21 | + public void resetAllModuleCounters(String moduleName) { | ||
22 | + | ||
23 | + } | ||
24 | + | ||
25 | + | ||
26 | + @Override | ||
27 | + public void resetCounterHierarchy(String moduleName, String counterHierarchy) { | ||
28 | + | ||
29 | + } | ||
30 | + | ||
31 | + @Override | ||
32 | + public void enableCtrOnDemand(String moduleName, String counterHierarchy) { | ||
33 | + | ||
34 | + } | ||
35 | + | ||
36 | + @Override | ||
37 | + public void disableCtrOnDemand(String moduleName, String counterHierarchy) { | ||
38 | + | ||
39 | + } | ||
40 | + | ||
41 | + @Override | ||
42 | + public List<DebugCounterInfo> getCounterHierarchy(String moduleName, | ||
43 | + String counterHierarchy) { | ||
44 | + return Collections.emptyList(); | ||
45 | + } | ||
46 | + | ||
47 | + @Override | ||
48 | + public List<DebugCounterInfo> getAllCounterValues() { | ||
49 | + return Collections.emptyList(); | ||
50 | + } | ||
51 | + | ||
52 | + @Override | ||
53 | + public List<DebugCounterInfo> getModuleCounterValues(String moduleName) { | ||
54 | + return Collections.emptyList(); | ||
55 | + } | ||
56 | + | ||
57 | + @Override | ||
58 | + public boolean containsModuleCounterHierarchy(String moduleName, | ||
59 | + String counterHierarchy) { | ||
60 | + return false; | ||
61 | + } | ||
62 | + | ||
63 | + @Override | ||
64 | + public boolean containsModuleName(String moduleName) { | ||
65 | + return false; | ||
66 | + } | ||
67 | + | ||
68 | + @Override | ||
69 | + public | ||
70 | + IDebugCounter | ||
71 | + registerCounter(String moduleName, String counterHierarchy, | ||
72 | + String counterDescription, | ||
73 | + CounterType counterType, String... metaData) | ||
74 | + throws MaxCountersRegistered { | ||
75 | + return new NullCounterImpl(); | ||
76 | + } | ||
77 | + | ||
78 | + @Override | ||
79 | + public List<String> getModuleList() { | ||
80 | + return Collections.emptyList(); | ||
81 | + } | ||
82 | + | ||
83 | + @Override | ||
84 | + public List<String> getModuleCounterList(String moduleName) { | ||
85 | + return Collections.emptyList(); | ||
86 | + } | ||
87 | + | ||
88 | + public static class NullCounterImpl implements IDebugCounter { | ||
89 | + | ||
90 | + @Override | ||
91 | + public void updateCounterWithFlush() { | ||
92 | + | ||
93 | + } | ||
94 | + | ||
95 | + @Override | ||
96 | + public void updateCounterNoFlush() { | ||
97 | + | ||
98 | + } | ||
99 | + | ||
100 | + @Override | ||
101 | + public void updateCounterWithFlush(int incr) { | ||
102 | + } | ||
103 | + | ||
104 | + @Override | ||
105 | + public void updateCounterNoFlush(int incr) { | ||
106 | + | ||
107 | + } | ||
108 | + | ||
109 | + @Override | ||
110 | + public long getCounterValue() { | ||
111 | + return -1; | ||
112 | + } | ||
113 | + | ||
114 | + } | ||
115 | + | ||
116 | +} |
This diff is collapsed. Click to expand it.
1 | +/** | ||
2 | + * Copyright 2011, Big Switch Networks, Inc. | ||
3 | + * Originally created by David Erickson, Stanford University | ||
4 | + * | ||
5 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
6 | + * not use this file except in compliance with the License. You may obtain | ||
7 | + * a copy of the License at | ||
8 | + * | ||
9 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + * | ||
11 | + * Unless required by applicable law or agreed to in writing, software | ||
12 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
13 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
14 | + * License for the specific language governing permissions and limitations | ||
15 | + * under the License. | ||
16 | + **/ | ||
17 | + | ||
18 | +package net.onrc.onos.of.ctl.internal; | ||
19 | + | ||
20 | +/** | ||
21 | + * Exception is thrown when the handshake fails to complete. | ||
22 | + * before a specified time | ||
23 | + * | ||
24 | + */ | ||
25 | +public class HandshakeTimeoutException extends Exception { | ||
26 | + | ||
27 | + private static final long serialVersionUID = 6859880268940337312L; | ||
28 | + | ||
29 | +} |
1 | +/** | ||
2 | +* Copyright 2011, Big Switch Networks, Inc. | ||
3 | +* Originally created by David Erickson, Stanford University | ||
4 | +* | ||
5 | +* Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
6 | +* not use this file except in compliance with the License. You may obtain | ||
7 | +* a copy of the License at | ||
8 | +* | ||
9 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | +* | ||
11 | +* Unless required by applicable law or agreed to in writing, software | ||
12 | +* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
13 | +* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
14 | +* License for the specific language governing permissions and limitations | ||
15 | +* under the License. | ||
16 | +**/ | ||
17 | + | ||
18 | +package net.onrc.onos.of.ctl.internal; | ||
19 | + | ||
20 | +import java.util.concurrent.TimeUnit; | ||
21 | + | ||
22 | +import org.jboss.netty.channel.ChannelHandlerContext; | ||
23 | +import org.jboss.netty.channel.ChannelStateEvent; | ||
24 | +import org.jboss.netty.channel.Channels; | ||
25 | +import org.jboss.netty.channel.SimpleChannelUpstreamHandler; | ||
26 | +import org.jboss.netty.util.Timeout; | ||
27 | +import org.jboss.netty.util.Timer; | ||
28 | +import org.jboss.netty.util.TimerTask; | ||
29 | + | ||
30 | +/** | ||
31 | + * Trigger a timeout if a switch fails to complete handshake soon enough. | ||
32 | + */ | ||
33 | +public class HandshakeTimeoutHandler | ||
34 | + extends SimpleChannelUpstreamHandler { | ||
35 | + static final HandshakeTimeoutException EXCEPTION = | ||
36 | + new HandshakeTimeoutException(); | ||
37 | + | ||
38 | + final OFChannelHandler channelHandler; | ||
39 | + final Timer timer; | ||
40 | + final long timeoutNanos; | ||
41 | + volatile Timeout timeout; | ||
42 | + | ||
43 | + public HandshakeTimeoutHandler(OFChannelHandler channelHandler, | ||
44 | + Timer timer, | ||
45 | + long timeoutSeconds) { | ||
46 | + super(); | ||
47 | + this.channelHandler = channelHandler; | ||
48 | + this.timer = timer; | ||
49 | + this.timeoutNanos = TimeUnit.SECONDS.toNanos(timeoutSeconds); | ||
50 | + | ||
51 | + } | ||
52 | + | ||
53 | + @Override | ||
54 | + public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) | ||
55 | + throws Exception { | ||
56 | + if (timeoutNanos > 0) { | ||
57 | + timeout = timer.newTimeout(new HandshakeTimeoutTask(ctx), | ||
58 | + timeoutNanos, TimeUnit.NANOSECONDS); | ||
59 | + } | ||
60 | + ctx.sendUpstream(e); | ||
61 | + } | ||
62 | + | ||
63 | + @Override | ||
64 | + public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) | ||
65 | + throws Exception { | ||
66 | + if (timeout != null) { | ||
67 | + timeout.cancel(); | ||
68 | + timeout = null; | ||
69 | + } | ||
70 | + } | ||
71 | + | ||
72 | + private final class HandshakeTimeoutTask implements TimerTask { | ||
73 | + | ||
74 | + private final ChannelHandlerContext ctx; | ||
75 | + | ||
76 | + HandshakeTimeoutTask(ChannelHandlerContext ctx) { | ||
77 | + this.ctx = ctx; | ||
78 | + } | ||
79 | + | ||
80 | + @Override | ||
81 | + public void run(Timeout t) throws Exception { | ||
82 | + if (t.isCancelled()) { | ||
83 | + return; | ||
84 | + } | ||
85 | + | ||
86 | + if (!ctx.getChannel().isOpen()) { | ||
87 | + return; | ||
88 | + } | ||
89 | + if (!channelHandler.isHandshakeComplete()) { | ||
90 | + Channels.fireExceptionCaught(ctx, EXCEPTION); | ||
91 | + } | ||
92 | + } | ||
93 | + } | ||
94 | +} |
This diff is collapsed. Click to expand it.
1 | +/** | ||
2 | + * Copyright 2011, Big Switch Networks, Inc. | ||
3 | + * Originally created by David Erickson, Stanford University | ||
4 | + * | ||
5 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
6 | + * not use this file except in compliance with the License. You may obtain | ||
7 | + * a copy of the License at | ||
8 | + * | ||
9 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + * | ||
11 | + * Unless required by applicable law or agreed to in writing, software | ||
12 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
13 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
14 | + * License for the specific language governing permissions and limitations | ||
15 | + * under the License. | ||
16 | + **/ | ||
17 | + | ||
18 | +package net.onrc.onos.of.ctl.internal; | ||
19 | + | ||
20 | + | ||
21 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
22 | +import org.jboss.netty.channel.Channel; | ||
23 | +import org.jboss.netty.channel.ChannelHandlerContext; | ||
24 | +import org.jboss.netty.handler.codec.frame.FrameDecoder; | ||
25 | +import org.projectfloodlight.openflow.protocol.OFFactories; | ||
26 | +import org.projectfloodlight.openflow.protocol.OFMessage; | ||
27 | +import org.projectfloodlight.openflow.protocol.OFMessageReader; | ||
28 | + | ||
29 | +/** | ||
30 | + * Decode an openflow message from a Channel, for use in a netty pipeline. | ||
31 | + */ | ||
32 | +public class OFMessageDecoder extends FrameDecoder { | ||
33 | + | ||
34 | + @Override | ||
35 | + protected Object decode(ChannelHandlerContext ctx, Channel channel, | ||
36 | + ChannelBuffer buffer) throws Exception { | ||
37 | + if (!channel.isConnected()) { | ||
38 | + // In testing, I see decode being called AFTER decode last. | ||
39 | + // This check avoids that from reading corrupted frames | ||
40 | + return null; | ||
41 | + } | ||
42 | + | ||
43 | + // Note that a single call to decode results in reading a single | ||
44 | + // OFMessage from the channel buffer, which is passed on to, and processed | ||
45 | + // by, the controller (in OFChannelHandler). | ||
46 | + // This is different from earlier behavior (with the original openflowj), | ||
47 | + // where we parsed all the messages in the buffer, before passing on | ||
48 | + // a list of the parsed messages to the controller. | ||
49 | + // The performance *may or may not* not be as good as before. | ||
50 | + OFMessageReader<OFMessage> reader = OFFactories.getGenericReader(); | ||
51 | + OFMessage message = reader.readFrom(buffer); | ||
52 | + | ||
53 | + return message; | ||
54 | + } | ||
55 | + | ||
56 | +} |
1 | +/** | ||
2 | + * Copyright 2011, Big Switch Networks, Inc. | ||
3 | + * Originally created by David Erickson, Stanford University | ||
4 | + * | ||
5 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
6 | + * not use this file except in compliance with the License. You may obtain | ||
7 | + * a copy of the License at | ||
8 | + * | ||
9 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + * | ||
11 | + * Unless required by applicable law or agreed to in writing, software | ||
12 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
13 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
14 | + * License for the specific language governing permissions and limitations | ||
15 | + * under the License. | ||
16 | + **/ | ||
17 | + | ||
18 | +package net.onrc.onos.of.ctl.internal; | ||
19 | + | ||
20 | +import java.util.List; | ||
21 | + | ||
22 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
23 | +import org.jboss.netty.buffer.ChannelBuffers; | ||
24 | +import org.jboss.netty.channel.Channel; | ||
25 | +import org.jboss.netty.channel.ChannelHandlerContext; | ||
26 | +import org.jboss.netty.handler.codec.oneone.OneToOneEncoder; | ||
27 | +import org.projectfloodlight.openflow.protocol.OFMessage; | ||
28 | + | ||
29 | + | ||
30 | +/** | ||
31 | + * Encode an openflow message for output into a ChannelBuffer, for use in a | ||
32 | + * netty pipeline. | ||
33 | + */ | ||
34 | +public class OFMessageEncoder extends OneToOneEncoder { | ||
35 | + | ||
36 | + @Override | ||
37 | + protected Object encode(ChannelHandlerContext ctx, Channel channel, | ||
38 | + Object msg) throws Exception { | ||
39 | + if (!(msg instanceof List)) { | ||
40 | + return msg; | ||
41 | + } | ||
42 | + | ||
43 | + @SuppressWarnings("unchecked") | ||
44 | + List<OFMessage> msglist = (List<OFMessage>) msg; | ||
45 | + /* XXX S can't get length of OFMessage in loxigen's openflowj?? | ||
46 | + int size = 0; | ||
47 | + for (OFMessage ofm : msglist) { | ||
48 | + size += ofm.getLengthU(); | ||
49 | + }*/ | ||
50 | + | ||
51 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
52 | + | ||
53 | + for (OFMessage ofm : msglist) { | ||
54 | + ofm.writeTo(buf); | ||
55 | + } | ||
56 | + return buf; | ||
57 | + } | ||
58 | + | ||
59 | +} |
1 | +/** | ||
2 | +* Copyright 2011, Big Switch Networks, Inc. | ||
3 | +* Originally created by David Erickson, Stanford University | ||
4 | +* | ||
5 | +* Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
6 | +* not use this file except in compliance with the License. You may obtain | ||
7 | +* a copy of the License at | ||
8 | +* | ||
9 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | +* | ||
11 | +* Unless required by applicable law or agreed to in writing, software | ||
12 | +* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
13 | +* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
14 | +* License for the specific language governing permissions and limitations | ||
15 | +* under the License. | ||
16 | +**/ | ||
17 | + | ||
18 | +package net.onrc.onos.of.ctl.internal; | ||
19 | + | ||
20 | +import java.util.concurrent.ThreadPoolExecutor; | ||
21 | + | ||
22 | +import org.jboss.netty.channel.ChannelPipeline; | ||
23 | +import org.jboss.netty.channel.ChannelPipelineFactory; | ||
24 | +import org.jboss.netty.channel.Channels; | ||
25 | +import org.jboss.netty.handler.execution.ExecutionHandler; | ||
26 | +import org.jboss.netty.handler.timeout.IdleStateHandler; | ||
27 | +import org.jboss.netty.handler.timeout.ReadTimeoutHandler; | ||
28 | +import org.jboss.netty.util.ExternalResourceReleasable; | ||
29 | +import org.jboss.netty.util.HashedWheelTimer; | ||
30 | +import org.jboss.netty.util.Timer; | ||
31 | + | ||
32 | +/** | ||
33 | + * Creates a ChannelPipeline for a server-side openflow channel. | ||
34 | + */ | ||
35 | +public class OpenflowPipelineFactory | ||
36 | + implements ChannelPipelineFactory, ExternalResourceReleasable { | ||
37 | + | ||
38 | + protected Controller controller; | ||
39 | + protected ThreadPoolExecutor pipelineExecutor; | ||
40 | + protected Timer timer; | ||
41 | + protected IdleStateHandler idleHandler; | ||
42 | + protected ReadTimeoutHandler readTimeoutHandler; | ||
43 | + | ||
44 | + public OpenflowPipelineFactory(Controller controller, | ||
45 | + ThreadPoolExecutor pipelineExecutor) { | ||
46 | + super(); | ||
47 | + this.controller = controller; | ||
48 | + this.pipelineExecutor = pipelineExecutor; | ||
49 | + this.timer = new HashedWheelTimer(); | ||
50 | + this.idleHandler = new IdleStateHandler(timer, 20, 25, 0); | ||
51 | + this.readTimeoutHandler = new ReadTimeoutHandler(timer, 30); | ||
52 | + } | ||
53 | + | ||
54 | + @Override | ||
55 | + public ChannelPipeline getPipeline() throws Exception { | ||
56 | + OFChannelHandler handler = new OFChannelHandler(controller); | ||
57 | + | ||
58 | + ChannelPipeline pipeline = Channels.pipeline(); | ||
59 | + pipeline.addLast("ofmessagedecoder", new OFMessageDecoder()); | ||
60 | + pipeline.addLast("ofmessageencoder", new OFMessageEncoder()); | ||
61 | + pipeline.addLast("idle", idleHandler); | ||
62 | + pipeline.addLast("timeout", readTimeoutHandler); | ||
63 | + // XXX S ONOS: was 15 increased it to fix Issue #296 | ||
64 | + pipeline.addLast("handshaketimeout", | ||
65 | + new HandshakeTimeoutHandler(handler, timer, 60)); | ||
66 | + if (pipelineExecutor != null) { | ||
67 | + pipeline.addLast("pipelineExecutor", | ||
68 | + new ExecutionHandler(pipelineExecutor)); | ||
69 | + } | ||
70 | + pipeline.addLast("handler", handler); | ||
71 | + return pipeline; | ||
72 | + } | ||
73 | + | ||
74 | + @Override | ||
75 | + public void releaseExternalResources() { | ||
76 | + timer.stop(); | ||
77 | + } | ||
78 | +} |
of/ctl/src/main/java/net/onrc/onos/of/ctl/internal/SwitchDriverSubHandshakeAlreadyStarted.java
0 → 100644
1 | +package net.onrc.onos.of.ctl.internal; | ||
2 | + | ||
3 | +/** | ||
4 | + * Thrown when IOFSwitch.startDriverHandshake() is called more than once. | ||
5 | + * | ||
6 | + */ | ||
7 | +public class SwitchDriverSubHandshakeAlreadyStarted extends | ||
8 | + SwitchDriverSubHandshakeException { | ||
9 | + private static final long serialVersionUID = -5491845708752443501L; | ||
10 | + | ||
11 | + public SwitchDriverSubHandshakeAlreadyStarted() { | ||
12 | + super(); | ||
13 | + } | ||
14 | +} |
of/ctl/src/main/java/net/onrc/onos/of/ctl/internal/SwitchDriverSubHandshakeCompleted.java
0 → 100644
1 | +package net.onrc.onos.of.ctl.internal; | ||
2 | + | ||
3 | +import org.projectfloodlight.openflow.protocol.OFMessage; | ||
4 | + | ||
5 | + | ||
6 | +/** | ||
7 | + * Indicates that a message was passed to a switch driver's subhandshake | ||
8 | + * handling code but the driver has already completed the sub-handshake. | ||
9 | + * | ||
10 | + */ | ||
11 | +public class SwitchDriverSubHandshakeCompleted | ||
12 | + extends SwitchDriverSubHandshakeException { | ||
13 | + private static final long serialVersionUID = -8817822245846375995L; | ||
14 | + | ||
15 | + public SwitchDriverSubHandshakeCompleted(OFMessage m) { | ||
16 | + super("Sub-Handshake is already complete but received message " | ||
17 | + + m.getType()); | ||
18 | + } | ||
19 | +} |
of/ctl/src/main/java/net/onrc/onos/of/ctl/internal/SwitchDriverSubHandshakeException.java
0 → 100644
1 | +package net.onrc.onos.of.ctl.internal; | ||
2 | + | ||
3 | +/** | ||
4 | + * Base class for exception thrown by switch driver sub-handshake processing. | ||
5 | + * | ||
6 | + */ | ||
7 | +public class SwitchDriverSubHandshakeException extends RuntimeException { | ||
8 | + private static final long serialVersionUID = -6257836781419604438L; | ||
9 | + | ||
10 | + protected SwitchDriverSubHandshakeException() { | ||
11 | + super(); | ||
12 | + } | ||
13 | + | ||
14 | + protected SwitchDriverSubHandshakeException(String arg0, Throwable arg1) { | ||
15 | + super(arg0, arg1); | ||
16 | + } | ||
17 | + | ||
18 | + protected SwitchDriverSubHandshakeException(String arg0) { | ||
19 | + super(arg0); | ||
20 | + } | ||
21 | + | ||
22 | + protected SwitchDriverSubHandshakeException(Throwable arg0) { | ||
23 | + super(arg0); | ||
24 | + } | ||
25 | + | ||
26 | +} |
of/ctl/src/main/java/net/onrc/onos/of/ctl/internal/SwitchDriverSubHandshakeNotStarted.java
0 → 100644
1 | +package net.onrc.onos.of.ctl.internal; | ||
2 | + | ||
3 | +/** | ||
4 | + * Thrown when a switch driver's sub-handshake has not been started but an | ||
5 | + * operation requiring the sub-handshake has been attempted. | ||
6 | + * | ||
7 | + */ | ||
8 | +public class SwitchDriverSubHandshakeNotStarted extends | ||
9 | + SwitchDriverSubHandshakeException { | ||
10 | + private static final long serialVersionUID = -5491845708752443501L; | ||
11 | + | ||
12 | + public SwitchDriverSubHandshakeNotStarted() { | ||
13 | + super(); | ||
14 | + } | ||
15 | +} |
of/ctl/src/main/java/net/onrc/onos/of/ctl/internal/SwitchDriverSubHandshakeStateException.java
0 → 100644
1 | +package net.onrc.onos.of.ctl.internal; | ||
2 | + | ||
3 | +/** | ||
4 | + * Thrown when a switch driver's sub-handshake state-machine receives an | ||
5 | + * unexpected OFMessage and/or is in an invald state. | ||
6 | + * | ||
7 | + */ | ||
8 | +public class SwitchDriverSubHandshakeStateException extends | ||
9 | + SwitchDriverSubHandshakeException { | ||
10 | + private static final long serialVersionUID = -8249926069195147051L; | ||
11 | + | ||
12 | + public SwitchDriverSubHandshakeStateException(String msg) { | ||
13 | + super(msg); | ||
14 | + } | ||
15 | +} |
1 | +/** | ||
2 | + * Copyright 2011, Big Switch Networks, Inc. | ||
3 | + * Originally created by David Erickson, Stanford University | ||
4 | + * | ||
5 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
6 | + * not use this file except in compliance with the License. You may obtain | ||
7 | + * a copy of the License at | ||
8 | + * | ||
9 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + * | ||
11 | + * Unless required by applicable law or agreed to in writing, software | ||
12 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
13 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
14 | + * License for the specific language governing permissions and limitations | ||
15 | + * under the License. | ||
16 | + **/ | ||
17 | + | ||
18 | +package net.onrc.onos.of.ctl.internal; | ||
19 | + | ||
20 | +/** | ||
21 | + * This exception indicates an error or unexpected message during | ||
22 | + * message handling. E.g., if an OFMessage is received that is illegal or | ||
23 | + * unexpected given the current handshake state. | ||
24 | + * | ||
25 | + * We don't allow wrapping other exception in a switch state exception. We | ||
26 | + * only log the SwitchStateExceptions message so the causing exceptions | ||
27 | + * stack trace is generally not available. | ||
28 | + * | ||
29 | + */ | ||
30 | +public class SwitchStateException extends Exception { | ||
31 | + | ||
32 | + private static final long serialVersionUID = 9153954512470002631L; | ||
33 | + | ||
34 | + public SwitchStateException() { | ||
35 | + super(); | ||
36 | + } | ||
37 | + | ||
38 | + public SwitchStateException(String arg0, Throwable arg1) { | ||
39 | + super(arg0, arg1); | ||
40 | + } | ||
41 | + | ||
42 | + public SwitchStateException(String arg0) { | ||
43 | + super(arg0); | ||
44 | + } | ||
45 | + | ||
46 | + public SwitchStateException(Throwable arg0) { | ||
47 | + super(arg0); | ||
48 | + } | ||
49 | + | ||
50 | +} |
1 | +package net.onrc.onos.of.ctl.registry; | ||
2 | + | ||
3 | + | ||
4 | + | ||
5 | +public class ControllerRegistryEntry implements Comparable<ControllerRegistryEntry> { | ||
6 | + // | ||
7 | + // TODO: Refactor the implementation and decide whether controllerId | ||
8 | + // is needed. If "yes", we might need to consider it inside the | ||
9 | + // compareTo(), equals() and hashCode() implementations. | ||
10 | + // | ||
11 | + private final String controllerId; | ||
12 | + private final int sequenceNumber; | ||
13 | + | ||
14 | + public ControllerRegistryEntry(String controllerId, int sequenceNumber) { | ||
15 | + this.controllerId = controllerId; | ||
16 | + this.sequenceNumber = sequenceNumber; | ||
17 | + } | ||
18 | + | ||
19 | + public String getControllerId() { | ||
20 | + return controllerId; | ||
21 | + } | ||
22 | + | ||
23 | + /** | ||
24 | + * Compares this object with the specified object for order. | ||
25 | + * NOTE: the test is based on ControllerRegistryEntry sequence numbers, | ||
26 | + * and doesn't include the controllerId. | ||
27 | + * | ||
28 | + * @param o the object to be compared. | ||
29 | + * @return a negative integer, zero, or a positive integer as this object | ||
30 | + * is less than, equal to, or greater than the specified object. | ||
31 | + */ | ||
32 | + @Override | ||
33 | + public int compareTo(ControllerRegistryEntry o) { | ||
34 | + return this.sequenceNumber - o.sequenceNumber; | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Test whether some other object is "equal to" this one. | ||
39 | + * NOTE: the test is based on ControllerRegistryEntry sequence numbers, | ||
40 | + * and doesn't include the controllerId. | ||
41 | + * | ||
42 | + * @param obj the reference object with which to compare. | ||
43 | + * @return true if this object is the same as the obj argument; false | ||
44 | + * otherwise. | ||
45 | + */ | ||
46 | + @Override | ||
47 | + public boolean equals(Object obj) { | ||
48 | + if (obj instanceof ControllerRegistryEntry) { | ||
49 | + ControllerRegistryEntry other = (ControllerRegistryEntry) obj; | ||
50 | + return this.sequenceNumber == other.sequenceNumber; | ||
51 | + } | ||
52 | + return false; | ||
53 | + } | ||
54 | + | ||
55 | + /** | ||
56 | + * Get the hash code for the object. | ||
57 | + * NOTE: the computation is based on ControllerRegistryEntry sequence | ||
58 | + * numbers, and doesn't include the controller ID. | ||
59 | + * | ||
60 | + * @return a hash code value for this object. | ||
61 | + */ | ||
62 | + @Override | ||
63 | + public int hashCode() { | ||
64 | + return Integer.valueOf(this.sequenceNumber).hashCode(); | ||
65 | + } | ||
66 | +} |
1 | +package net.onrc.onos.of.ctl.registry; | ||
2 | + | ||
3 | +import java.util.Collection; | ||
4 | +import java.util.List; | ||
5 | +import java.util.Map; | ||
6 | + | ||
7 | +import net.onrc.onos.of.ctl.util.InstanceId; | ||
8 | + | ||
9 | +/** | ||
10 | + * A registry service that allows ONOS to register controllers and switches in a | ||
11 | + * way that is global to the entire ONOS cluster. The registry is the arbiter | ||
12 | + * for allowing controllers to control switches. | ||
13 | + * <p/> | ||
14 | + * The OVS/OF1.{2,3} fault tolerance model is a switch connects to multiple | ||
15 | + * controllers, and the controllers send role requests to tell the switch their | ||
16 | + * role in controlling the switch. | ||
17 | + * <p/> | ||
18 | + * The ONOS fault tolerance model allows only a single controller to have | ||
19 | + * control of a switch (MASTER role) at once. Controllers therefore need a | ||
20 | + * mechanism that enables them to decide who should control a each switch. The | ||
21 | + * registry service provides this mechanism. | ||
22 | + */ | ||
23 | +public interface IControllerRegistry { | ||
24 | + | ||
25 | + /** | ||
26 | + * Callback interface for control change events. | ||
27 | + */ | ||
28 | + public interface ControlChangeCallback { | ||
29 | + /** | ||
30 | + * Called whenever the control changes from the point of view of the | ||
31 | + * registry. The callee can check whether they have control or not using | ||
32 | + * the hasControl parameter. | ||
33 | + * | ||
34 | + * @param dpid The switch that control has changed for | ||
35 | + * @param hasControl Whether the listener now has control or not | ||
36 | + */ | ||
37 | + void controlChanged(long dpid, boolean hasControl); | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * Request for control of a switch. This method does not block. When control | ||
42 | + * for a switch changes, the controlChanged method on the callback object | ||
43 | + * will be called. This happens any time the control changes while the | ||
44 | + * request is still active (until releaseControl is called) | ||
45 | + * | ||
46 | + * @param dpid Switch to request control for | ||
47 | + * @param cb Callback that will be used to notify caller of control changes | ||
48 | + * @throws RegistryException Errors contacting the registry service | ||
49 | + */ | ||
50 | + public void requestControl(long dpid, ControlChangeCallback cb) | ||
51 | + throws RegistryException; | ||
52 | + | ||
53 | + /** | ||
54 | + * Stop trying to take control of a switch. This removes the entry for this | ||
55 | + * controller requesting this switch in the registry. If the controller had | ||
56 | + * control when this is called, another controller will now gain control of | ||
57 | + * the switch. This call doesn't block. | ||
58 | + * | ||
59 | + * @param dpid Switch to release control of | ||
60 | + */ | ||
61 | + public void releaseControl(long dpid); | ||
62 | + | ||
63 | + /** | ||
64 | + * Check whether the controller has control of the switch This call doesn't | ||
65 | + * block. | ||
66 | + * | ||
67 | + * @param dpid Switch to check control of | ||
68 | + * @return true if controller has control of the switch. | ||
69 | + */ | ||
70 | + public boolean hasControl(long dpid); | ||
71 | + | ||
72 | + /** | ||
73 | + * Check whether this instance is the leader for the cluster. This call | ||
74 | + * doesn't block. | ||
75 | + * | ||
76 | + * @return true if the instance is the leader for the cluster, otherwise | ||
77 | + * false. | ||
78 | + */ | ||
79 | + public boolean isClusterLeader(); | ||
80 | + | ||
81 | + /** | ||
82 | + * Gets the unique ID used to identify this ONOS instance in the cluster. | ||
83 | + * | ||
84 | + * @return Instance ID. | ||
85 | + */ | ||
86 | + public InstanceId getOnosInstanceId(); | ||
87 | + | ||
88 | + /** | ||
89 | + * Register a controller to the ONOS cluster. Must be called before the | ||
90 | + * registry can be used to take control of any switches. | ||
91 | + * | ||
92 | + * @param controllerId A unique string ID identifying this controller in the | ||
93 | + * cluster | ||
94 | + * @throws RegistryException for errors connecting to registry service, | ||
95 | + * controllerId already registered | ||
96 | + */ | ||
97 | + public void registerController(String controllerId) | ||
98 | + throws RegistryException; | ||
99 | + | ||
100 | + /** | ||
101 | + * Get all controllers in the cluster. | ||
102 | + * | ||
103 | + * @return Collection of controller IDs | ||
104 | + * @throws RegistryException on error | ||
105 | + */ | ||
106 | + public Collection<String> getAllControllers() throws RegistryException; | ||
107 | + | ||
108 | + /** | ||
109 | + * Get all switches in the cluster, along with which controller is in | ||
110 | + * control of them (if any) and any other controllers that have requested | ||
111 | + * control. | ||
112 | + * | ||
113 | + * @return Map of all switches. | ||
114 | + */ | ||
115 | + public Map<String, List<ControllerRegistryEntry>> getAllSwitches(); | ||
116 | + | ||
117 | + /** | ||
118 | + * Get the controller that has control of a given switch. | ||
119 | + * | ||
120 | + * @param dpid Switch to find controller for | ||
121 | + * @return controller ID | ||
122 | + * @throws RegistryException Errors contacting registry service | ||
123 | + */ | ||
124 | + public String getControllerForSwitch(long dpid) throws RegistryException; | ||
125 | + | ||
126 | + /** | ||
127 | + * Get all switches controlled by a given controller. | ||
128 | + * | ||
129 | + * @param controllerId ID of the controller | ||
130 | + * @return Collection of dpids | ||
131 | + */ | ||
132 | + public Collection<Long> getSwitchesControlledByController(String controllerId); | ||
133 | + | ||
134 | + /** | ||
135 | + * Get a unique Id Block. | ||
136 | + * | ||
137 | + * @return Id Block. | ||
138 | + */ | ||
139 | + public IdBlock allocateUniqueIdBlock(); | ||
140 | + | ||
141 | + /** | ||
142 | + * Get next unique id and retrieve a new range of ids if needed. | ||
143 | + * | ||
144 | + * @param range range to use for the identifier | ||
145 | + * @return Id Block. | ||
146 | + */ | ||
147 | + public IdBlock allocateUniqueIdBlock(long range); | ||
148 | + | ||
149 | + /** | ||
150 | + * Get a globally unique ID. | ||
151 | + * | ||
152 | + * @return a globally unique ID. | ||
153 | + */ | ||
154 | + public long getNextUniqueId(); | ||
155 | +} |
1 | +package net.onrc.onos.of.ctl.registry; | ||
2 | + | ||
3 | +public class IdBlock { | ||
4 | + private final long start; | ||
5 | + private final long end; | ||
6 | + private final long size; | ||
7 | + | ||
8 | + public IdBlock(long start, long end, long size) { | ||
9 | + this.start = start; | ||
10 | + this.end = end; | ||
11 | + this.size = size; | ||
12 | + } | ||
13 | + | ||
14 | + public long getStart() { | ||
15 | + return start; | ||
16 | + } | ||
17 | + | ||
18 | + public long getEnd() { | ||
19 | + return end; | ||
20 | + } | ||
21 | + | ||
22 | + public long getSize() { | ||
23 | + return size; | ||
24 | + } | ||
25 | + | ||
26 | + @Override | ||
27 | + public String toString() { | ||
28 | + return "IdBlock [start=" + start + ", end=" + end + ", size=" + size | ||
29 | + + "]"; | ||
30 | + } | ||
31 | +} | ||
32 | + |
1 | +package net.onrc.onos.of.ctl.registry; | ||
2 | + | ||
3 | +public class RegistryException extends Exception { | ||
4 | + | ||
5 | + private static final long serialVersionUID = -8276300722010217913L; | ||
6 | + | ||
7 | + public RegistryException(String message) { | ||
8 | + super(message); | ||
9 | + } | ||
10 | + | ||
11 | + public RegistryException(String message, Throwable cause) { | ||
12 | + super(message, cause); | ||
13 | + } | ||
14 | + | ||
15 | +} |
1 | +package net.onrc.onos.of.ctl.util; | ||
2 | + | ||
3 | +import org.projectfloodlight.openflow.util.HexString; | ||
4 | + | ||
5 | +/** | ||
6 | + * The class representing a network switch DPID. | ||
7 | + * This class is immutable. | ||
8 | + */ | ||
9 | +public final class Dpid { | ||
10 | + private static final long UNKNOWN = 0; | ||
11 | + private final long value; | ||
12 | + | ||
13 | + /** | ||
14 | + * Default constructor. | ||
15 | + */ | ||
16 | + public Dpid() { | ||
17 | + this.value = Dpid.UNKNOWN; | ||
18 | + } | ||
19 | + | ||
20 | + /** | ||
21 | + * Constructor from a long value. | ||
22 | + * | ||
23 | + * @param value the value to use. | ||
24 | + */ | ||
25 | + public Dpid(long value) { | ||
26 | + this.value = value; | ||
27 | + } | ||
28 | + | ||
29 | + /** | ||
30 | + * Constructor from a string. | ||
31 | + * | ||
32 | + * @param value the value to use. | ||
33 | + */ | ||
34 | + public Dpid(String value) { | ||
35 | + this.value = HexString.toLong(value); | ||
36 | + } | ||
37 | + | ||
38 | + /** | ||
39 | + * Get the value of the DPID. | ||
40 | + * | ||
41 | + * @return the value of the DPID. | ||
42 | + */ | ||
43 | + public long value() { | ||
44 | + return value; | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * Convert the DPID value to a ':' separated hexadecimal string. | ||
49 | + * | ||
50 | + * @return the DPID value as a ':' separated hexadecimal string. | ||
51 | + */ | ||
52 | + @Override | ||
53 | + public String toString() { | ||
54 | + return HexString.toHexString(this.value); | ||
55 | + } | ||
56 | + | ||
57 | + @Override | ||
58 | + public boolean equals(Object other) { | ||
59 | + if (!(other instanceof Dpid)) { | ||
60 | + return false; | ||
61 | + } | ||
62 | + | ||
63 | + Dpid otherDpid = (Dpid) other; | ||
64 | + | ||
65 | + return value == otherDpid.value; | ||
66 | + } | ||
67 | + | ||
68 | + @Override | ||
69 | + public int hashCode() { | ||
70 | + int hash = 17; | ||
71 | + hash += 31 * hash + (int) (value ^ value >>> 32); | ||
72 | + return hash; | ||
73 | + } | ||
74 | +} |
1 | +package net.onrc.onos.of.ctl.util; | ||
2 | + | ||
3 | +import java.io.IOException; | ||
4 | +import java.util.Collection; | ||
5 | +import java.util.Date; | ||
6 | +import java.util.List; | ||
7 | +import java.util.Map; | ||
8 | +import java.util.Set; | ||
9 | +import java.util.concurrent.Future; | ||
10 | + | ||
11 | +import org.jboss.netty.channel.Channel; | ||
12 | +import org.projectfloodlight.openflow.protocol.OFActionType; | ||
13 | +import org.projectfloodlight.openflow.protocol.OFCapabilities; | ||
14 | +import org.projectfloodlight.openflow.protocol.OFDescStatsReply; | ||
15 | +import org.projectfloodlight.openflow.protocol.OFFeaturesReply; | ||
16 | +import org.projectfloodlight.openflow.protocol.OFMessage; | ||
17 | +import org.projectfloodlight.openflow.protocol.OFPortDesc; | ||
18 | +import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply; | ||
19 | +import org.projectfloodlight.openflow.protocol.OFPortStatus; | ||
20 | +import org.projectfloodlight.openflow.protocol.OFStatsReply; | ||
21 | +import org.projectfloodlight.openflow.protocol.OFStatsRequest; | ||
22 | +import org.projectfloodlight.openflow.protocol.OFVersion; | ||
23 | +import org.projectfloodlight.openflow.types.DatapathId; | ||
24 | +import org.projectfloodlight.openflow.types.U64; | ||
25 | +import org.slf4j.Logger; | ||
26 | +import org.slf4j.LoggerFactory; | ||
27 | + | ||
28 | +import net.onrc.onos.of.ctl.IOFSwitch; | ||
29 | +import net.onrc.onos.of.ctl.Role; | ||
30 | +import net.onrc.onos.of.ctl.debugcounter.IDebugCounterService; | ||
31 | +import net.onrc.onos.of.ctl.debugcounter.IDebugCounterService.CounterException; | ||
32 | + | ||
33 | +public class DummySwitchForTesting implements IOFSwitch { | ||
34 | + | ||
35 | + protected static final Logger log = LoggerFactory.getLogger(DummySwitchForTesting.class); | ||
36 | + | ||
37 | + private Channel channel; | ||
38 | + private boolean connected = false; | ||
39 | + private OFVersion ofv = OFVersion.OF_10; | ||
40 | + | ||
41 | + private Collection<OFPortDesc> ports; | ||
42 | + | ||
43 | + private DatapathId datapathId; | ||
44 | + | ||
45 | + private Set<OFCapabilities> capabilities; | ||
46 | + | ||
47 | + private int buffers; | ||
48 | + | ||
49 | + private byte tables; | ||
50 | + | ||
51 | + private String stringId; | ||
52 | + | ||
53 | + private Role role; | ||
54 | + | ||
55 | + @Override | ||
56 | + public void disconnectSwitch() { | ||
57 | + this.channel.close(); | ||
58 | + } | ||
59 | + | ||
60 | + @Override | ||
61 | + public void write(OFMessage m) throws IOException { | ||
62 | + this.channel.write(m); | ||
63 | + | ||
64 | + } | ||
65 | + | ||
66 | + @Override | ||
67 | + public void write(List<OFMessage> msglist) throws IOException { | ||
68 | + for (OFMessage m : msglist) { | ||
69 | + this.channel.write(m); | ||
70 | + } | ||
71 | + | ||
72 | + } | ||
73 | + | ||
74 | + @Override | ||
75 | + public Date getConnectedSince() { | ||
76 | + // TODO Auto-generated method stub | ||
77 | + return null; | ||
78 | + } | ||
79 | + | ||
80 | + @Override | ||
81 | + public int getNextTransactionId() { | ||
82 | + return 0; | ||
83 | + } | ||
84 | + | ||
85 | + @Override | ||
86 | + public boolean isConnected() { | ||
87 | + return this.connected; | ||
88 | + } | ||
89 | + | ||
90 | + @Override | ||
91 | + public void setConnected(boolean connected) { | ||
92 | + this.connected = connected; | ||
93 | + | ||
94 | + } | ||
95 | + | ||
96 | + @Override | ||
97 | + public void flush() { | ||
98 | + // TODO Auto-generated method stub | ||
99 | + | ||
100 | + } | ||
101 | + | ||
102 | + @Override | ||
103 | + public void setChannel(Channel channel) { | ||
104 | + this.channel = channel; | ||
105 | + | ||
106 | + } | ||
107 | + | ||
108 | + @Override | ||
109 | + public long getId() { | ||
110 | + if (this.stringId == null) { | ||
111 | + throw new RuntimeException("Features reply has not yet been set"); | ||
112 | + } | ||
113 | + return this.datapathId.getLong(); | ||
114 | + } | ||
115 | + | ||
116 | + @Override | ||
117 | + public String getStringId() { | ||
118 | + // TODO Auto-generated method stub | ||
119 | + return "DummySwitch"; | ||
120 | + } | ||
121 | + | ||
122 | + @Override | ||
123 | + public int getNumBuffers() { | ||
124 | + // TODO Auto-generated method stub | ||
125 | + return 0; | ||
126 | + } | ||
127 | + | ||
128 | + @Override | ||
129 | + public Set<OFCapabilities> getCapabilities() { | ||
130 | + // TODO Auto-generated method stub | ||
131 | + return null; | ||
132 | + } | ||
133 | + | ||
134 | + @Override | ||
135 | + public byte getNumTables() { | ||
136 | + // TODO Auto-generated method stub | ||
137 | + return 0; | ||
138 | + } | ||
139 | + | ||
140 | + @Override | ||
141 | + public OFDescStatsReply getSwitchDescription() { | ||
142 | + // TODO Auto-generated method stub | ||
143 | + return null; | ||
144 | + } | ||
145 | + | ||
146 | + @Override | ||
147 | + public void cancelFeaturesReply(int transactionId) { | ||
148 | + // TODO Auto-generated method stub | ||
149 | + | ||
150 | + } | ||
151 | + | ||
152 | + @Override | ||
153 | + public Set<OFActionType> getActions() { | ||
154 | + // TODO Auto-generated method stub | ||
155 | + return null; | ||
156 | + } | ||
157 | + | ||
158 | + @Override | ||
159 | + public void setOFVersion(OFVersion version) { | ||
160 | + // TODO Auto-generated method stub | ||
161 | + | ||
162 | + } | ||
163 | + | ||
164 | + @Override | ||
165 | + public OFVersion getOFVersion() { | ||
166 | + return this.ofv; | ||
167 | + } | ||
168 | + | ||
169 | + @Override | ||
170 | + public Collection<OFPortDesc> getEnabledPorts() { | ||
171 | + // TODO Auto-generated method stub | ||
172 | + return null; | ||
173 | + } | ||
174 | + | ||
175 | + @Override | ||
176 | + public Collection<Integer> getEnabledPortNumbers() { | ||
177 | + // TODO Auto-generated method stub | ||
178 | + return null; | ||
179 | + } | ||
180 | + | ||
181 | + @Override | ||
182 | + public OFPortDesc getPort(int portNumber) { | ||
183 | + // TODO Auto-generated method stub | ||
184 | + return null; | ||
185 | + } | ||
186 | + | ||
187 | + @Override | ||
188 | + public OFPortDesc getPort(String portName) { | ||
189 | + // TODO Auto-generated method stub | ||
190 | + return null; | ||
191 | + } | ||
192 | + | ||
193 | + @Override | ||
194 | + public OrderedCollection<PortChangeEvent> processOFPortStatus( | ||
195 | + OFPortStatus ps) { | ||
196 | + // TODO Auto-generated method stub | ||
197 | + return null; | ||
198 | + } | ||
199 | + | ||
200 | + @Override | ||
201 | + public Collection<OFPortDesc> getPorts() { | ||
202 | + return ports; | ||
203 | + } | ||
204 | + | ||
205 | + @Override | ||
206 | + public boolean portEnabled(int portName) { | ||
207 | + // TODO Auto-generated method stub | ||
208 | + return false; | ||
209 | + } | ||
210 | + | ||
211 | + @Override | ||
212 | + public OrderedCollection<PortChangeEvent> setPorts( | ||
213 | + Collection<OFPortDesc> p) { | ||
214 | + this.ports = p; | ||
215 | + return null; | ||
216 | + } | ||
217 | + | ||
218 | + @Override | ||
219 | + public Map<Object, Object> getAttributes() { | ||
220 | + return null; | ||
221 | + } | ||
222 | + | ||
223 | + @Override | ||
224 | + public boolean hasAttribute(String name) { | ||
225 | + // TODO Auto-generated method stub | ||
226 | + return false; | ||
227 | + } | ||
228 | + | ||
229 | + @Override | ||
230 | + public Object getAttribute(String name) { | ||
231 | + return Boolean.FALSE; | ||
232 | + } | ||
233 | + | ||
234 | + @Override | ||
235 | + public void setAttribute(String name, Object value) { | ||
236 | + // TODO Auto-generated method stub | ||
237 | + | ||
238 | + } | ||
239 | + | ||
240 | + @Override | ||
241 | + public Object removeAttribute(String name) { | ||
242 | + // TODO Auto-generated method stub | ||
243 | + return null; | ||
244 | + } | ||
245 | + | ||
246 | + @Override | ||
247 | + public void deliverStatisticsReply(OFMessage reply) { | ||
248 | + // TODO Auto-generated method stub | ||
249 | + | ||
250 | + } | ||
251 | + | ||
252 | + @Override | ||
253 | + public void cancelStatisticsReply(int transactionId) { | ||
254 | + // TODO Auto-generated method stub | ||
255 | + | ||
256 | + } | ||
257 | + | ||
258 | + @Override | ||
259 | + public void cancelAllStatisticsReplies() { | ||
260 | + // TODO Auto-generated method stub | ||
261 | + | ||
262 | + } | ||
263 | + | ||
264 | + @Override | ||
265 | + public Future<List<OFStatsReply>> getStatistics(OFStatsRequest<?> request) | ||
266 | + throws IOException { | ||
267 | + // TODO Auto-generated method stub | ||
268 | + return null; | ||
269 | + } | ||
270 | + | ||
271 | + @Override | ||
272 | + public void clearAllFlowMods() { | ||
273 | + // TODO Auto-generated method stub | ||
274 | + | ||
275 | + } | ||
276 | + | ||
277 | + @Override | ||
278 | + public Role getRole() { | ||
279 | + return this.role; | ||
280 | + } | ||
281 | + | ||
282 | + @Override | ||
283 | + public void setRole(Role role) { | ||
284 | + this.role = role; | ||
285 | + } | ||
286 | + | ||
287 | + @Override | ||
288 | + public U64 getNextGenerationId() { | ||
289 | + // TODO Auto-generated method stub | ||
290 | + return null; | ||
291 | + } | ||
292 | + | ||
293 | + @Override | ||
294 | + public void setDebugCounterService(IDebugCounterService debugCounter) | ||
295 | + throws CounterException { | ||
296 | + // TODO Auto-generated method stub | ||
297 | + | ||
298 | + } | ||
299 | + | ||
300 | + @Override | ||
301 | + public void startDriverHandshake() throws IOException { | ||
302 | + // TODO Auto-generated method stub | ||
303 | + | ||
304 | + } | ||
305 | + | ||
306 | + @Override | ||
307 | + public boolean isDriverHandshakeComplete() { | ||
308 | + return true; | ||
309 | + } | ||
310 | + | ||
311 | + @Override | ||
312 | + public void processDriverHandshakeMessage(OFMessage m) { | ||
313 | + | ||
314 | + } | ||
315 | + | ||
316 | + @Override | ||
317 | + public void setTableFull(boolean isFull) { | ||
318 | + // TODO Auto-generated method stub | ||
319 | + | ||
320 | + } | ||
321 | + | ||
322 | + @Override | ||
323 | + public void setFeaturesReply(OFFeaturesReply featuresReply) { | ||
324 | + if (featuresReply == null) { | ||
325 | + log.error("Error setting featuresReply for switch: {}", getStringId()); | ||
326 | + return; | ||
327 | + } | ||
328 | + this.datapathId = featuresReply.getDatapathId(); | ||
329 | + this.capabilities = featuresReply.getCapabilities(); | ||
330 | + this.buffers = (int) featuresReply.getNBuffers(); | ||
331 | + this.tables = (byte) featuresReply.getNTables(); | ||
332 | + this.stringId = this.datapathId.toString(); | ||
333 | + | ||
334 | + } | ||
335 | + | ||
336 | + @Override | ||
337 | + public void setPortDescReply(OFPortDescStatsReply portDescReply) { | ||
338 | + // TODO Auto-generated method stub | ||
339 | + | ||
340 | + } | ||
341 | + | ||
342 | + @Override | ||
343 | + public void handleMessage(OFMessage m) { | ||
344 | + log.info("Got packet {} but I am dumb so I don't know what to do.", m); | ||
345 | + } | ||
346 | + | ||
347 | + @Override | ||
348 | + public boolean portEnabled(String portName) { | ||
349 | + // TODO Auto-generated method stub | ||
350 | + return false; | ||
351 | + } | ||
352 | + | ||
353 | + @Override | ||
354 | + public OrderedCollection<PortChangeEvent> comparePorts( | ||
355 | + Collection<OFPortDesc> p) { | ||
356 | + // TODO Auto-generated method stub | ||
357 | + return null; | ||
358 | + } | ||
359 | + | ||
360 | +} |
1 | +package net.onrc.onos.of.ctl.util; | ||
2 | + | ||
3 | +import java.util.EnumSet; | ||
4 | +import java.util.Set; | ||
5 | + | ||
6 | +/** | ||
7 | + * A utility class to convert between integer based bitmaps for (OpenFlow) | ||
8 | + * flags and Enum and EnumSet based representations. | ||
9 | + * | ||
10 | + * The enum used to represent individual flags needs to implement the | ||
11 | + * BitmapableEnum interface. | ||
12 | + * | ||
13 | + * Example: | ||
14 | + * {@code | ||
15 | + * int bitmap = 0x11; // OFPPC_PORT_DOWN | OFPPC_NO_STP | ||
16 | + * EnumSet<OFPortConfig> s = toEnumSet(OFPortConfig.class, bitmap); | ||
17 | + * // s will contain OFPPC_PORT_DOWN and OFPPC_NO_STP | ||
18 | + * } | ||
19 | + * | ||
20 | + * {@code | ||
21 | + * EnumSet<OFPortConfig> s = EnumSet.of(OFPPC_NO_STP, OFPPC_PORT_DOWN); | ||
22 | + * int bitmap = toBitmap(s); // returns 0x11 | ||
23 | + * } | ||
24 | + * | ||
25 | + */ | ||
26 | +public final class EnumBitmaps { | ||
27 | + | ||
28 | + | ||
29 | + private EnumBitmaps() { } | ||
30 | + | ||
31 | + /** | ||
32 | + * Enums used to represent individual flags needs to implement this | ||
33 | + * interface. | ||
34 | + */ | ||
35 | + public interface BitmapableEnum { | ||
36 | + /** Return the value in the bitmap that the enum constant represents. | ||
37 | + * The returned value must have only a single bit set. E.g.,1 << 3 | ||
38 | + */ | ||
39 | + int getValue(); | ||
40 | + } | ||
41 | + | ||
42 | + | ||
43 | + /** | ||
44 | + * Convert an integer bitmap to an EnumSet. | ||
45 | + * | ||
46 | + * See class description for example | ||
47 | + * @param type The Enum class to use. Must implement BitmapableEnum | ||
48 | + * @param bitmap The integer bitmap | ||
49 | + * @return A newly allocated EnumSet representing the bits set in the | ||
50 | + * bitmap | ||
51 | + * @throws NullPointerException if type is null | ||
52 | + * @throws IllegalArgumentException if any enum constant from type has | ||
53 | + * more than one bit set. | ||
54 | + * @throws IllegalArgumentException if the bitmap has any bits set not | ||
55 | + * represented by an enum constant. | ||
56 | + */ | ||
57 | + public static <E extends Enum<E> & BitmapableEnum> | ||
58 | + EnumSet<E> toEnumSet(Class<E> type, int bitmap) { | ||
59 | + if (type == null) { | ||
60 | + throw new NullPointerException("Given enum type must not be null"); | ||
61 | + } | ||
62 | + EnumSet<E> s = EnumSet.noneOf(type); | ||
63 | + // allSetBitmap will eventually have all valid bits for the given | ||
64 | + // type set. | ||
65 | + int allSetBitmap = 0; | ||
66 | + for (E element: type.getEnumConstants()) { | ||
67 | + if (Integer.bitCount(element.getValue()) != 1) { | ||
68 | + String msg = String.format("The %s (%x) constant of the " + | ||
69 | + "enum %s is supposed to represent a bitmap entry but " + | ||
70 | + "has more than one bit set.", | ||
71 | + element.toString(), element.getValue(), type.getName()); | ||
72 | + throw new IllegalArgumentException(msg); | ||
73 | + } | ||
74 | + allSetBitmap |= element.getValue(); | ||
75 | + if ((bitmap & element.getValue()) != 0) { | ||
76 | + s.add(element); | ||
77 | + } | ||
78 | + } | ||
79 | + if (((~allSetBitmap) & bitmap) != 0) { | ||
80 | + // check if only valid flags are set in the given bitmap | ||
81 | + String msg = String.format("The bitmap %x for enum %s has " + | ||
82 | + "bits set that are presented by any enum constant", | ||
83 | + bitmap, type.getName()); | ||
84 | + throw new IllegalArgumentException(msg); | ||
85 | + } | ||
86 | + return s; | ||
87 | + } | ||
88 | + | ||
89 | + /** | ||
90 | + * Return the bitmap mask with all possible bits set. E.g., If a bitmap | ||
91 | + * has the individual flags 0x1, 0x2, and 0x8 (note the missing 0x4) then | ||
92 | + * the mask will be 0xb (1011 binary) | ||
93 | + * | ||
94 | + * @param type The Enum class to use. Must implement BitmapableEnum | ||
95 | + * @throws NullPointerException if type is null | ||
96 | + * @throws IllegalArgumentException if any enum constant from type has | ||
97 | + * more than one bit set | ||
98 | + * @return an integer with all possible bits for the given bitmap enum | ||
99 | + * type set. | ||
100 | + */ | ||
101 | + public static <E extends Enum<E> & BitmapableEnum> | ||
102 | + int getMask(Class<E> type) { | ||
103 | + if (type == null) { | ||
104 | + throw new NullPointerException("Given enum type must not be null"); | ||
105 | + } | ||
106 | + // allSetBitmap will eventually have all valid bits for the given | ||
107 | + // type set. | ||
108 | + int allSetBitmap = 0; | ||
109 | + for (E element: type.getEnumConstants()) { | ||
110 | + if (Integer.bitCount(element.getValue()) != 1) { | ||
111 | + String msg = String.format("The %s (%x) constant of the " + | ||
112 | + "enum %s is supposed to represent a bitmap entry but " + | ||
113 | + "has more than one bit set.", | ||
114 | + element.toString(), element.getValue(), type.getName()); | ||
115 | + throw new IllegalArgumentException(msg); | ||
116 | + } | ||
117 | + allSetBitmap |= element.getValue(); | ||
118 | + } | ||
119 | + return allSetBitmap; | ||
120 | + } | ||
121 | + | ||
122 | + /** | ||
123 | + * Convert the given EnumSet to the integer bitmap representation. | ||
124 | + * @param set The EnumSet to convert. The enum must implement | ||
125 | + * BitmapableEnum | ||
126 | + * @return the integer bitmap | ||
127 | + * @throws IllegalArgumentException if an enum constant from the set (!) has | ||
128 | + * more than one bit set | ||
129 | + * @throws NullPointerException if the set is null | ||
130 | + */ | ||
131 | + public static <E extends Enum<E> & BitmapableEnum> | ||
132 | + int toBitmap(Set<E> set) { | ||
133 | + if (set == null) { | ||
134 | + throw new NullPointerException("Given set must not be null"); | ||
135 | + } | ||
136 | + int bitmap = 0; | ||
137 | + for (E element: set) { | ||
138 | + if (Integer.bitCount(element.getValue()) != 1) { | ||
139 | + String msg = String.format("The %s (%x) constant in the set " + | ||
140 | + "is supposed to represent a bitmap entry but " + | ||
141 | + "has more than one bit set.", | ||
142 | + element.toString(), element.getValue()); | ||
143 | + throw new IllegalArgumentException(msg); | ||
144 | + } | ||
145 | + bitmap |= element.getValue(); | ||
146 | + } | ||
147 | + return bitmap; | ||
148 | + } | ||
149 | +} |
1 | +/** | ||
2 | + * Copyright 2012, Big Switch Networks, Inc. | ||
3 | + * Originally created by David Erickson, Stanford University | ||
4 | + * | ||
5 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
6 | + * not use this file except in compliance with the License. You may obtain | ||
7 | + * a copy of the License at | ||
8 | + * | ||
9 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + * | ||
11 | + * Unless required by applicable law or agreed to in writing, software | ||
12 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
13 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
14 | + * License for the specific language governing permissions and limitations | ||
15 | + * under the License. | ||
16 | + **/ | ||
17 | + | ||
18 | +package net.onrc.onos.of.ctl.util; | ||
19 | + | ||
20 | +import java.util.Iterator; | ||
21 | +import java.util.NoSuchElementException; | ||
22 | + | ||
23 | +/** | ||
24 | + * An iterator that will filter values from an iterator and return only | ||
25 | + * those values that match the predicate. | ||
26 | + */ | ||
27 | +public abstract class FilterIterator<T> implements Iterator<T> { | ||
28 | + protected Iterator<T> subIterator; | ||
29 | + protected T next; | ||
30 | + | ||
31 | + /** | ||
32 | + * Construct a filter iterator from the given sub iterator. | ||
33 | + * | ||
34 | + * @param subIterator the sub iterator over which we'll filter | ||
35 | + */ | ||
36 | + public FilterIterator(Iterator<T> subIterator) { | ||
37 | + super(); | ||
38 | + this.subIterator = subIterator; | ||
39 | + } | ||
40 | + | ||
41 | + /** | ||
42 | + * Check whether the given value should be returned by the | ||
43 | + * filter. | ||
44 | + * | ||
45 | + * @param value the value to check | ||
46 | + * @return true if the value should be included | ||
47 | + */ | ||
48 | + protected abstract boolean matches(T value); | ||
49 | + | ||
50 | + // *********** | ||
51 | + // Iterator<T> | ||
52 | + // *********** | ||
53 | + | ||
54 | + @Override | ||
55 | + public boolean hasNext() { | ||
56 | + if (next != null) { | ||
57 | + return true; | ||
58 | + } | ||
59 | + | ||
60 | + while (subIterator.hasNext()) { | ||
61 | + next = subIterator.next(); | ||
62 | + if (matches(next)) { | ||
63 | + return true; | ||
64 | + } | ||
65 | + } | ||
66 | + next = null; | ||
67 | + return false; | ||
68 | + } | ||
69 | + | ||
70 | + @Override | ||
71 | + public T next() { | ||
72 | + if (hasNext()) { | ||
73 | + T cur = next; | ||
74 | + next = null; | ||
75 | + return cur; | ||
76 | + } | ||
77 | + throw new NoSuchElementException(); | ||
78 | + } | ||
79 | + | ||
80 | + @Override | ||
81 | + public void remove() { | ||
82 | + throw new UnsupportedOperationException(); | ||
83 | + } | ||
84 | + | ||
85 | +} |
1 | +package net.onrc.onos.of.ctl.util; | ||
2 | + | ||
3 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
4 | +import static com.google.common.base.Preconditions.checkArgument; | ||
5 | + | ||
6 | +/** | ||
7 | + * The class representing an ONOS Instance ID. | ||
8 | + * | ||
9 | + * This class is immutable. | ||
10 | + */ | ||
11 | +public final class InstanceId { | ||
12 | + private final String id; | ||
13 | + | ||
14 | + /** | ||
15 | + * Constructor from a string value. | ||
16 | + * | ||
17 | + * @param id the value to use. | ||
18 | + */ | ||
19 | + public InstanceId(String id) { | ||
20 | + this.id = checkNotNull(id); | ||
21 | + checkArgument(!id.isEmpty(), "Empty ONOS Instance ID"); | ||
22 | + } | ||
23 | + | ||
24 | + @Override | ||
25 | + public int hashCode() { | ||
26 | + return id.hashCode(); | ||
27 | + } | ||
28 | + | ||
29 | + @Override | ||
30 | + public boolean equals(Object obj) { | ||
31 | + if (obj == this) { | ||
32 | + return true; | ||
33 | + } | ||
34 | + | ||
35 | + if (!(obj instanceof InstanceId)) { | ||
36 | + return false; | ||
37 | + } | ||
38 | + | ||
39 | + InstanceId that = (InstanceId) obj; | ||
40 | + return this.id.equals(that.id); | ||
41 | + } | ||
42 | + | ||
43 | + @Override | ||
44 | + public String toString() { | ||
45 | + return id; | ||
46 | + } | ||
47 | +} |
1 | +/** | ||
2 | + * Copyright 2012 Big Switch Networks, Inc. | ||
3 | + * Originally created by David Erickson, Stanford University | ||
4 | + * | ||
5 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
6 | + * not use this file except in compliance with the License. You may obtain | ||
7 | + * a copy of the License at | ||
8 | + * | ||
9 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + * | ||
11 | + * Unless required by applicable law or agreed to in writing, software | ||
12 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
13 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
14 | + * License for the specific language governing permissions and limitations | ||
15 | + * under the License. | ||
16 | + **/ | ||
17 | + | ||
18 | +package net.onrc.onos.of.ctl.util; | ||
19 | + | ||
20 | +import java.util.Iterator; | ||
21 | +import java.util.NoSuchElementException; | ||
22 | + | ||
23 | +/** | ||
24 | + * Iterator over all values in an iterator of iterators. | ||
25 | + * | ||
26 | + * @param <T> the type of elements returned by this iterator | ||
27 | + */ | ||
28 | +public class IterableIterator<T> implements Iterator<T> { | ||
29 | + Iterator<? extends Iterable<T>> subIterator; | ||
30 | + Iterator<T> current = null; | ||
31 | + | ||
32 | + public IterableIterator(Iterator<? extends Iterable<T>> subIterator) { | ||
33 | + super(); | ||
34 | + this.subIterator = subIterator; | ||
35 | + } | ||
36 | + | ||
37 | + @Override | ||
38 | + public boolean hasNext() { | ||
39 | + if (current == null) { | ||
40 | + if (subIterator.hasNext()) { | ||
41 | + current = subIterator.next().iterator(); | ||
42 | + } else { | ||
43 | + return false; | ||
44 | + } | ||
45 | + } | ||
46 | + while (!current.hasNext() && subIterator.hasNext()) { | ||
47 | + current = subIterator.next().iterator(); | ||
48 | + } | ||
49 | + | ||
50 | + return current.hasNext(); | ||
51 | + } | ||
52 | + | ||
53 | + @Override | ||
54 | + public T next() { | ||
55 | + if (hasNext()) { | ||
56 | + return current.next(); | ||
57 | + } | ||
58 | + throw new NoSuchElementException(); | ||
59 | + } | ||
60 | + | ||
61 | + @Override | ||
62 | + public void remove() { | ||
63 | + if (hasNext()) { | ||
64 | + current.remove(); | ||
65 | + } | ||
66 | + throw new NoSuchElementException(); | ||
67 | + } | ||
68 | +} |
1 | +/** | ||
2 | + * Copyright 2011, Big Switch Networks, Inc. | ||
3 | + * Originally created by David Erickson, Stanford University | ||
4 | + * | ||
5 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
6 | + * not use this file except in compliance with the License. You may obtain | ||
7 | + * a copy of the License at | ||
8 | + * | ||
9 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + * | ||
11 | + * Unless required by applicable law or agreed to in writing, software | ||
12 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
13 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
14 | + * License for the specific language governing permissions and limitations | ||
15 | + * under the License. | ||
16 | + **/ | ||
17 | + | ||
18 | +package net.onrc.onos.of.ctl.util; | ||
19 | + | ||
20 | +import java.util.LinkedHashMap; | ||
21 | +import java.util.Map; | ||
22 | + | ||
23 | +public class LRUHashMap<K, V> extends LinkedHashMap<K, V> { | ||
24 | + | ||
25 | + private static final long serialVersionUID = 1L; | ||
26 | + | ||
27 | + private final int capacity; | ||
28 | + | ||
29 | + public LRUHashMap(int capacity) { | ||
30 | + super(capacity + 1, 0.75f, true); | ||
31 | + this.capacity = capacity; | ||
32 | + } | ||
33 | + | ||
34 | + protected boolean removeEldestEntry(Map.Entry<K, V> eldest) { | ||
35 | + return size() > capacity; | ||
36 | + } | ||
37 | + | ||
38 | +} |
1 | +package net.onrc.onos.of.ctl.util; | ||
2 | + | ||
3 | +import java.util.Collection; | ||
4 | +import java.util.LinkedHashSet; | ||
5 | + | ||
6 | +import com.google.common.collect.ForwardingCollection; | ||
7 | + | ||
8 | +/** | ||
9 | + * A simple wrapper / forwarder that forwards all calls to a LinkedHashSet. | ||
10 | + * This wrappers sole reason for existence is to implement the | ||
11 | + * OrderedCollection marker interface. | ||
12 | + * | ||
13 | + */ | ||
14 | +public class LinkedHashSetWrapper<E> | ||
15 | + extends ForwardingCollection<E> implements OrderedCollection<E> { | ||
16 | + private final Collection<E> delegate; | ||
17 | + | ||
18 | + public LinkedHashSetWrapper() { | ||
19 | + super(); | ||
20 | + this.delegate = new LinkedHashSet<E>(); | ||
21 | + } | ||
22 | + | ||
23 | + public LinkedHashSetWrapper(Collection<? extends E> c) { | ||
24 | + super(); | ||
25 | + this.delegate = new LinkedHashSet<E>(c); | ||
26 | + } | ||
27 | + | ||
28 | + @Override | ||
29 | + protected Collection<E> delegate() { | ||
30 | + return this.delegate; | ||
31 | + } | ||
32 | +} |
1 | +/** | ||
2 | + * Copyright 2012 Big Switch Networks, Inc. | ||
3 | + * Originally created by David Erickson, Stanford University | ||
4 | + * | ||
5 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
6 | + * not use this file except in compliance with the License. You may obtain | ||
7 | + * a copy of the License at | ||
8 | + * | ||
9 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + * | ||
11 | + * Unless required by applicable law or agreed to in writing, software | ||
12 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
13 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
14 | + * License for the specific language governing permissions and limitations | ||
15 | + * under the License. | ||
16 | + **/ | ||
17 | + | ||
18 | +package net.onrc.onos.of.ctl.util; | ||
19 | + | ||
20 | +import java.util.Iterator; | ||
21 | +import java.util.NoSuchElementException; | ||
22 | + | ||
23 | +/** | ||
24 | + * Iterator over all values in an iterator of iterators. | ||
25 | + * | ||
26 | + * @param <T> the type of elements returned by this iterator | ||
27 | + */ | ||
28 | +public class MultiIterator<T> implements Iterator<T> { | ||
29 | + Iterator<Iterator<T>> subIterator; | ||
30 | + Iterator<T> current = null; | ||
31 | + | ||
32 | + public MultiIterator(Iterator<Iterator<T>> subIterator) { | ||
33 | + super(); | ||
34 | + this.subIterator = subIterator; | ||
35 | + } | ||
36 | + | ||
37 | + @Override | ||
38 | + public boolean hasNext() { | ||
39 | + if (current == null) { | ||
40 | + if (subIterator.hasNext()) { | ||
41 | + current = subIterator.next(); | ||
42 | + } else { | ||
43 | + return false; | ||
44 | + } | ||
45 | + } | ||
46 | + while (!current.hasNext() && subIterator.hasNext()) { | ||
47 | + current = subIterator.next(); | ||
48 | + } | ||
49 | + | ||
50 | + return current.hasNext(); | ||
51 | + } | ||
52 | + | ||
53 | + @Override | ||
54 | + public T next() { | ||
55 | + if (hasNext()) { | ||
56 | + return current.next(); | ||
57 | + } | ||
58 | + throw new NoSuchElementException(); | ||
59 | + } | ||
60 | + | ||
61 | + @Override | ||
62 | + public void remove() { | ||
63 | + if (hasNext()) { | ||
64 | + current.remove(); | ||
65 | + } | ||
66 | + throw new NoSuchElementException(); | ||
67 | + } | ||
68 | +} |
1 | +package net.onrc.onos.of.ctl.util; | ||
2 | + | ||
3 | +import java.util.Collection; | ||
4 | + | ||
5 | +/** | ||
6 | + * A marker interface indicating that this Collection defines a particular | ||
7 | + * iteration order. The details about the iteration order are specified by | ||
8 | + * the concrete implementation. | ||
9 | + * | ||
10 | + * @param <E> | ||
11 | + */ | ||
12 | +public interface OrderedCollection<E> extends Collection<E> { | ||
13 | + | ||
14 | +} |
of/lib/pom.xml
0 → 100644
This diff is collapsed. Click to expand it.
1 | +package org.projectfloodlight.openflow.annotations; | ||
2 | + | ||
3 | +/** | ||
4 | + * This annotation marks a class that is considered externally immutable. I.e., | ||
5 | + * the externally visible state of the class will not change after its | ||
6 | + * construction. Such a class can be freely shared between threads and does not | ||
7 | + * require defensive copying (don't call clone). | ||
8 | + * | ||
9 | + * @author Andreas Wundsam <andreas.wundsam@bigswitch.com> | ||
10 | + */ | ||
11 | +public @interface Immutable { | ||
12 | + | ||
13 | +} |
1 | +package org.projectfloodlight.openflow.exceptions; | ||
2 | + | ||
3 | +/** | ||
4 | + * Error: someone asked to create an OFMessage with wireformat type and version, | ||
5 | + * but that doesn't exist | ||
6 | + * | ||
7 | + * @author capveg | ||
8 | + */ | ||
9 | +public class NonExistantMessage extends Exception { | ||
10 | + | ||
11 | + private static final long serialVersionUID = 1L; | ||
12 | + byte type; | ||
13 | + byte version; | ||
14 | + | ||
15 | + /** | ||
16 | + * Error: someone asked to create an OFMessage with wireformat type and | ||
17 | + * version, but that doesn't exist | ||
18 | + * | ||
19 | + * @param type | ||
20 | + * the wire format | ||
21 | + * @param version | ||
22 | + * the OpenFlow wireformat version number, e.g. 1 == v1.1, 2 = | ||
23 | + * v1.2, etc. | ||
24 | + */ | ||
25 | + public NonExistantMessage(final byte type, final byte version) { | ||
26 | + this.type = type; | ||
27 | + this.version = version; | ||
28 | + } | ||
29 | + | ||
30 | +} |
1 | +package org.projectfloodlight.openflow.exceptions; | ||
2 | + | ||
3 | +public class OFParseError extends Exception { | ||
4 | + private static final long serialVersionUID = 1L; | ||
5 | + | ||
6 | + public OFParseError() { | ||
7 | + super(); | ||
8 | + } | ||
9 | + | ||
10 | + public OFParseError(final String message, final Throwable cause) { | ||
11 | + super(message, cause); | ||
12 | + } | ||
13 | + | ||
14 | + public OFParseError(final String message) { | ||
15 | + super(message); | ||
16 | + } | ||
17 | + | ||
18 | + public OFParseError(final Throwable cause) { | ||
19 | + super(cause); | ||
20 | + } | ||
21 | + | ||
22 | +} |
1 | +package org.projectfloodlight.openflow.protocol; | ||
2 | + | ||
3 | +import org.projectfloodlight.openflow.types.PrimitiveSinkable; | ||
4 | + | ||
5 | +import com.google.common.hash.PrimitiveSink; | ||
6 | + | ||
7 | +public class OFMatchBmap implements PrimitiveSinkable{ | ||
8 | + | ||
9 | + @Override | ||
10 | + public void putTo(PrimitiveSink sink) { | ||
11 | + } | ||
12 | + | ||
13 | +} |
1 | +package org.projectfloodlight.openflow.protocol; | ||
2 | + | ||
3 | +import org.projectfloodlight.openflow.types.PrimitiveSinkable; | ||
4 | + | ||
5 | + | ||
6 | +/** | ||
7 | + * Base interface of all OpenFlow objects (e.g., messages, actions, stats, etc.) | ||
8 | + */ | ||
9 | +public interface OFObject extends Writeable, PrimitiveSinkable { | ||
10 | + OFVersion getVersion(); | ||
11 | +} |
1 | +package org.projectfloodlight.openflow.protocol; | ||
2 | + | ||
3 | +import java.util.EnumMap; | ||
4 | +import java.util.Iterator; | ||
5 | +import java.util.Map; | ||
6 | + | ||
7 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
8 | +import org.projectfloodlight.openflow.exceptions.OFParseError; | ||
9 | +import org.projectfloodlight.openflow.protocol.match.MatchField; | ||
10 | +import org.projectfloodlight.openflow.protocol.match.MatchFields; | ||
11 | +import org.projectfloodlight.openflow.protocol.oxm.OFOxm; | ||
12 | +import org.projectfloodlight.openflow.types.OFValueType; | ||
13 | +import org.projectfloodlight.openflow.types.PrimitiveSinkable; | ||
14 | +import org.projectfloodlight.openflow.util.ChannelUtils; | ||
15 | +import org.slf4j.Logger; | ||
16 | +import org.slf4j.LoggerFactory; | ||
17 | + | ||
18 | +import com.google.common.base.Objects; | ||
19 | +import com.google.common.collect.ImmutableMap; | ||
20 | +import com.google.common.hash.PrimitiveSink; | ||
21 | + | ||
22 | +public class OFOxmList implements Iterable<OFOxm<?>>, Writeable, PrimitiveSinkable { | ||
23 | + private static final Logger logger = LoggerFactory.getLogger(OFOxmList.class); | ||
24 | + | ||
25 | + private final Map<MatchFields, OFOxm<?>> oxmMap; | ||
26 | + | ||
27 | + public final static OFOxmList EMPTY = new OFOxmList(ImmutableMap.<MatchFields, OFOxm<?>>of()); | ||
28 | + | ||
29 | + private OFOxmList(Map<MatchFields, OFOxm<?>> oxmMap) { | ||
30 | + this.oxmMap = oxmMap; | ||
31 | + } | ||
32 | + | ||
33 | + @SuppressWarnings("unchecked") | ||
34 | + public <T extends OFValueType<T>> OFOxm<T> get(MatchField<T> matchField) { | ||
35 | + return (OFOxm<T>) oxmMap.get(matchField.id); | ||
36 | + } | ||
37 | + | ||
38 | + public static class Builder { | ||
39 | + private final Map<MatchFields, OFOxm<?>> oxmMap; | ||
40 | + | ||
41 | + public Builder() { | ||
42 | + oxmMap = new EnumMap<MatchFields, OFOxm<?>>(MatchFields.class); | ||
43 | + } | ||
44 | + | ||
45 | + public Builder(EnumMap<MatchFields, OFOxm<?>> oxmMap) { | ||
46 | + this.oxmMap = oxmMap; | ||
47 | + } | ||
48 | + | ||
49 | + public <T extends OFValueType<T>> void set(OFOxm<T> oxm) { | ||
50 | + oxmMap.put(oxm.getMatchField().id, oxm); | ||
51 | + } | ||
52 | + | ||
53 | + public <T extends OFValueType<T>> void unset(MatchField<T> matchField) { | ||
54 | + oxmMap.remove(matchField.id); | ||
55 | + } | ||
56 | + | ||
57 | + public OFOxmList build() { | ||
58 | + return OFOxmList.ofList(oxmMap.values()); | ||
59 | + } | ||
60 | + } | ||
61 | + | ||
62 | + @Override | ||
63 | + public Iterator<OFOxm<?>> iterator() { | ||
64 | + return oxmMap.values().iterator(); | ||
65 | + } | ||
66 | + | ||
67 | + public static OFOxmList ofList(Iterable<OFOxm<?>> oxmList) { | ||
68 | + Map<MatchFields, OFOxm<?>> map = new EnumMap<MatchFields, OFOxm<?>>( | ||
69 | + MatchFields.class); | ||
70 | + for (OFOxm<?> o : oxmList) { | ||
71 | + OFOxm<?> canonical = o.getCanonical(); | ||
72 | + | ||
73 | + if(logger.isDebugEnabled() && !Objects.equal(o, canonical)) { | ||
74 | + logger.debug("OFOxmList: normalized non-canonical OXM {} to {}", o, canonical); | ||
75 | + } | ||
76 | + | ||
77 | + if(canonical != null) | ||
78 | + map.put(canonical.getMatchField().id, canonical); | ||
79 | + | ||
80 | + } | ||
81 | + return new OFOxmList(map); | ||
82 | + } | ||
83 | + | ||
84 | + public static OFOxmList of(OFOxm<?>... oxms) { | ||
85 | + Map<MatchFields, OFOxm<?>> map = new EnumMap<MatchFields, OFOxm<?>>( | ||
86 | + MatchFields.class); | ||
87 | + for (OFOxm<?> o : oxms) { | ||
88 | + OFOxm<?> canonical = o.getCanonical(); | ||
89 | + | ||
90 | + if(logger.isDebugEnabled() && !Objects.equal(o, canonical)) { | ||
91 | + logger.debug("OFOxmList: normalized non-canonical OXM {} to {}", o, canonical); | ||
92 | + } | ||
93 | + | ||
94 | + if(canonical != null) | ||
95 | + map.put(canonical.getMatchField().id, canonical); | ||
96 | + } | ||
97 | + return new OFOxmList(map); | ||
98 | + } | ||
99 | + | ||
100 | + public static OFOxmList readFrom(ChannelBuffer bb, int length, | ||
101 | + OFMessageReader<OFOxm<?>> reader) throws OFParseError { | ||
102 | + return ofList(ChannelUtils.readList(bb, length, reader)); | ||
103 | + } | ||
104 | + | ||
105 | + @Override | ||
106 | + public void writeTo(ChannelBuffer bb) { | ||
107 | + for (OFOxm<?> o : this) { | ||
108 | + o.writeTo(bb); | ||
109 | + } | ||
110 | + } | ||
111 | + | ||
112 | + public OFOxmList.Builder createBuilder() { | ||
113 | + return new OFOxmList.Builder(new EnumMap<MatchFields, OFOxm<?>>(oxmMap)); | ||
114 | + } | ||
115 | + | ||
116 | + @Override | ||
117 | + public int hashCode() { | ||
118 | + final int prime = 31; | ||
119 | + int result = 1; | ||
120 | + result = prime * result + ((oxmMap == null) ? 0 : oxmMap.hashCode()); | ||
121 | + return result; | ||
122 | + } | ||
123 | + | ||
124 | + @Override | ||
125 | + public boolean equals(Object obj) { | ||
126 | + if (this == obj) | ||
127 | + return true; | ||
128 | + if (obj == null) | ||
129 | + return false; | ||
130 | + if (getClass() != obj.getClass()) | ||
131 | + return false; | ||
132 | + OFOxmList other = (OFOxmList) obj; | ||
133 | + if (oxmMap == null) { | ||
134 | + if (other.oxmMap != null) | ||
135 | + return false; | ||
136 | + } else if (!oxmMap.equals(other.oxmMap)) | ||
137 | + return false; | ||
138 | + return true; | ||
139 | + } | ||
140 | + | ||
141 | + @Override | ||
142 | + public String toString() { | ||
143 | + return "OFOxmList" + oxmMap; | ||
144 | + } | ||
145 | + | ||
146 | + @Override | ||
147 | + public void putTo(PrimitiveSink sink) { | ||
148 | + for (OFOxm<?> o : this) { | ||
149 | + o.putTo(sink); | ||
150 | + } | ||
151 | + } | ||
152 | + | ||
153 | + | ||
154 | +} |
1 | +package org.projectfloodlight.openflow.protocol; | ||
2 | + | ||
3 | +public enum OFVersion { | ||
4 | + OF_10(1), OF_11(2), OF_12(3), OF_13(4); | ||
5 | + | ||
6 | + public final int wireVersion; | ||
7 | + | ||
8 | + OFVersion(final int wireVersion) { | ||
9 | + this.wireVersion = wireVersion; | ||
10 | + } | ||
11 | + | ||
12 | + public int getWireVersion() { | ||
13 | + return wireVersion; | ||
14 | + } | ||
15 | + | ||
16 | +} |
1 | +package org.projectfloodlight.openflow.protocol; | ||
2 | + | ||
3 | +import java.util.concurrent.atomic.AtomicLong; | ||
4 | + | ||
5 | +public class XidGenerators { | ||
6 | + private static final XidGenerator GLOBAL_XID_GENERATOR = new StandardXidGenerator(); | ||
7 | + | ||
8 | + public static XidGenerator create() { | ||
9 | + return new StandardXidGenerator(); | ||
10 | + } | ||
11 | + | ||
12 | + public static XidGenerator global() { | ||
13 | + return GLOBAL_XID_GENERATOR; | ||
14 | + } | ||
15 | +} | ||
16 | + | ||
17 | +class StandardXidGenerator implements XidGenerator { | ||
18 | + | ||
19 | + private final AtomicLong xidGen = new AtomicLong(); | ||
20 | + long MAX_XID = 0xFFffFFffL; | ||
21 | + | ||
22 | + @Override | ||
23 | + public long nextXid() { | ||
24 | + long xid; | ||
25 | + do { | ||
26 | + xid = xidGen.incrementAndGet(); | ||
27 | + if(xid > MAX_XID) { | ||
28 | + synchronized(this) { | ||
29 | + if(xidGen.get() > MAX_XID) { | ||
30 | + xidGen.set(0); | ||
31 | + } | ||
32 | + } | ||
33 | + } | ||
34 | + } while(xid > MAX_XID); | ||
35 | + return xid; | ||
36 | + } | ||
37 | + | ||
38 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 | +package org.projectfloodlight.openflow.protocol.match; | ||
2 | + | ||
3 | +// MUST BE ORDERED BY THE ORDER OF OF SPEC!!! | ||
4 | +public enum MatchFields { | ||
5 | + IN_PORT, | ||
6 | + IN_PHY_PORT, | ||
7 | + METADATA, | ||
8 | + ETH_DST, | ||
9 | + ETH_SRC, | ||
10 | + ETH_TYPE, | ||
11 | + VLAN_VID, | ||
12 | + VLAN_PCP, | ||
13 | + IP_DSCP, | ||
14 | + IP_ECN, | ||
15 | + IP_PROTO, | ||
16 | + IPV4_SRC, | ||
17 | + IPV4_DST, | ||
18 | + TCP_SRC, | ||
19 | + TCP_DST, | ||
20 | + UDP_SRC, | ||
21 | + UDP_DST, | ||
22 | + SCTP_SRC, | ||
23 | + SCTP_DST, | ||
24 | + ICMPV4_TYPE, | ||
25 | + ICMPV4_CODE, | ||
26 | + ARP_OP, | ||
27 | + ARP_SPA, | ||
28 | + ARP_TPA, | ||
29 | + ARP_SHA, | ||
30 | + ARP_THA, | ||
31 | + IPV6_SRC, | ||
32 | + IPV6_DST, | ||
33 | + IPV6_FLABEL, | ||
34 | + ICMPV6_TYPE, | ||
35 | + ICMPV6_CODE, | ||
36 | + IPV6_ND_TARGET, | ||
37 | + IPV6_ND_SLL, | ||
38 | + IPV6_ND_TLL, | ||
39 | + MPLS_LABEL, | ||
40 | + MPLS_TC, | ||
41 | + TUNNEL_ID, | ||
42 | + BSN_IN_PORTS_128, | ||
43 | + BSN_LAG_ID, | ||
44 | + BSN_VRF, | ||
45 | + BSN_GLOBAL_VRF_ALLOWED, | ||
46 | + BSN_L3_INTERFACE_CLASS_ID, | ||
47 | + BSN_L3_SRC_CLASS_ID, | ||
48 | + BSN_L3_DST_CLASS_ID, | ||
49 | + BSN_EGR_PORT_GROUP_ID, | ||
50 | + BSN_UDF0, | ||
51 | + BSN_UDF1, | ||
52 | + BSN_UDF2, | ||
53 | + BSN_UDF3, | ||
54 | + BSN_UDF4, | ||
55 | + BSN_UDF5, | ||
56 | + BSN_UDF6, | ||
57 | + BSN_UDF7, | ||
58 | + BSN_TCP_FLAGS, | ||
59 | +} |
1 | +package org.projectfloodlight.openflow.protocol.match; | ||
2 | + | ||
3 | +import java.util.HashSet; | ||
4 | +import java.util.Set; | ||
5 | + | ||
6 | +import org.projectfloodlight.openflow.types.OFValueType; | ||
7 | + | ||
8 | +public class Prerequisite<T extends OFValueType<T>> { | ||
9 | + private final MatchField<T> field; | ||
10 | + private final Set<OFValueType<T>> values; | ||
11 | + private boolean any; | ||
12 | + | ||
13 | + @SafeVarargs | ||
14 | + public Prerequisite(MatchField<T> field, OFValueType<T>... values) { | ||
15 | + this.values = new HashSet<OFValueType<T>>(); | ||
16 | + this.field = field; | ||
17 | + if (values == null || values.length == 0) { | ||
18 | + this.any = true; | ||
19 | + } else { | ||
20 | + this.any = false; | ||
21 | + for (OFValueType<T> value : values) { | ||
22 | + this.values.add(value); | ||
23 | + } | ||
24 | + } | ||
25 | + } | ||
26 | + | ||
27 | + /** | ||
28 | + * Returns true if this prerequisite is satisfied by the given match object. | ||
29 | + * | ||
30 | + * @param match Match object | ||
31 | + * @return true iff prerequisite is satisfied. | ||
32 | + */ | ||
33 | + public boolean isSatisfied(Match match) { | ||
34 | + OFValueType<T> res = match.get(this.field); | ||
35 | + if (res == null) | ||
36 | + return false; | ||
37 | + if (this.any) | ||
38 | + return true; | ||
39 | + if (this.values.contains(res)) { | ||
40 | + return true; | ||
41 | + } | ||
42 | + return false; | ||
43 | + } | ||
44 | + | ||
45 | +} |
of/lib/src/main/java/org/projectfloodlight/openflow/protocol/ver10/ChannelUtilsVer10.java
0 → 100644
1 | +package org.projectfloodlight.openflow.protocol.ver10; | ||
2 | + | ||
3 | +import java.util.EnumSet; | ||
4 | +import java.util.Set; | ||
5 | + | ||
6 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
7 | +import org.projectfloodlight.openflow.exceptions.OFParseError; | ||
8 | +import org.projectfloodlight.openflow.protocol.OFActionType; | ||
9 | +import org.projectfloodlight.openflow.protocol.match.Match; | ||
10 | + | ||
11 | +import com.google.common.hash.PrimitiveSink; | ||
12 | + | ||
13 | +/** | ||
14 | + * Collection of helper functions for reading and writing into ChannelBuffers | ||
15 | + * | ||
16 | + * @author capveg | ||
17 | + */ | ||
18 | + | ||
19 | +public class ChannelUtilsVer10 { | ||
20 | + public static Match readOFMatch(final ChannelBuffer bb) throws OFParseError { | ||
21 | + return OFMatchV1Ver10.READER.readFrom(bb); | ||
22 | + } | ||
23 | + | ||
24 | + public static Set<OFActionType> readSupportedActions(ChannelBuffer bb) { | ||
25 | + int actions = bb.readInt(); | ||
26 | + EnumSet<OFActionType> supportedActions = EnumSet.noneOf(OFActionType.class); | ||
27 | + if ((actions & (1 << OFActionTypeSerializerVer10.OUTPUT_VAL)) != 0) | ||
28 | + supportedActions.add(OFActionType.OUTPUT); | ||
29 | + if ((actions & (1 << OFActionTypeSerializerVer10.SET_VLAN_VID_VAL)) != 0) | ||
30 | + supportedActions.add(OFActionType.SET_VLAN_VID); | ||
31 | + if ((actions & (1 << OFActionTypeSerializerVer10.SET_VLAN_PCP_VAL)) != 0) | ||
32 | + supportedActions.add(OFActionType.SET_VLAN_PCP); | ||
33 | + if ((actions & (1 << OFActionTypeSerializerVer10.STRIP_VLAN_VAL)) != 0) | ||
34 | + supportedActions.add(OFActionType.STRIP_VLAN); | ||
35 | + if ((actions & (1 << OFActionTypeSerializerVer10.SET_DL_SRC_VAL)) != 0) | ||
36 | + supportedActions.add(OFActionType.SET_DL_SRC); | ||
37 | + if ((actions & (1 << OFActionTypeSerializerVer10.SET_DL_DST_VAL)) != 0) | ||
38 | + supportedActions.add(OFActionType.SET_DL_DST); | ||
39 | + if ((actions & (1 << OFActionTypeSerializerVer10.SET_NW_SRC_VAL)) != 0) | ||
40 | + supportedActions.add(OFActionType.SET_NW_SRC); | ||
41 | + if ((actions & (1 << OFActionTypeSerializerVer10.SET_NW_DST_VAL)) != 0) | ||
42 | + supportedActions.add(OFActionType.SET_NW_DST); | ||
43 | + if ((actions & (1 << OFActionTypeSerializerVer10.SET_NW_TOS_VAL)) != 0) | ||
44 | + supportedActions.add(OFActionType.SET_NW_TOS); | ||
45 | + if ((actions & (1 << OFActionTypeSerializerVer10.SET_TP_SRC_VAL)) != 0) | ||
46 | + supportedActions.add(OFActionType.SET_TP_SRC); | ||
47 | + if ((actions & (1 << OFActionTypeSerializerVer10.SET_TP_DST_VAL)) != 0) | ||
48 | + supportedActions.add(OFActionType.SET_TP_DST); | ||
49 | + if ((actions & (1 << OFActionTypeSerializerVer10.ENQUEUE_VAL)) != 0) | ||
50 | + supportedActions.add(OFActionType.ENQUEUE); | ||
51 | + return supportedActions; | ||
52 | + } | ||
53 | + | ||
54 | + public static int supportedActionsToWire(Set<OFActionType> supportedActions) { | ||
55 | + int supportedActionsVal = 0; | ||
56 | + if (supportedActions.contains(OFActionType.OUTPUT)) | ||
57 | + supportedActionsVal |= (1 << OFActionTypeSerializerVer10.OUTPUT_VAL); | ||
58 | + if (supportedActions.contains(OFActionType.SET_VLAN_VID)) | ||
59 | + supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_VLAN_VID_VAL); | ||
60 | + if (supportedActions.contains(OFActionType.SET_VLAN_PCP)) | ||
61 | + supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_VLAN_PCP_VAL); | ||
62 | + if (supportedActions.contains(OFActionType.STRIP_VLAN)) | ||
63 | + supportedActionsVal |= (1 << OFActionTypeSerializerVer10.STRIP_VLAN_VAL); | ||
64 | + if (supportedActions.contains(OFActionType.SET_DL_SRC)) | ||
65 | + supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_DL_SRC_VAL); | ||
66 | + if (supportedActions.contains(OFActionType.SET_DL_DST)) | ||
67 | + supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_DL_DST_VAL); | ||
68 | + if (supportedActions.contains(OFActionType.SET_NW_SRC)) | ||
69 | + supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_NW_SRC_VAL); | ||
70 | + if (supportedActions.contains(OFActionType.SET_NW_DST)) | ||
71 | + supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_NW_DST_VAL); | ||
72 | + if (supportedActions.contains(OFActionType.SET_NW_TOS)) | ||
73 | + supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_NW_TOS_VAL); | ||
74 | + if (supportedActions.contains(OFActionType.SET_TP_SRC)) | ||
75 | + supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_TP_SRC_VAL); | ||
76 | + if (supportedActions.contains(OFActionType.SET_TP_DST)) | ||
77 | + supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_TP_DST_VAL); | ||
78 | + if (supportedActions.contains(OFActionType.ENQUEUE)) | ||
79 | + supportedActionsVal |= (1 << OFActionTypeSerializerVer10.ENQUEUE_VAL); | ||
80 | + return supportedActionsVal; | ||
81 | + } | ||
82 | + | ||
83 | + public static void putSupportedActionsTo(Set<OFActionType> supportedActions, PrimitiveSink sink) { | ||
84 | + sink.putInt(supportedActionsToWire(supportedActions)); | ||
85 | + } | ||
86 | + | ||
87 | + public static void writeSupportedActions(ChannelBuffer bb, Set<OFActionType> supportedActions) { | ||
88 | + bb.writeInt(supportedActionsToWire(supportedActions)); | ||
89 | + } | ||
90 | + | ||
91 | +} |
of/lib/src/main/java/org/projectfloodlight/openflow/protocol/ver11/ChannelUtilsVer11.java
0 → 100644
1 | +package org.projectfloodlight.openflow.protocol.ver11; | ||
2 | + | ||
3 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
4 | +import org.projectfloodlight.openflow.exceptions.OFParseError; | ||
5 | +import org.projectfloodlight.openflow.protocol.OFMatchBmap; | ||
6 | +import org.projectfloodlight.openflow.protocol.match.Match; | ||
7 | + | ||
8 | +/** | ||
9 | + * Collection of helper functions for reading and writing into ChannelBuffers | ||
10 | + * | ||
11 | + * @author capveg | ||
12 | + */ | ||
13 | + | ||
14 | +public class ChannelUtilsVer11 { | ||
15 | + public static Match readOFMatch(final ChannelBuffer bb) throws OFParseError { | ||
16 | + return OFMatchV2Ver11.READER.readFrom(bb); | ||
17 | + } | ||
18 | + | ||
19 | + public static OFMatchBmap readOFMatchBmap(ChannelBuffer bb) { | ||
20 | + throw new UnsupportedOperationException("not implemented"); | ||
21 | + } | ||
22 | + | ||
23 | + public static void writeOFMatchBmap(ChannelBuffer bb, OFMatchBmap match) { | ||
24 | + throw new UnsupportedOperationException("not implemented"); | ||
25 | + } | ||
26 | +} |
of/lib/src/main/java/org/projectfloodlight/openflow/protocol/ver12/ChannelUtilsVer12.java
0 → 100644
1 | +package org.projectfloodlight.openflow.protocol.ver12; | ||
2 | + | ||
3 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
4 | +import org.projectfloodlight.openflow.exceptions.OFParseError; | ||
5 | +import org.projectfloodlight.openflow.protocol.OFMatchBmap; | ||
6 | +import org.projectfloodlight.openflow.protocol.match.Match; | ||
7 | +import org.projectfloodlight.openflow.protocol.ver12.OFMatchV3Ver12; | ||
8 | +import org.projectfloodlight.openflow.protocol.OFBsnVportQInQ; | ||
9 | + | ||
10 | +/** | ||
11 | + * Collection of helper functions for reading and writing into ChannelBuffers | ||
12 | + * | ||
13 | + * @author capveg | ||
14 | + */ | ||
15 | + | ||
16 | +public class ChannelUtilsVer12 { | ||
17 | + public static Match readOFMatch(final ChannelBuffer bb) throws OFParseError { | ||
18 | + return OFMatchV3Ver12.READER.readFrom(bb); | ||
19 | + } | ||
20 | + | ||
21 | + // TODO these need to be figured out / removed | ||
22 | + | ||
23 | + public static OFBsnVportQInQ readOFBsnVportQInQ(ChannelBuffer bb) { | ||
24 | + throw new UnsupportedOperationException("not implemented"); | ||
25 | + } | ||
26 | + | ||
27 | + public static void writeOFBsnVportQInQ(ChannelBuffer bb, | ||
28 | + OFBsnVportQInQ vport) { | ||
29 | + throw new UnsupportedOperationException("not implemented"); | ||
30 | + | ||
31 | + } | ||
32 | + | ||
33 | + public static OFMatchBmap readOFMatchBmap(ChannelBuffer bb) { | ||
34 | + throw new UnsupportedOperationException("not implemented"); | ||
35 | + } | ||
36 | + | ||
37 | + public static void writeOFMatchBmap(ChannelBuffer bb, OFMatchBmap match) { | ||
38 | + throw new UnsupportedOperationException("not implemented"); | ||
39 | + } | ||
40 | +} |
of/lib/src/main/java/org/projectfloodlight/openflow/protocol/ver13/ChannelUtilsVer13.java
0 → 100644
1 | +package org.projectfloodlight.openflow.protocol.ver13; | ||
2 | + | ||
3 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
4 | +import org.projectfloodlight.openflow.exceptions.OFParseError; | ||
5 | +import org.projectfloodlight.openflow.protocol.OFMatchBmap; | ||
6 | +import org.projectfloodlight.openflow.protocol.match.Match; | ||
7 | + | ||
8 | +/** | ||
9 | + * Collection of helper functions for reading and writing into ChannelBuffers | ||
10 | + * | ||
11 | + * @author capveg | ||
12 | + */ | ||
13 | + | ||
14 | +public class ChannelUtilsVer13 { | ||
15 | + public static Match readOFMatch(final ChannelBuffer bb) throws OFParseError { | ||
16 | + return OFMatchV3Ver13.READER.readFrom(bb); | ||
17 | + } | ||
18 | + | ||
19 | + public static OFMatchBmap readOFMatchBmap(ChannelBuffer bb) { | ||
20 | + throw new UnsupportedOperationException("not implemented"); | ||
21 | + } | ||
22 | + | ||
23 | + public static void writeOFMatchBmap(ChannelBuffer bb, OFMatchBmap match) { | ||
24 | + throw new UnsupportedOperationException("not implemented"); | ||
25 | + } | ||
26 | +} |
1 | +package org.projectfloodlight.openflow.types; | ||
2 | + | ||
3 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
4 | + | ||
5 | +import com.google.common.hash.PrimitiveSink; | ||
6 | +import com.google.common.primitives.UnsignedInts; | ||
7 | + | ||
8 | +public class ArpOpcode implements OFValueType<ArpOpcode> { | ||
9 | + | ||
10 | + final static int LENGTH = 2; | ||
11 | + | ||
12 | + private static final int VAL_REQUEST = 1; | ||
13 | + private static final int VAL_REPLY = 2; | ||
14 | + private static final int VAL_REQUEST_REVERSE = 3; | ||
15 | + private static final int VAL_REPLY_REVERSE = 4; | ||
16 | + private static final int VAL_DRARP_REQUEST = 5; | ||
17 | + private static final int VAL_DRARP_REPLY = 6; | ||
18 | + private static final int VAL_DRARP_ERROR = 7; | ||
19 | + private static final int VAL_INARP_REQUEST = 8; | ||
20 | + private static final int VAL_INARP_REPLY = 9; | ||
21 | + private static final int VAL_ARP_NAK = 10; | ||
22 | + private static final int VAL_MARS_REQUEST = 11; | ||
23 | + private static final int VAL_MARS_MULTI = 12; | ||
24 | + private static final int VAL_MARS_MSERV = 13; | ||
25 | + private static final int VAL_MARS_JOIN = 14; | ||
26 | + private static final int VAL_MARS_LEAVE = 15; | ||
27 | + private static final int VAL_MARS_NAK = 16; | ||
28 | + private static final int VAL_MARS_UNSERV = 17; | ||
29 | + private static final int VAL_MARS_SJOIN = 18; | ||
30 | + private static final int VAL_MARS_SLEAVE = 19; | ||
31 | + private static final int VAL_MARS_GROUPLIST_REQUEST = 20; | ||
32 | + private static final int VAL_MARS_GROUPLIST_REPLY = 21; | ||
33 | + private static final int VAL_MARS_REDIRECT_MAP = 22; | ||
34 | + private static final int VAL_MAPOS_UNARP = 23; | ||
35 | + private static final int VAL_OP_EXP1 = 24; | ||
36 | + private static final int VAL_OP_EXP2 = 25; | ||
37 | + | ||
38 | + public static final ArpOpcode REQUEST = new ArpOpcode(VAL_REQUEST); | ||
39 | + public static final ArpOpcode REPLY = new ArpOpcode(VAL_REPLY); | ||
40 | + public static final ArpOpcode REQUEST_REVERSE = new ArpOpcode(VAL_REQUEST_REVERSE); | ||
41 | + public static final ArpOpcode REPLY_REVERSE = new ArpOpcode(VAL_REPLY_REVERSE); | ||
42 | + public static final ArpOpcode DRARP_REQUEST = new ArpOpcode(VAL_DRARP_REQUEST); | ||
43 | + public static final ArpOpcode DRARP_REPLY = new ArpOpcode(VAL_DRARP_REPLY); | ||
44 | + public static final ArpOpcode DRARP_ERROR = new ArpOpcode(VAL_DRARP_ERROR); | ||
45 | + public static final ArpOpcode INARP_REQUEST = new ArpOpcode(VAL_INARP_REQUEST); | ||
46 | + public static final ArpOpcode INARP_REPLY = new ArpOpcode(VAL_INARP_REPLY); | ||
47 | + public static final ArpOpcode ARP_NAK = new ArpOpcode(VAL_ARP_NAK); | ||
48 | + public static final ArpOpcode MARS_REQUEST = new ArpOpcode(VAL_MARS_REQUEST); | ||
49 | + public static final ArpOpcode MARS_MULTI = new ArpOpcode(VAL_MARS_MULTI); | ||
50 | + public static final ArpOpcode MARS_MSERV = new ArpOpcode(VAL_MARS_MSERV); | ||
51 | + public static final ArpOpcode MARS_JOIN = new ArpOpcode(VAL_MARS_JOIN); | ||
52 | + public static final ArpOpcode MARS_LEAVE = new ArpOpcode(VAL_MARS_LEAVE); | ||
53 | + public static final ArpOpcode MARS_NAK = new ArpOpcode(VAL_MARS_NAK); | ||
54 | + public static final ArpOpcode MARS_UNSERV = new ArpOpcode(VAL_MARS_UNSERV); | ||
55 | + public static final ArpOpcode MARS_SJOIN = new ArpOpcode(VAL_MARS_SJOIN); | ||
56 | + public static final ArpOpcode MARS_SLEAVE = new ArpOpcode(VAL_MARS_SLEAVE); | ||
57 | + public static final ArpOpcode MARS_GROUPLIST_REQUEST = new ArpOpcode(VAL_MARS_GROUPLIST_REQUEST); | ||
58 | + public static final ArpOpcode MARS_GROUPLIST_REPLY = new ArpOpcode(VAL_MARS_GROUPLIST_REPLY); | ||
59 | + public static final ArpOpcode MARS_REDIRECT_MAP = new ArpOpcode(VAL_MARS_REDIRECT_MAP); | ||
60 | + public static final ArpOpcode MAPOS_UNARP = new ArpOpcode(VAL_MAPOS_UNARP); | ||
61 | + public static final ArpOpcode OP_EXP1 = new ArpOpcode(VAL_OP_EXP1); | ||
62 | + public static final ArpOpcode OP_EXP2 = new ArpOpcode(VAL_OP_EXP2); | ||
63 | + | ||
64 | + private static final int MIN_OPCODE = 0; | ||
65 | + private static final int MAX_OPCODE = 0xFFFF; | ||
66 | + | ||
67 | + private static final int NONE_VAL = 0; | ||
68 | + public static final ArpOpcode NONE = new ArpOpcode(NONE_VAL); | ||
69 | + | ||
70 | + public static final ArpOpcode NO_MASK = new ArpOpcode(0xFFFFFFFF); | ||
71 | + public static final ArpOpcode FULL_MASK = new ArpOpcode(0x00000000); | ||
72 | + | ||
73 | + private final int opcode; | ||
74 | + | ||
75 | + private ArpOpcode(int opcode) { | ||
76 | + this.opcode = opcode; | ||
77 | + } | ||
78 | + | ||
79 | + @Override | ||
80 | + public int getLength() { | ||
81 | + return LENGTH; | ||
82 | + } | ||
83 | + | ||
84 | + public int getOpcode() { | ||
85 | + return this.opcode; | ||
86 | + } | ||
87 | + | ||
88 | + public static ArpOpcode of(int opcode) { | ||
89 | + if (opcode < MIN_OPCODE || opcode > MAX_OPCODE) | ||
90 | + throw new IllegalArgumentException("Invalid ARP opcode: " + opcode); | ||
91 | + switch (opcode) { | ||
92 | + case NONE_VAL: | ||
93 | + return NONE; | ||
94 | + case VAL_REQUEST: | ||
95 | + return REQUEST; | ||
96 | + case VAL_REPLY: | ||
97 | + return REPLY; | ||
98 | + case VAL_REQUEST_REVERSE: | ||
99 | + return REQUEST_REVERSE; | ||
100 | + case VAL_REPLY_REVERSE: | ||
101 | + return REPLY_REVERSE; | ||
102 | + case VAL_DRARP_REQUEST: | ||
103 | + return DRARP_REQUEST; | ||
104 | + case VAL_DRARP_REPLY: | ||
105 | + return DRARP_REPLY; | ||
106 | + case VAL_DRARP_ERROR: | ||
107 | + return DRARP_ERROR; | ||
108 | + case VAL_INARP_REQUEST: | ||
109 | + return INARP_REQUEST; | ||
110 | + case VAL_INARP_REPLY: | ||
111 | + return INARP_REPLY; | ||
112 | + case VAL_ARP_NAK: | ||
113 | + return ARP_NAK; | ||
114 | + case VAL_MARS_REQUEST: | ||
115 | + return MARS_REQUEST; | ||
116 | + case VAL_MARS_MULTI: | ||
117 | + return MARS_MULTI; | ||
118 | + case VAL_MARS_MSERV: | ||
119 | + return MARS_MSERV; | ||
120 | + case VAL_MARS_JOIN: | ||
121 | + return MARS_JOIN; | ||
122 | + case VAL_MARS_LEAVE: | ||
123 | + return MARS_LEAVE; | ||
124 | + case VAL_MARS_NAK: | ||
125 | + return MARS_NAK; | ||
126 | + case VAL_MARS_UNSERV: | ||
127 | + return MARS_UNSERV; | ||
128 | + case VAL_MARS_SJOIN: | ||
129 | + return MARS_SJOIN; | ||
130 | + case VAL_MARS_SLEAVE: | ||
131 | + return MARS_SLEAVE; | ||
132 | + case VAL_MARS_GROUPLIST_REQUEST: | ||
133 | + return MARS_GROUPLIST_REQUEST; | ||
134 | + case VAL_MARS_GROUPLIST_REPLY: | ||
135 | + return MARS_GROUPLIST_REPLY; | ||
136 | + case VAL_MARS_REDIRECT_MAP: | ||
137 | + return MARS_REDIRECT_MAP; | ||
138 | + case VAL_MAPOS_UNARP: | ||
139 | + return MAPOS_UNARP; | ||
140 | + case VAL_OP_EXP1: | ||
141 | + return OP_EXP1; | ||
142 | + case VAL_OP_EXP2: | ||
143 | + return OP_EXP2; | ||
144 | + default: | ||
145 | + return new ArpOpcode(opcode); | ||
146 | + } | ||
147 | + } | ||
148 | + | ||
149 | + public void write2Bytes(ChannelBuffer c) { | ||
150 | + c.writeShort(this.opcode); | ||
151 | + } | ||
152 | + | ||
153 | + public static ArpOpcode read2Bytes(ChannelBuffer c) { | ||
154 | + return ArpOpcode.of(c.readUnsignedShort()); | ||
155 | + } | ||
156 | + | ||
157 | + @Override | ||
158 | + public ArpOpcode applyMask(ArpOpcode mask) { | ||
159 | + return ArpOpcode.of(this.opcode & mask.opcode); | ||
160 | + } | ||
161 | + | ||
162 | + @Override | ||
163 | + public int hashCode() { | ||
164 | + final int prime = 31; | ||
165 | + int result = 1; | ||
166 | + result = prime * result + opcode; | ||
167 | + return result; | ||
168 | + } | ||
169 | + | ||
170 | + @Override | ||
171 | + public boolean equals(Object obj) { | ||
172 | + if (this == obj) | ||
173 | + return true; | ||
174 | + if (obj == null) | ||
175 | + return false; | ||
176 | + if (getClass() != obj.getClass()) | ||
177 | + return false; | ||
178 | + ArpOpcode other = (ArpOpcode) obj; | ||
179 | + if (opcode != other.opcode) | ||
180 | + return false; | ||
181 | + return true; | ||
182 | + } | ||
183 | + | ||
184 | + @Override | ||
185 | + public int compareTo(ArpOpcode o) { | ||
186 | + return UnsignedInts.compare(opcode, o.opcode); | ||
187 | + } | ||
188 | + | ||
189 | + @Override | ||
190 | + public void putTo(PrimitiveSink sink) { | ||
191 | + sink.putShort((short) this.opcode); | ||
192 | + } | ||
193 | + | ||
194 | + @Override | ||
195 | + public String toString() { | ||
196 | + return String.valueOf(this.opcode); | ||
197 | + } | ||
198 | +} |
1 | +package org.projectfloodlight.openflow.types; | ||
2 | + | ||
3 | +import javax.annotation.concurrent.Immutable; | ||
4 | + | ||
5 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
6 | + | ||
7 | +import com.google.common.hash.PrimitiveSink; | ||
8 | +import com.google.common.primitives.UnsignedInts; | ||
9 | + | ||
10 | +@Immutable | ||
11 | +public class ClassId implements OFValueType<ClassId> { | ||
12 | + static final int LENGTH = 4; | ||
13 | + | ||
14 | + private final static int NONE_VAL = 0; | ||
15 | + public final static ClassId NONE = new ClassId(NONE_VAL); | ||
16 | + | ||
17 | + private final static int NO_MASK_VAL = 0xFFFFFFFF; | ||
18 | + public final static ClassId NO_MASK = new ClassId(NO_MASK_VAL); | ||
19 | + public final static ClassId FULL_MASK = NONE; | ||
20 | + | ||
21 | + private final int rawValue; | ||
22 | + | ||
23 | + private ClassId(final int rawValue) { | ||
24 | + this.rawValue = rawValue; | ||
25 | + } | ||
26 | + | ||
27 | + public static ClassId of(final int raw) { | ||
28 | + if(raw == NONE_VAL) | ||
29 | + return NONE; | ||
30 | + else if(raw == NO_MASK_VAL) | ||
31 | + return NO_MASK; | ||
32 | + return new ClassId(raw); | ||
33 | + } | ||
34 | + | ||
35 | + public int getInt() { | ||
36 | + return rawValue; | ||
37 | + } | ||
38 | + | ||
39 | + @Override | ||
40 | + public int getLength() { | ||
41 | + return LENGTH; | ||
42 | + } | ||
43 | + | ||
44 | + @Override | ||
45 | + public String toString() { | ||
46 | + return Integer.toString(rawValue); | ||
47 | + } | ||
48 | + | ||
49 | + @Override | ||
50 | + public ClassId applyMask(ClassId mask) { | ||
51 | + return ClassId.of(rawValue & mask.rawValue); } | ||
52 | + | ||
53 | + @Override | ||
54 | + public int hashCode() { | ||
55 | + final int prime = 31; | ||
56 | + int result = 1; | ||
57 | + result = prime * result + rawValue; | ||
58 | + return result; | ||
59 | + } | ||
60 | + | ||
61 | + @Override | ||
62 | + public boolean equals(Object obj) { | ||
63 | + if (this == obj) | ||
64 | + return true; | ||
65 | + if (obj == null) | ||
66 | + return false; | ||
67 | + if (getClass() != obj.getClass()) | ||
68 | + return false; | ||
69 | + ClassId other = (ClassId) obj; | ||
70 | + if (rawValue != other.rawValue) | ||
71 | + return false; | ||
72 | + return true; | ||
73 | + } | ||
74 | + | ||
75 | + public void write4Bytes(ChannelBuffer c) { | ||
76 | + c.writeInt(rawValue); | ||
77 | + } | ||
78 | + | ||
79 | + public static ClassId read4Bytes(ChannelBuffer c) { | ||
80 | + return ClassId.of(c.readInt()); | ||
81 | + } | ||
82 | + | ||
83 | + @Override | ||
84 | + public int compareTo(ClassId o) { | ||
85 | + return UnsignedInts.compare(rawValue, rawValue); | ||
86 | + } | ||
87 | + | ||
88 | + @Override | ||
89 | + public void putTo(PrimitiveSink sink) { | ||
90 | + sink.putInt(rawValue); | ||
91 | + } | ||
92 | +} |
1 | +package org.projectfloodlight.openflow.types; | ||
2 | + | ||
3 | +import org.projectfloodlight.openflow.annotations.Immutable; | ||
4 | +import org.projectfloodlight.openflow.util.HexString; | ||
5 | + | ||
6 | +import com.google.common.hash.PrimitiveSink; | ||
7 | +import com.google.common.primitives.Longs; | ||
8 | +import com.google.common.primitives.UnsignedLongs; | ||
9 | + | ||
10 | +/** | ||
11 | + * Abstraction of a datapath ID that can be set and/or accessed as either a | ||
12 | + * long value or a colon-separated string. Immutable | ||
13 | + * | ||
14 | + * @author Rob Vaterlaus <rob.vaterlaus@bigswitch.com> | ||
15 | + */ | ||
16 | +@Immutable | ||
17 | +public class DatapathId implements PrimitiveSinkable, Comparable<DatapathId> { | ||
18 | + | ||
19 | + public static final DatapathId NONE = new DatapathId(0); | ||
20 | + | ||
21 | + private final long rawValue; | ||
22 | + | ||
23 | + private DatapathId(long rawValue) { | ||
24 | + this.rawValue = rawValue; | ||
25 | + } | ||
26 | + | ||
27 | + public static DatapathId of(long rawValue) { | ||
28 | + return new DatapathId(rawValue); | ||
29 | + } | ||
30 | + | ||
31 | + public static DatapathId of(String s) { | ||
32 | + return new DatapathId(HexString.toLong(s)); | ||
33 | + } | ||
34 | + | ||
35 | + public static DatapathId of(byte[] bytes) { | ||
36 | + return new DatapathId(Longs.fromByteArray(bytes)); | ||
37 | + } | ||
38 | + | ||
39 | + public long getLong() { | ||
40 | + return rawValue; | ||
41 | + } | ||
42 | + | ||
43 | + public U64 getUnsignedLong() { | ||
44 | + return U64.of(rawValue); | ||
45 | + } | ||
46 | + | ||
47 | + public byte[] getBytes() { | ||
48 | + return Longs.toByteArray(rawValue); | ||
49 | + } | ||
50 | + | ||
51 | + @Override | ||
52 | + public String toString() { | ||
53 | + return HexString.toHexString(rawValue); | ||
54 | + } | ||
55 | + | ||
56 | + @Override | ||
57 | + public int hashCode() { | ||
58 | + final int prime = 31; | ||
59 | + int result = 1; | ||
60 | + result = prime * result + (int) (rawValue ^ (rawValue >>> 32)); | ||
61 | + return result; | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
65 | + public boolean equals(Object obj) { | ||
66 | + if (this == obj) | ||
67 | + return true; | ||
68 | + if (obj == null) | ||
69 | + return false; | ||
70 | + if (getClass() != obj.getClass()) | ||
71 | + return false; | ||
72 | + DatapathId other = (DatapathId) obj; | ||
73 | + if (rawValue != other.rawValue) | ||
74 | + return false; | ||
75 | + return true; | ||
76 | + } | ||
77 | + | ||
78 | + @Override | ||
79 | + public void putTo(PrimitiveSink sink) { | ||
80 | + sink.putLong(rawValue); | ||
81 | + } | ||
82 | + | ||
83 | + @Override | ||
84 | + public int compareTo(DatapathId o) { | ||
85 | + return UnsignedLongs.compare(rawValue, o.rawValue); | ||
86 | + } | ||
87 | +} |
This diff is collapsed. Click to expand it.
1 | +package org.projectfloodlight.openflow.types; | ||
2 | + | ||
3 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
4 | +import org.projectfloodlight.openflow.exceptions.OFParseError; | ||
5 | + | ||
6 | +import com.google.common.hash.PrimitiveSink; | ||
7 | +import com.google.common.primitives.UnsignedInts; | ||
8 | + | ||
9 | +public class GenTableId implements OFValueType<GenTableId>, Comparable<GenTableId> { | ||
10 | + final static int LENGTH = 2; | ||
11 | + | ||
12 | + private static final int VALIDATION_MASK = 0xFFFF; | ||
13 | + | ||
14 | + private static final int ALL_VAL = 0xFFFF; | ||
15 | + private static final int NONE_VAL = 0x0000; | ||
16 | + public static final GenTableId NONE = new GenTableId(NONE_VAL); | ||
17 | + | ||
18 | + public static final GenTableId ALL = new GenTableId(ALL_VAL); | ||
19 | + public static final GenTableId ZERO = NONE; | ||
20 | + | ||
21 | + private final int id; | ||
22 | + | ||
23 | + private GenTableId(int id) { | ||
24 | + this.id = id; | ||
25 | + } | ||
26 | + | ||
27 | + public static GenTableId of(int id) { | ||
28 | + switch(id) { | ||
29 | + case NONE_VAL: | ||
30 | + return NONE; | ||
31 | + case ALL_VAL: | ||
32 | + return ALL; | ||
33 | + default: | ||
34 | + if ((id & VALIDATION_MASK) != id) | ||
35 | + throw new IllegalArgumentException("Illegal Table id value: " + id); | ||
36 | + return new GenTableId(id); | ||
37 | + } | ||
38 | + } | ||
39 | + | ||
40 | + @Override | ||
41 | + public String toString() { | ||
42 | + return "0x" + Integer.toHexString(id); | ||
43 | + } | ||
44 | + | ||
45 | + public int getValue() { | ||
46 | + return id; | ||
47 | + } | ||
48 | + | ||
49 | + @Override | ||
50 | + public int getLength() { | ||
51 | + return LENGTH; | ||
52 | + } | ||
53 | + | ||
54 | + public void write2Bytes(ChannelBuffer c) { | ||
55 | + c.writeShort(this.id); | ||
56 | + } | ||
57 | + | ||
58 | + public static GenTableId read2Bytes(ChannelBuffer c) throws OFParseError { | ||
59 | + return GenTableId.of(c.readUnsignedShort()); | ||
60 | + } | ||
61 | + | ||
62 | + @Override | ||
63 | + public GenTableId applyMask(GenTableId mask) { | ||
64 | + return GenTableId.of(this.id & mask.id); | ||
65 | + } | ||
66 | + | ||
67 | + @Override | ||
68 | + public boolean equals(Object obj) { | ||
69 | + if (!(obj instanceof GenTableId)) | ||
70 | + return false; | ||
71 | + GenTableId other = (GenTableId)obj; | ||
72 | + if (other.id != this.id) | ||
73 | + return false; | ||
74 | + return true; | ||
75 | + } | ||
76 | + | ||
77 | + @Override | ||
78 | + public int hashCode() { | ||
79 | + int prime = 13873; | ||
80 | + return this.id * prime; | ||
81 | + } | ||
82 | + | ||
83 | + @Override | ||
84 | + public int compareTo(GenTableId other) { | ||
85 | + return UnsignedInts.compare(this.id, other.id); | ||
86 | + } | ||
87 | + | ||
88 | + @Override | ||
89 | + public void putTo(PrimitiveSink sink) { | ||
90 | + sink.putShort((byte) id); | ||
91 | + } | ||
92 | + | ||
93 | +} |
1 | +package org.projectfloodlight.openflow.types; | ||
2 | + | ||
3 | +import javax.annotation.concurrent.Immutable; | ||
4 | + | ||
5 | +/** a hash value that supports bit-wise combinations, mainly to calculate hash values for | ||
6 | + * reconciliation operations. | ||
7 | + * | ||
8 | + * @author Andreas Wundsam <andreas.wundsam@bigswitch.com> | ||
9 | + * | ||
10 | + * @param <H> - this type, for return type safety. | ||
11 | + */ | ||
12 | +@Immutable | ||
13 | +public interface HashValue<H extends HashValue<H>> { | ||
14 | + /** return the "numBits" highest-order bits of the hash. | ||
15 | + * @param numBits number of higest-order bits to return [0-32]. | ||
16 | + * @return a numberic value of the 0-32 highest-order bits. | ||
17 | + */ | ||
18 | + int prefixBits(int numBits); | ||
19 | + | ||
20 | + /** @return the bitwise inverse of this value */ | ||
21 | + H inverse(); | ||
22 | + | ||
23 | + /** or this value with another value value of the same type */ | ||
24 | + H or(H other); | ||
25 | + | ||
26 | + /** and this value with another value value of the same type */ | ||
27 | + H and(H other); | ||
28 | + | ||
29 | + /** xor this value with another value value of the same type */ | ||
30 | + H xor(H other); | ||
31 | + | ||
32 | + /** calculate a combined hash value of this hash value (the <b>Key</b>) and the hash value | ||
33 | + * specified as a parameter (the <b>Value</b>). | ||
34 | + * <p> | ||
35 | + * The value is constructed as follows: | ||
36 | + * <ul> | ||
37 | + * <li>the first keyBits bits are taken only from the Key | ||
38 | + * <li>the other bits are taken from key xor value. | ||
39 | + * </ul> | ||
40 | + * The overall result looks like this: | ||
41 | + * <pre> | ||
42 | + * MSB LSB | ||
43 | + * +---------+--------------+ | ||
44 | + * | key | key ^ value | | ||
45 | + * +---------+--------------+ | ||
46 | + * |-keyBits-| | ||
47 | + * </pre> | ||
48 | + * | ||
49 | + * @param value - hash value to be compared with this value (the key) | ||
50 | + * @param keyBits number of prefix bits that are just taken from key | ||
51 | + * @return the combined value. | ||
52 | + */ | ||
53 | + H combineWithValue(H value, int keyBits); | ||
54 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +package org.projectfloodlight.openflow.types; | ||
2 | + | ||
3 | +import com.google.common.base.Preconditions; | ||
4 | + | ||
5 | +public class HashValueUtils { | ||
6 | + private HashValueUtils() { } | ||
7 | + | ||
8 | + public static long combineWithValue(long key, long value, int keyBits) { | ||
9 | + Preconditions.checkArgument(keyBits >= 0 && keyBits <= 64, "keyBits must be [0,64]"); | ||
10 | + | ||
11 | + int valueBits = 64 - keyBits; | ||
12 | + long valueMask = valueBits == 64 ? 0xFFFFFFFFFFFFFFFFL : (1L << valueBits) - 1; | ||
13 | + | ||
14 | + return key ^ (value & valueMask); | ||
15 | + } | ||
16 | + | ||
17 | + public static int prefixBits(long raw1, int numBits) { | ||
18 | + Preconditions.checkArgument(numBits >= 0 && numBits <= 32, | ||
19 | + "numBits must be in range [0, 32]"); | ||
20 | + | ||
21 | + if(numBits == 0) | ||
22 | + return 0; | ||
23 | + | ||
24 | + final int shiftDown = 64 - numBits; | ||
25 | + | ||
26 | + return (int) (raw1 >>> shiftDown); | ||
27 | + } | ||
28 | + | ||
29 | +} |
1 | +package org.projectfloodlight.openflow.types; | ||
2 | + | ||
3 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
4 | + | ||
5 | +import com.google.common.hash.PrimitiveSink; | ||
6 | +import com.google.common.primitives.Shorts; | ||
7 | + | ||
8 | +/** | ||
9 | + * | ||
10 | + * @author Yotam Harchol (yotam.harchol@bigswitch.com) | ||
11 | + * | ||
12 | + */ | ||
13 | +public class ICMPv4Code implements OFValueType<ICMPv4Code> { | ||
14 | + | ||
15 | + final static int LENGTH = 1; | ||
16 | + final static short MAX_CODE = 0xFF; | ||
17 | + | ||
18 | + private final short code; | ||
19 | + | ||
20 | + private static final short NONE_VAL = 0; | ||
21 | + public static final ICMPv4Code NONE = new ICMPv4Code(NONE_VAL); | ||
22 | + | ||
23 | + public static final ICMPv4Code NO_MASK = new ICMPv4Code((short)0xFFFF); | ||
24 | + public static final ICMPv4Code FULL_MASK = new ICMPv4Code((short)0x0000); | ||
25 | + | ||
26 | + private ICMPv4Code(short code) { | ||
27 | + this.code = code; | ||
28 | + } | ||
29 | + | ||
30 | + public static ICMPv4Code of(short code) { | ||
31 | + if(code == NONE_VAL) | ||
32 | + return NONE; | ||
33 | + | ||
34 | + if (code > MAX_CODE || code < 0) | ||
35 | + throw new IllegalArgumentException("Illegal ICMPv4 code: " + code); | ||
36 | + return new ICMPv4Code(code); | ||
37 | + } | ||
38 | + | ||
39 | + @Override | ||
40 | + public int getLength() { | ||
41 | + return LENGTH; | ||
42 | + } | ||
43 | + | ||
44 | + public short getCode() { | ||
45 | + return code; | ||
46 | + } | ||
47 | + | ||
48 | + public void writeByte(ChannelBuffer c) { | ||
49 | + c.writeByte(this.code); | ||
50 | + } | ||
51 | + | ||
52 | + public static ICMPv4Code readByte(ChannelBuffer c) { | ||
53 | + return ICMPv4Code.of(c.readUnsignedByte()); | ||
54 | + } | ||
55 | + | ||
56 | + @Override | ||
57 | + public ICMPv4Code applyMask(ICMPv4Code mask) { | ||
58 | + return ICMPv4Code.of((short)(this.code & mask.code)); | ||
59 | + } | ||
60 | + | ||
61 | + | ||
62 | + @Override | ||
63 | + public int hashCode() { | ||
64 | + final int prime = 31; | ||
65 | + int result = 1; | ||
66 | + result = prime * result + code; | ||
67 | + return result; | ||
68 | + } | ||
69 | + | ||
70 | + @Override | ||
71 | + public boolean equals(Object obj) { | ||
72 | + if (this == obj) | ||
73 | + return true; | ||
74 | + if (obj == null) | ||
75 | + return false; | ||
76 | + if (getClass() != obj.getClass()) | ||
77 | + return false; | ||
78 | + ICMPv4Code other = (ICMPv4Code) obj; | ||
79 | + if (code != other.code) | ||
80 | + return false; | ||
81 | + return true; | ||
82 | + } | ||
83 | + | ||
84 | + @Override | ||
85 | + public int compareTo(ICMPv4Code o) { | ||
86 | + return Shorts.compare(code, o.code); | ||
87 | + } | ||
88 | + | ||
89 | + @Override | ||
90 | + public void putTo(PrimitiveSink sink) { | ||
91 | + sink.putShort(code); | ||
92 | + } | ||
93 | + | ||
94 | + @Override | ||
95 | + public String toString() { | ||
96 | + return String.valueOf(this.code); | ||
97 | + } | ||
98 | +} |
1 | +package org.projectfloodlight.openflow.types; | ||
2 | + | ||
3 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
4 | + | ||
5 | +import com.google.common.hash.PrimitiveSink; | ||
6 | +import com.google.common.primitives.Shorts; | ||
7 | + | ||
8 | +public class ICMPv4Type implements OFValueType<ICMPv4Type> { | ||
9 | + final static int LENGTH = 1; | ||
10 | + | ||
11 | + private static final short VAL_ECHO_REPLY = 0; | ||
12 | + private static final short VAL_DESTINATION_UNREACHABLE = 3; | ||
13 | + private static final short VAL_SOURCE_QUENCH = 4; | ||
14 | + private static final short VAL_REDIRECT = 5; | ||
15 | + private static final short VAL_ALTERNATE_HOST_ADDRESS = 6; | ||
16 | + private static final short VAL_ECHO = 8; | ||
17 | + private static final short VAL_ROUTER_ADVERTISEMENT = 9; | ||
18 | + private static final short VAL_ROUTER_SOLICITATION = 10; | ||
19 | + private static final short VAL_TIME_EXCEEDED = 11; | ||
20 | + private static final short VAL_PARAMETER_PROBLEM = 12; | ||
21 | + private static final short VAL_TIMESTAMP = 13; | ||
22 | + private static final short VAL_TIMESTAMP_REPLY = 14; | ||
23 | + private static final short VAL_INFORMATION_REQUEST = 15; | ||
24 | + private static final short VAL_INFORMATION_REPLY = 16; | ||
25 | + private static final short VAL_ADDRESS_MASK_REQUEST = 17; | ||
26 | + private static final short VAL_ADDRESS_MASK_REPLY = 18; | ||
27 | + private static final short VAL_TRACEROUTE = 30; | ||
28 | + private static final short VAL_DATAGRAM_CONVERSION_ERROR = 31; | ||
29 | + private static final short VAL_MOBILE_HOST_REDIRECT = 32; | ||
30 | + private static final short VAL_IPV6_WHERE_ARE_YOU = 33; | ||
31 | + private static final short VAL_IPV6_I_AM_HERE = 34; | ||
32 | + private static final short VAL_MOBILE_REGISTRATION_REQUEST = 35; | ||
33 | + private static final short VAL_MOBILE_REGISTRATION_REPLY = 36; | ||
34 | + private static final short VAL_DOMAIN_NAME_REQUEST = 37; | ||
35 | + private static final short VAL_DOMAIN_NAME_REPLY = 38; | ||
36 | + private static final short VAL_SKIP = 39; | ||
37 | + private static final short VAL_PHOTURIS = 40; | ||
38 | + private static final short VAL_EXPERIMENTAL_MOBILITY = 41; | ||
39 | + | ||
40 | + public static final ICMPv4Type ECHO_REPLY = new ICMPv4Type(VAL_ECHO_REPLY); | ||
41 | + public static final ICMPv4Type DESTINATION_UNREACHABLE = new ICMPv4Type(VAL_DESTINATION_UNREACHABLE); | ||
42 | + public static final ICMPv4Type SOURCE_QUENCH = new ICMPv4Type(VAL_SOURCE_QUENCH); | ||
43 | + public static final ICMPv4Type REDIRECT = new ICMPv4Type(VAL_REDIRECT); | ||
44 | + public static final ICMPv4Type ALTERNATE_HOST_ADDRESS = new ICMPv4Type(VAL_ALTERNATE_HOST_ADDRESS); | ||
45 | + public static final ICMPv4Type ECHO = new ICMPv4Type(VAL_ECHO); | ||
46 | + public static final ICMPv4Type ROUTER_ADVERTISEMENT = new ICMPv4Type(VAL_ROUTER_ADVERTISEMENT); | ||
47 | + public static final ICMPv4Type ROUTER_SOLICITATION = new ICMPv4Type(VAL_ROUTER_SOLICITATION); | ||
48 | + public static final ICMPv4Type TIME_EXCEEDED = new ICMPv4Type(VAL_TIME_EXCEEDED); | ||
49 | + public static final ICMPv4Type PARAMETER_PROBLEM = new ICMPv4Type(VAL_PARAMETER_PROBLEM); | ||
50 | + public static final ICMPv4Type TIMESTAMP = new ICMPv4Type(VAL_TIMESTAMP); | ||
51 | + public static final ICMPv4Type TIMESTAMP_REPLY = new ICMPv4Type(VAL_TIMESTAMP_REPLY); | ||
52 | + public static final ICMPv4Type INFORMATION_REQUEST = new ICMPv4Type(VAL_INFORMATION_REQUEST); | ||
53 | + public static final ICMPv4Type INFORMATION_REPLY = new ICMPv4Type(VAL_INFORMATION_REPLY); | ||
54 | + public static final ICMPv4Type ADDRESS_MASK_REQUEST = new ICMPv4Type(VAL_ADDRESS_MASK_REQUEST); | ||
55 | + public static final ICMPv4Type ADDRESS_MASK_REPLY = new ICMPv4Type(VAL_ADDRESS_MASK_REPLY); | ||
56 | + public static final ICMPv4Type TRACEROUTE = new ICMPv4Type(VAL_TRACEROUTE); | ||
57 | + public static final ICMPv4Type DATAGRAM_CONVERSION_ERROR = new ICMPv4Type(VAL_DATAGRAM_CONVERSION_ERROR); | ||
58 | + public static final ICMPv4Type MOBILE_HOST_REDIRECT = new ICMPv4Type(VAL_MOBILE_HOST_REDIRECT); | ||
59 | + public static final ICMPv4Type IPV6_WHERE_ARE_YOU = new ICMPv4Type(VAL_IPV6_WHERE_ARE_YOU); | ||
60 | + public static final ICMPv4Type IPV6_I_AM_HERE = new ICMPv4Type(VAL_IPV6_I_AM_HERE); | ||
61 | + public static final ICMPv4Type MOBILE_REGISTRATION_REQUEST = new ICMPv4Type(VAL_MOBILE_REGISTRATION_REQUEST); | ||
62 | + public static final ICMPv4Type MOBILE_REGISTRATION_REPLY = new ICMPv4Type(VAL_MOBILE_REGISTRATION_REPLY); | ||
63 | + public static final ICMPv4Type DOMAIN_NAME_REQUEST = new ICMPv4Type(VAL_DOMAIN_NAME_REQUEST); | ||
64 | + public static final ICMPv4Type DOMAIN_NAME_REPLY = new ICMPv4Type(VAL_DOMAIN_NAME_REPLY); | ||
65 | + public static final ICMPv4Type SKIP = new ICMPv4Type(VAL_SKIP); | ||
66 | + public static final ICMPv4Type PHOTURIS = new ICMPv4Type(VAL_PHOTURIS); | ||
67 | + public static final ICMPv4Type EXPERIMENTAL_MOBILITY = new ICMPv4Type(VAL_EXPERIMENTAL_MOBILITY); | ||
68 | + | ||
69 | + // HACK alert - we're disapproriating ECHO_REPLY (value 0) as 'none' as well | ||
70 | + public static final ICMPv4Type NONE = ECHO_REPLY; | ||
71 | + | ||
72 | + public static final ICMPv4Type NO_MASK = new ICMPv4Type((short)0xFFFF); | ||
73 | + public static final ICMPv4Type FULL_MASK = new ICMPv4Type((short)0x0000); | ||
74 | + | ||
75 | + private final short type; | ||
76 | + | ||
77 | + private static final int MIN_TYPE = 0; | ||
78 | + private static final int MAX_TYPE = 0xFF; | ||
79 | + | ||
80 | + private ICMPv4Type(short type) { | ||
81 | + this.type = type; | ||
82 | + } | ||
83 | + | ||
84 | + public static ICMPv4Type of(short type) { | ||
85 | + if (type < MIN_TYPE || type > MAX_TYPE) | ||
86 | + throw new IllegalArgumentException("Invalid ICMPv4 type: " + type); | ||
87 | + switch (type) { | ||
88 | + case VAL_ECHO_REPLY: | ||
89 | + return ECHO_REPLY; | ||
90 | + case VAL_DESTINATION_UNREACHABLE: | ||
91 | + return DESTINATION_UNREACHABLE; | ||
92 | + case VAL_SOURCE_QUENCH: | ||
93 | + return SOURCE_QUENCH; | ||
94 | + case VAL_REDIRECT: | ||
95 | + return REDIRECT; | ||
96 | + case VAL_ALTERNATE_HOST_ADDRESS: | ||
97 | + return ALTERNATE_HOST_ADDRESS; | ||
98 | + case VAL_ECHO: | ||
99 | + return ECHO; | ||
100 | + case VAL_ROUTER_ADVERTISEMENT: | ||
101 | + return ROUTER_ADVERTISEMENT; | ||
102 | + case VAL_ROUTER_SOLICITATION: | ||
103 | + return ROUTER_SOLICITATION; | ||
104 | + case VAL_TIME_EXCEEDED: | ||
105 | + return TIME_EXCEEDED; | ||
106 | + case VAL_PARAMETER_PROBLEM: | ||
107 | + return PARAMETER_PROBLEM; | ||
108 | + case VAL_TIMESTAMP: | ||
109 | + return TIMESTAMP; | ||
110 | + case VAL_TIMESTAMP_REPLY: | ||
111 | + return TIMESTAMP_REPLY; | ||
112 | + case VAL_INFORMATION_REQUEST: | ||
113 | + return INFORMATION_REQUEST; | ||
114 | + case VAL_INFORMATION_REPLY: | ||
115 | + return INFORMATION_REPLY; | ||
116 | + case VAL_ADDRESS_MASK_REQUEST: | ||
117 | + return ADDRESS_MASK_REQUEST; | ||
118 | + case VAL_ADDRESS_MASK_REPLY: | ||
119 | + return ADDRESS_MASK_REPLY; | ||
120 | + case VAL_TRACEROUTE: | ||
121 | + return TRACEROUTE; | ||
122 | + case VAL_DATAGRAM_CONVERSION_ERROR: | ||
123 | + return DATAGRAM_CONVERSION_ERROR; | ||
124 | + case VAL_MOBILE_HOST_REDIRECT: | ||
125 | + return MOBILE_HOST_REDIRECT; | ||
126 | + case VAL_IPV6_WHERE_ARE_YOU: | ||
127 | + return IPV6_WHERE_ARE_YOU; | ||
128 | + case VAL_IPV6_I_AM_HERE: | ||
129 | + return IPV6_I_AM_HERE; | ||
130 | + case VAL_MOBILE_REGISTRATION_REQUEST: | ||
131 | + return MOBILE_REGISTRATION_REQUEST; | ||
132 | + case VAL_MOBILE_REGISTRATION_REPLY: | ||
133 | + return MOBILE_REGISTRATION_REPLY; | ||
134 | + case VAL_DOMAIN_NAME_REQUEST: | ||
135 | + return DOMAIN_NAME_REQUEST; | ||
136 | + case VAL_DOMAIN_NAME_REPLY: | ||
137 | + return DOMAIN_NAME_REPLY; | ||
138 | + case VAL_SKIP: | ||
139 | + return SKIP; | ||
140 | + case VAL_PHOTURIS: | ||
141 | + return PHOTURIS; | ||
142 | + case VAL_EXPERIMENTAL_MOBILITY: | ||
143 | + return EXPERIMENTAL_MOBILITY; | ||
144 | + default: | ||
145 | + return new ICMPv4Type(type); | ||
146 | + } | ||
147 | + } | ||
148 | + | ||
149 | + @Override | ||
150 | + public int getLength() { | ||
151 | + return LENGTH; | ||
152 | + } | ||
153 | + | ||
154 | + public short getType() { | ||
155 | + return type; | ||
156 | + } | ||
157 | + | ||
158 | + public void writeByte(ChannelBuffer c) { | ||
159 | + c.writeByte(this.type); | ||
160 | + } | ||
161 | + | ||
162 | + public static ICMPv4Type readByte(ChannelBuffer c) { | ||
163 | + return ICMPv4Type.of(c.readUnsignedByte()); | ||
164 | + } | ||
165 | + | ||
166 | + @Override | ||
167 | + public ICMPv4Type applyMask(ICMPv4Type mask) { | ||
168 | + return ICMPv4Type.of((short)(this.type & mask.type)); | ||
169 | + } | ||
170 | + | ||
171 | + @Override | ||
172 | + public int hashCode() { | ||
173 | + final int prime = 31; | ||
174 | + int result = 1; | ||
175 | + result = prime * result + type; | ||
176 | + return result; | ||
177 | + } | ||
178 | + | ||
179 | + @Override | ||
180 | + public boolean equals(Object obj) { | ||
181 | + if (this == obj) | ||
182 | + return true; | ||
183 | + if (obj == null) | ||
184 | + return false; | ||
185 | + if (getClass() != obj.getClass()) | ||
186 | + return false; | ||
187 | + ICMPv4Type other = (ICMPv4Type) obj; | ||
188 | + if (type != other.type) | ||
189 | + return false; | ||
190 | + return true; | ||
191 | + } | ||
192 | + | ||
193 | + @Override | ||
194 | + public int compareTo(ICMPv4Type o) { | ||
195 | + return Shorts.compare(type, o.type); | ||
196 | + } | ||
197 | + | ||
198 | + @Override | ||
199 | + public void putTo(PrimitiveSink sink) { | ||
200 | + sink.putShort(type); | ||
201 | + } | ||
202 | + | ||
203 | + @Override | ||
204 | + public String toString() { | ||
205 | + return String.valueOf(this.type); | ||
206 | + } | ||
207 | +} |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
of/lib/src/main/java/org/projectfloodlight/openflow/util/LengthCountingPseudoChannelBuffer.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
of/lib/src/test/resources/logback-test.xml
0 → 100644
This diff is collapsed. Click to expand it.
of/pom.xml
0 → 100644
This diff is collapsed. Click to expand it.
pom.xml
0 → 100644
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment