Created
November 22, 2016 13:34
-
-
Save cbruegg/0e95cec9302771ce49c4f6d74b8fbbc1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package edu.brown.cs.paneclient; | |
import java.io.IOException; | |
import java.net.InetAddress; | |
public class PaneSample { | |
private static final String PANE_CONTROLLER_HOSTNAME = "localhost"; | |
private static final int PANE_CONTROLLER_PORT = 9000; | |
private static final String PANE_USERNAME = "username"; | |
private static final int RESERVATION_BANDWIDTH_BITS_P_S = 1024; | |
private static final int FLOW_PROTOCOL = PaneFlowGroup.PROTO_TCP; | |
private static final InetAddress FLOW_SRC_HOST = null; // Something here | |
private static final int FLOW_SRC_PORT = -1; // Something here | |
private static final InetAddress FLOW_DST_HOST = null; // Something here | |
private static final int FLOW_DST_PORT = -1; // Something here | |
private static final int MAX_RESERVATIONS = Integer.MAX_VALUE; | |
public static void main(String[] args) throws IOException, PaneException.InvalidAuthenticateException, PaneException.InvalidResvException { | |
PaneClient client = new PaneClientImpl(InetAddress.getByName(PANE_CONTROLLER_HOSTNAME), PANE_CONTROLLER_PORT); | |
client.authenticate(PANE_USERNAME); | |
PaneRelativeTime start = new PaneRelativeTime(); | |
start.setRelativeTime(0); // Now | |
PaneRelativeTime end = new PaneRelativeTime(); | |
end.setRelativeTime(1000); // In 1000 ms (I think? Unit unclear, but should be ms) | |
PaneFlowGroup flowGroup = new PaneFlowGroup(); | |
flowGroup.setSrcHost(FLOW_SRC_HOST); | |
flowGroup.setSrcPort(FLOW_SRC_PORT); | |
flowGroup.setDstHost(FLOW_DST_HOST); | |
flowGroup.setDstPort(FLOW_DST_PORT); | |
flowGroup.setTransportProto(FLOW_PROTOCOL); | |
PaneReservation reservation = new PaneReservation(RESERVATION_BANDWIDTH_BITS_P_S, flowGroup, start, end); | |
PaneShare share = new PaneShare("sample_share", MAX_RESERVATIONS, flowGroup); | |
share.reserve(reservation); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment