diff --git a/src/main/java/com/loafle/bridge/discoveryhistory/DiscoveriyHistoryController.java b/src/main/java/com/loafle/bridge/discoveryhistory/DiscoveriyHistoryController.java index 0f527c4..6db2145 100644 --- a/src/main/java/com/loafle/bridge/discoveryhistory/DiscoveriyHistoryController.java +++ b/src/main/java/com/loafle/bridge/discoveryhistory/DiscoveriyHistoryController.java @@ -1,9 +1,11 @@ package com.loafle.bridge.discoveryhistory; +import com.fasterxml.jackson.databind.ObjectMapper; import com.loafle.bridge.discoveryzone.DiscoveryZone; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.io.File; import java.util.List; /** @@ -23,6 +25,8 @@ public class DiscoveriyHistoryController { zone.mappingChildren(history); } discoveryHistoryRepository.save(history); +// ObjectMapper mapper = new ObjectMapper(); +// mapper.writeValue(new File("/root/jsonData"),history); } diff --git a/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHost.java b/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHost.java index 00dbcb0..101b8f9 100644 --- a/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHost.java +++ b/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHost.java @@ -24,6 +24,39 @@ public class DiscoveryHost { @Column(name = "MAC",nullable = false) private long mac; + @Column(nullable = true) + private String name; + + @Column(nullable = false) + private int firstScanRange; + + @Column(nullable = false) + private int lastScanRange; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getFirstScanRange() { + return firstScanRange; + } + + public void setFirstScanRange(int firstScanRange) { + this.firstScanRange = firstScanRange; + } + + public int getLastScanRange() { + return lastScanRange; + } + + public void setLastScanRange(int lastScanRange) { + this.lastScanRange = lastScanRange; + } + @ManyToOne @JoinColumn(name = "ZONE_ID", nullable = false) @JsonIgnore diff --git a/src/main/java/com/loafle/bridge/discoveryport/DiscoveryPortController.java b/src/main/java/com/loafle/bridge/discoveryport/DiscoveryPortController.java index d09fa62..c0557bc 100644 --- a/src/main/java/com/loafle/bridge/discoveryport/DiscoveryPortController.java +++ b/src/main/java/com/loafle/bridge/discoveryport/DiscoveryPortController.java @@ -62,7 +62,6 @@ public class DiscoveryPortController { DiscoveryZone z = new DiscoveryZone(); String cidr = "827452358680"; String ip = "3232235983"; - z.setCidr(Long.parseLong(cidr)); z.setIp(Long.parseLong(ip)); z.setDiscovery(d); diff --git a/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java b/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java index 021a614..e1ee6a6 100644 --- a/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java +++ b/src/main/java/com/loafle/bridge/discoveryzone/DiscoveryZone.java @@ -23,7 +23,59 @@ public class DiscoveryZone { private long ip; @Column(nullable=false) - private long cidr; + private short mask; + + @Column(nullable=false) + private String iface; + + @Column(nullable=false) + private long mac; + + @Column(nullable=false) + private long firstScanRange; + + @Column(nullable=false) + private long lastScanRange; + + public short getMask() { + return mask; + } + + public void setMask(short mask) { + this.mask = mask; + } + + public String getIface() { + return iface; + } + + public void setIface(String iface) { + this.iface = iface; + } + + public long getMac() { + return mac; + } + + public void setMac(long mac) { + this.mac = mac; + } + + public long getFirstScanRange() { + return firstScanRange; + } + + public void setFirstScanRange(long firstScanRange) { + this.firstScanRange = firstScanRange; + } + + public long getLastScanRange() { + return lastScanRange; + } + + public void setLastScanRange(long lastScanRange) { + this.lastScanRange = lastScanRange; + } @JoinColumn(nullable=false) @OneToOne @@ -84,14 +136,6 @@ public class DiscoveryZone { this.ip = ip; } - public long getCidr() { - return cidr; - } - - public void setCidr(long cidr) { - this.cidr = cidr; - } - public DiscoveryHistory getDiscovery() { return discovery; } diff --git a/src/test/java/com/loafle/bridge/discoveryzone/DiscoveryZoneRepositoryTest.java b/src/test/java/com/loafle/bridge/discoveryzone/DiscoveryZoneRepositoryTest.java index 2190633..9e0f30e 100644 --- a/src/test/java/com/loafle/bridge/discoveryzone/DiscoveryZoneRepositoryTest.java +++ b/src/test/java/com/loafle/bridge/discoveryzone/DiscoveryZoneRepositoryTest.java @@ -33,7 +33,6 @@ public class DiscoveryZoneRepositoryTest { String ip = "3232235983"; - discoveryZone.setCidr(Long.parseLong(cidr)); discoveryZone.setIp(Long.parseLong(ip)); discoveryZoneRepository.save(discoveryZone); @@ -54,7 +53,6 @@ public class DiscoveryZoneRepositoryTest { String ip = "3232235983"; - discoveryZone.setCidr(Long.parseLong(cidr)); discoveryZone.setIp(Long.parseLong(ip)); discoveryZoneRepository.save(discoveryZone); @@ -72,7 +70,6 @@ public class DiscoveryZoneRepositoryTest { HostScanHistory hostScanHistory = null; - System.out.println("!!!!!!!!!!!!!!!!!!!!!= " + zone.getCidr()); List hostScanHistories = new ArrayList();