Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
d49d9d3
Merge pull request #8 from mq007/marcinBranch
mslowiak Apr 27, 2017
3d47cdc
Merge pull request #9 from mq007/marcinBranch
mslowiak Apr 27, 2017
7c85037
Merge pull request #10 from mq007/marcinBranch
mslowiak Apr 27, 2017
7468126
Merge pull request #11 from mq007/marcinBranch
mslowiak May 13, 2017
8030044
nic ciekawego
jakubru May 16, 2017
df545ba
Merge branch 'developerBranch' of https://github.com/mq007/netKnowApp…
jakubru May 16, 2017
0ffca87
Merge pull request #12 from mq007/marcinBranch
mslowiak May 16, 2017
478e56b
Merge pull request #13 from mq007/marcinBranch
mslowiak May 18, 2017
7278d8b
Merge pull request #14 from mq007/marcinBranch
mslowiak May 18, 2017
18242b5
Merge pull request #15 from mq007/marcinBranch
mslowiak May 18, 2017
ff02c9c
Added hostLabels over DraggableNode
mslowiak May 19, 2017
01010e5
Set host labes over draggable node
mslowiak May 19, 2017
61c638f
Bolded host labels
mslowiak May 19, 2017
9b0fde4
Fixed DraggableNodePopUp options layout
mslowiak May 19, 2017
d8e11c2
Merge pull request #17 from mq007/marcinBranch
May 19, 2017
e22553a
"changes Filip"
May 19, 2017
5e8d7b2
Merge pull request #18 from mq007/filipBranch
May 19, 2017
f0be1a2
Merge pull request #19 from mq007/kubaBranch
jakubru May 20, 2017
9476519
skończona agregacja sieci, wypadałoby przetestować
jakubru May 21, 2017
e5d5b71
Merge pull request #20 from mq007/kubaBranch
jakubru May 21, 2017
1c1440f
Agregacja sieci jeszcze bardziej skończona
jakubru May 22, 2017
6a3215d
Merge pull request #21 from mq007/kubaBranch
jakubru May 22, 2017
b974427
Updated pop-ups to accept entered data by pressing enter key
mslowiak May 24, 2017
694624c
Reset text fields when clicking cancel button in NodeLinkPopUp and Dr…
mslowiak May 24, 2017
26d4d7c
NetworkAggre.fxml
May 24, 2017
a589092
Merge branch 'filipBranch' of https://github.com/mq007/netKnowApp int…
mslowiak May 24, 2017
3b4c918
AggregationController works ok,
May 24, 2017
a3d74ae
Merge pull request #22 from mq007/marcinBranch
mslowiak May 24, 2017
66316ff
Merge branch 'filipBranch' of https://github.com/mq007/netKnowApp int…
mslowiak May 24, 2017
41a8183
Modyfication in Aggregation
May 24, 2017
95c2ffa
Merge branch 'filipBranch' of https://github.com/mq007/netKnowApp int…
mslowiak May 24, 2017
292b40e
Aggregation works
May 24, 2017
2cd3b4a
Merge pull request #23 from mq007/filipBranch
May 24, 2017
3a197d7
Merge branch 'filipBranch' of https://github.com/mq007/netKnowApp int…
mslowiak May 24, 2017
b59d059
Added errorLabel in aggregation
mslowiak May 24, 2017
d626eda
Without choder picture
mslowiak May 25, 2017
1c48329
Added SuccessfulRegistrationScene and Controller with fxml
mslowiak May 25, 2017
b3790d2
Merge pull request #24 from mq007/marcinBranch
mslowiak May 25, 2017
6059edc
Have made stacking DraggableNodes in list and connected to each Dragg…
mslowiak Jun 1, 2017
2157a4e
Agregacja sieci jeszcze bardziej skończona, już chyba bardziej skończ…
jakubru Jun 3, 2017
82a316f
Merge pull request #26 from mq007/kubaBranch
jakubru Jun 3, 2017
57feb3a
Deleted Chodar option from labelList
mslowiak Jun 5, 2017
df3c068
Deleted labelIco from DraggableNode and DragIcon
mslowiak Jun 5, 2017
38ee8b0
BellmanFord for RIP
mslowiak Jun 5, 2017
f6cb3a9
Saving path to router via RIPInfo and RIPWay class
mslowiak Jun 5, 2017
5eab94d
Generating code - version without next-hops
mslowiak Jun 6, 2017
8a6e12d
Generating code - full version
mslowiak Jun 6, 2017
3754b4a
Generated code is displayed in new scene
mslowiak Jun 6, 2017
c300cc9
Merge pull request #27 from mq007/marcinBranch
mslowiak Jun 6, 2017
607356e
Routing configuration code modification
mslowiak Jun 7, 2017
be3d2bb
Poprawiony wyjątek, gdy metoda aggregateNetwork zwraca null
jakubru Jun 7, 2017
2700687
Added different action on pc, switch, router and nodelink on switch g…
mslowiak Jun 7, 2017
5ccc964
Top ip label resized in draggable node
mslowiak Jun 7, 2017
291f9ce
Working on simulation
mslowiak Jun 7, 2017
f991adb
Added first case, circle not showing in intervals
mslowiak Jun 8, 2017
4c3e539
Simulation works, can simulate route between nodes
mslowiak Jun 8, 2017
ff6fae9
Simulation accepts start and stop in pc nodes
mslowiak Jun 8, 2017
862d957
Changed size of application when not maximized
mslowiak Jun 8, 2017
3d9f442
Simulation allow user to ping through pc's
mslowiak Jun 8, 2017
53e374e
Merge pull request #29 from mq007/marcinBranch
mslowiak Jun 8, 2017
0e18805
Merge branches 'developerBranch' and 'kubaBranch' of https://github.c…
jakubru Jun 8, 2017
1842ef4
Poprawiony wyjątek, gdy metoda aggregateNetwork zwraca null
jakubru Jun 8, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 34 additions & 4 deletions src/netKnow/Class/IP.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package netKnow.Class;

public class IP {
public class IP implements Comparable <IP>{
private int [] ipArray;
private int [] maskArray;
private String fullIPAdress [];
Expand All @@ -15,24 +15,25 @@ public IP(String [] fullIPAdress){
ipArray = new int[4];
maskArray = new int[4];
this.fullIPAdress = fullIPAdress;
convertStringToIPAdress(fullIPAdress);
convertStringToMask();
}


private void convertStringToIPAdress(String [] fullIPAdress){
for(int i = 0; i < 4; i++) {
ipArray[i] = Integer.parseInt(fullIPAdress[i]);
}
}

private void convertStringToMask(String mask){
private void convertStringToMask(){
int n = Integer.parseInt(fullIPAdress[4]);
for(int i = 0; i < n; i++){
maskArray[i/8] |= (128 >> (i%8));
}
}

public void computeData(){
convertStringToIPAdress(fullIPAdress);
convertStringToMask(fullIPAdress[4]);
network = computeNetwork();
broadcast = computeBroadcast();
numberOfHosts = Integer.toString(numberOfHosts());
Expand Down Expand Up @@ -77,6 +78,22 @@ private String maxHost()
return (tmp1[0] + "." + tmp1[1] + "." + tmp1[2] + "." + tmp2);
}

public int compareTo(IP ip){
if(this.ipArray[0] == ip.ipArray[0] && this.ipArray[1] == ip.ipArray[1] && this.ipArray[2] == ip.ipArray[2]
&& this.ipArray[3] == ip.ipArray[3]){
return 0;
}
else if((this.ipArray[0] > ip.ipArray[0]) || (this.ipArray[0] == ip.ipArray[0] && this.ipArray[1] > ip.ipArray[1]) ||
(this.ipArray[0] == ip.ipArray[0] && this.ipArray[1] == ip.ipArray[1] && this.ipArray[2] > ip.ipArray[2]) ||
(this.ipArray[0] == ip.ipArray[0] && this.ipArray[1] == ip.ipArray[1] && this.ipArray[2] == ip.ipArray[2]
&& this.ipArray[3] > ip.ipArray[3])){
return 1;
}
else{
return -1;
}
}

public String getNetwork() {
return network;
}
Expand All @@ -96,4 +113,17 @@ public String getMinHost() {
public String getNumberOfHosts() {
return numberOfHosts;
}

public String getIP(){
return (ipArray[0]+ "." + ipArray[1]+ "." + ipArray[2]+ "." + ipArray[3] + "/" + fullIPAdress[4]);
}

public int[] getIPAsInt(){ return ipArray; }

public int getMaskAsInt(){return Integer.parseInt(fullIPAdress[4]);}

public void setMask(int k){
fullIPAdress[4] = Integer.toString(k);
convertStringToMask();
};
}
132 changes: 132 additions & 0 deletions src/netKnow/Class/routing/CiscoConfigurationCodeGenerator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
package netKnow.Class.routing;

import java.util.List;

/**
* Created by MQ on 2017-06-06.
*/
public class CiscoConfigurationCodeGenerator {
List<DraggableNode> routersList;
List<DraggableNode> nodes;

public CiscoConfigurationCodeGenerator(List<DraggableNode> routersList, List<DraggableNode> nodes){
this.routersList = routersList;
this.nodes = nodes;
}

public String getConfiguration(){
String out = "";
for(int i=0; i<routersList.size(); ++i){
out += "Konfiguracja dla routera: " + routersList.get(i).titleBar.getText() + "\n";
out += "============================================================================\n";
out += goToConfiguration();
out += setHostName(routersList.get(i).titleBar.getText());
out += commit();
out += setInterfaces(i);
out += commit();
out += setRoutingOptions(i);
out += commit();
out += "\n\n";
}
return out;
}

private String goToConfiguration(){
String out = "";
out += "enable\n";
out += "configure terminal\n";
return out;
}

private String commit(){
return "commit" + "\nexit\n";
}

private String setHostName(String hostName){
String out = "";
out += "hostname " + hostName + "\n";
return out;
}

private String setInterfaces(int index){
String out = "";
int geNumber = 0;
int seNumber = 0;
DraggableNode interfaceNode = routersList.get(index);
for(int i=0; i<interfaceNode.nodeLinks.size(); ++i){
NodeLink nodeLink = interfaceNode.nodeLinks.get(i);
out += "interface ";
if(nodeLink.nodeLinkData.getTypeOfConnection().equals("Kabel lan")){
out += "Fe0/" + geNumber + "\n";
geNumber++;
}else{
out += "S0/0/" + seNumber + "\n";
out += "encapsulation ppp" + "\n";
seNumber++;
}
out += "ip address " + nodeLink.nodeLinkData.getAddressToInterface() + interfaceNode.draggableNodeData.getHost() + "/" + nodeLink.nodeLinkData.getMaskCisco() + "\n";
out += "no shutdown" + "\n";
}
return out;
}

private String setRoutingOptions(int index){
String out = "";
DraggableNode interfaceNode = routersList.get(index);
for(int i=0; i<interfaceNode.nodeLinks.size(); ++i){
DraggableNode connectedToInterfaceNode;
if(interfaceNode.nodeLinks.get(i).startIDNode.equals(interfaceNode.getId())){
connectedToInterfaceNode = getFriend(interfaceNode.nodeLinks.get(i).endIDNode);
}else{
connectedToInterfaceNode = getFriend(interfaceNode.nodeLinks.get(i).startIDNode);
}
if(connectedToInterfaceNode.getType().equals(DragIconType.switchIco)){
for(int j=0; j<connectedToInterfaceNode.nodeLinks.size(); ++j){
DraggableNode fromSwitchNode;
if(connectedToInterfaceNode.nodeLinks.get(j).startIDNode.equals(connectedToInterfaceNode.getId())){
fromSwitchNode = getFriend(connectedToInterfaceNode.nodeLinks.get(j).endIDNode);
}else{
fromSwitchNode = getFriend(connectedToInterfaceNode.nodeLinks.get(j).startIDNode);
}
if(fromSwitchNode != interfaceNode){
NodeLinkData data = connectedToInterfaceNode.nodeLinks.get(j).nodeLinkData;
out += "ip route ";
out += connectedToInterfaceNode.pcList.get(j).draggableNodeData.getIpWithoutMask();
out += " " + connectedToInterfaceNode.pcList.get(j).draggableNodeData.getMask() + " ";
out += data.getAddressToInterface() + connectedToInterfaceNode.draggableNodeData.getHost() + "\n";
}
}
}else if(connectedToInterfaceNode.getType().equals(DragIconType.routerIco)){
if(connectedToInterfaceNode.nodePCLink.size() > 0){
NodeLinkData data = connectedToInterfaceNode.nodeLinks.get(i).nodeLinkData;
for(int j=0; j<connectedToInterfaceNode.nodePCLink.size(); ++j){
String pcId;
if(connectedToInterfaceNode.nodePCLink.get(j).startIDNode.equals(connectedToInterfaceNode.getId())){
pcId = connectedToInterfaceNode.nodePCLink.get(j).endIDNode;
}else{
pcId = connectedToInterfaceNode.nodePCLink.get(j).startIDNode;
}
for(int k=0; k<connectedToInterfaceNode.pcList.size(); ++k){
if(connectedToInterfaceNode.pcList.get(k).getId().equals(pcId)){
out += "ip route ";
out += connectedToInterfaceNode.pcList.get(k).draggableNodeData.getIpWithoutMask();
out += " " + connectedToInterfaceNode.pcList.get(k).draggableNodeData.getMask() + " " ;
out += data.getAddressToInterface() + connectedToInterfaceNode.draggableNodeData.getHost() + "\n";
}
}
}
}
}
}
return out;
}

private DraggableNode getFriend(String id){
for(int j=0; j<nodes.size(); ++j){
if(nodes.get(j).getId().equals(id)){
return nodes.get(j);
}
}
return null;
}
}
3 changes: 0 additions & 3 deletions src/netKnow/Class/routing/DragIcon.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ public void setType(DragIconType type) {
case switchIco:
getStyleClass().add("icon-switch");
break;
case labelIco:
getStyleClass().add("icon-label");
break;
default:
break;
}
Expand Down
44 changes: 32 additions & 12 deletions src/netKnow/Class/routing/DraggableNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,36 @@ public class DraggableNode extends AnchorPane{

@FXML AnchorPane root_pane;
@FXML AnchorPane nodeBody;
@FXML Label titleBar;
@FXML Label closeButton;
@FXML AnchorPane leftLinkHandle;
@FXML AnchorPane rightLinkHandle;
@FXML public Label titleBar;
@FXML public Label closeButton;
@FXML public AnchorPane leftLinkHandle;
@FXML public AnchorPane rightLinkHandle;
@FXML Label topHostLabel;
@FXML Label bottomHostLabel;
@FXML Label leftHostLabel;
@FXML Label rightHostLabel;

private final DraggableNode self;
public final List<String> mLinkIds = new ArrayList();
public List<NodeLink> nodeLinks = new ArrayList<>();
public List<NodeLink> nodePCLink = new ArrayList<>();
public List<DraggableNode> pcList = new ArrayList<>();

private EventHandler <DragEvent> mContextDragOver;
private EventHandler <DragEvent> mContextDragDropped;

private EventHandler <MouseEvent> mLinkHandleDragDetected; // wykrycie przeciagania
private EventHandler <DragEvent> mLinkHandleDragDropped; // wykrycie konca przeciagania
private EventHandler <DragEvent> mContextLinkDragOver; // wykrycie przeciagania z drugim obiektem
private EventHandler <DragEvent> mContextLinkDragDropped; // wykrycie konca przeciagania z drugim obiektem
public EventHandler <MouseEvent> mLinkHandleDragDetected; // wykrycie przeciagania
public EventHandler <DragEvent> mLinkHandleDragDropped; // wykrycie konca przeciagania
public EventHandler <DragEvent> mContextLinkDragOver; // wykrycie przeciagania z drugim obiektem
public EventHandler <DragEvent> mContextLinkDragDropped; // wykrycie konca przeciagania z drugim obiektem

private NodeLink mDragLink;
private AnchorPane rightPane;

private DragIconType mType = null;
private Point2D mDragOffset = new Point2D(0.0, 0.0);
public DraggableNodeData draggableNodeData;
public RIPInfo ripInfo;

public DraggableNode() {
self = this;
Expand All @@ -66,6 +74,11 @@ public DraggableNode() {
setId(UUID.randomUUID().toString());
}

public DraggableNode(String id){
self = this;
setId(id);
}

public void setTitleBar(String titleBarText) {
titleBar.setText(titleBarText);
}
Expand Down Expand Up @@ -274,13 +287,20 @@ public void setType(DragIconType type) {
case switchIco:
nodeBody.getStyleClass().add("icon-switch");
break;
case labelIco:
nodeBody.getStyleClass().add("icon-label");
break;

default:
break;
}
}

public void setHostLabels(String host){
rightHostLabel.setText(host);
leftHostLabel.setText(host);
topHostLabel.setText(host);
bottomHostLabel.setText(host);
}

public void setIpTop(String ip){
topHostLabel.setText(ip);
}

}
30 changes: 28 additions & 2 deletions src/netKnow/Class/routing/DraggableNodeData.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ public class DraggableNodeData {

private String name;
private String host;
private String ip;

public DraggableNodeData(String name, String host){
public DraggableNodeData(String name, String x){
this.name = name;
this.host = host;
if(x.length() > 3){
this.ip = x;
System.out.println("IP: " + this.ip);
}else{
this.host = x;
System.out.println("host: " + this.host);
}
}

public String getName(){
Expand All @@ -20,4 +27,23 @@ public String getName(){
public String getHost(){
return host;
}

public String getIp() {
return ip;
}

public String getIpWithoutMask(){
String [] pp = ip.split("/");
return pp[0];
}

public String getMask(){
System.out.println("MY IP IS: " + ip);
String [] pp = ip.split("/");
int cidrMask = Integer.parseInt(pp[1]);
long bits = 0;
bits = 0xffffffff ^ (1 << 32 - cidrMask) - 1;
String mask = String.format("%d.%d.%d.%d", (bits & 0x0000000000ff000000L) >> 24, (bits & 0x0000000000ff0000) >> 16, (bits & 0x0000000000ff00) >> 8, bits & 0xff);
return mask;
}
}
Loading