classlib all types implemented

This commit is contained in:
2022-12-05 14:08:59 +03:00
parent 09cd00dc66
commit affbd18de2
14 changed files with 282 additions and 154 deletions

View File

@@ -1,6 +1,7 @@
namespace PS.IPAM;
using System;
[Serializable]
public class Address {
public int Id { get; }
public int SubnetId { get; }
@@ -13,11 +14,11 @@ public class Address {
public int TagId { get; }
public int DeviceId { get; }
public string Location { get; }
public int Port { get; }
public string Port { get; }
public string Note { get; }
public DateTime? LastSeen { get; }
public bool ExcludePing { get; }
public int PTRignore { get; }
public bool PTRignore { get; }
public int PTR { get; }
public string FirewallAddressObject { get; }
public DateTime? EditDate { get; }
@@ -35,11 +36,11 @@ public class Address {
int tag,
int deviceId,
string location,
int port,
string port,
string note,
DateTime? lastSeen,
bool excludePing,
int PTRignore,
bool PTRignore,
int PTR,
string firewallAddressObject,
DateTime? editDate,

View File

@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
</Project>

27
classlib/domain.cs Normal file
View File

@@ -0,0 +1,27 @@
namespace PS.IPAM;
using System;
[Serializable]
public class Domain {
public int Id { get; }
public string Name { get; }
public string Description { get; }
public string Sections { get; }
public Domain (
int id,
string name,
string description,
string sections
) {
this.Id = id;
this.Name = name;
this.Description = description;
this.Sections = sections;
}
public override string ToString()
{
return this.Name;
}
}

View File

@@ -1,6 +0,0 @@
namespace PS.IPAM;
using System;
enum Parameters {
IsGateway = "is_gateway";
}

54
classlib/section.cs Normal file
View File

@@ -0,0 +1,54 @@
namespace PS.IPAM;
using System;
[Serializable]
public class Section {
public int Id { get; }
public string Name { get; }
public string Description { get; }
public int MasterSectionId { get; }
public string Permissions { get; }
public bool StrictMode { get; }
public string SubnetOrdering { get; }
public int Order { get; }
public DateTime? EditDate { get; }
public bool ShowVlan { get; }
public bool ShowVRF { get; }
public bool ShowSupernetOnly { get; }
public int DNSId { get; }
public Section (
int id,
string name,
string description,
int masterSectionId,
string permissions,
bool strictMode,
string subnetOrdering,
int order,
DateTime? editDate,
bool showVlan,
bool showVRF,
bool showSupernetOnly,
int dnsId
) {
this.Id = id;
this.Name = name;
this.Description = description;
this.MasterSectionId = masterSectionId;
this.Permissions = permissions;
this.StrictMode = strictMode;
this.SubnetOrdering = subnetOrdering;
this.Order = order;
this.EditDate = editDate;
this.ShowVlan = showVlan;
this.ShowVRF = showVRF;
this.ShowSupernetOnly = showSupernetOnly;
this.DNSId = dnsId;
}
public override string ToString()
{
return this.Name;
}
}

View File

@@ -1,6 +1,7 @@
namespace PS.IPAM;
using System;
[Serializable]
public class Subnetwork {
public int Id { get; }
public string Subnet { get; }
@@ -55,41 +56,12 @@ public class Subnetwork {
this.ResolveDNS = resolveDNS;
}
public override string ToString()
{
public string GetCIDR() {
return $"{this.Subnet}/{this.Mask}";
}
}
id : 1
subnet : fd13:6d20:29dc:cf27::
mask : 64
sectionId : 2
description : Private subnet 1
linked_subnet :
firewallAddressObject :
vrfId : 0
masterSubnetId : 0
allowRequests : 1
vlanId : 1
showName : 1
device : 0
permissions : {"3":"1","2":"2"}
pingSubnet : 0
discoverSubnet : 0
resolveDNS : 0
DNSrecursive : 0
DNSrecords : 0
nameserverId : 0
scanAgent :
customer_id :
isFolder : 0
isFull : 0
isPool : 0
tag : 2
threshold : 0
location :
editDate :
lastScan :
lastDiscovery :
calculation : @{Type=IPv6; Host address=/; Host address (uncompressed)=/; Subnet prefix=fd13:6d20:29dc:cf27::/64; Prefix length=64; Subnet Reverse DNS=7.2.f.c.c.d.9.2.0.2.d.6.3.1.d.f.ip6.arpa; Min host IP=fd13:6d20:29dc:cf27::; Max host IP=fd13:6d20:29dc:cf27:ffff:ffff:ffff:ffff; Number of hosts=18446744073709551616; Address type=NET_IPV6}
public override string ToString()
{
return this.GetCIDR();
}
}

View File

@@ -1,5 +1,6 @@
namespace PS.IPAM;
[Serializable]
public class Tag {
public int Id { get; }
public string Type { get; }

32
classlib/vlan.cs Normal file
View File

@@ -0,0 +1,32 @@
namespace PS.IPAM;
using System;
[Serializable]
public class Vlan {
public int Id { get; }
public int DomainId { get; }
public string Name { get; }
public int Number { get; }
public string Description { get; }
public DateTime? EditDate { get; }
public Vlan (
int id,
int domainId,
string name,
int number,
string description,
DateTime? editDate
) {
this.Id = id;
this.DomainId = domainId;
this.Name = name;
this.Number = number;
this.Description = description;
this.EditDate = editDate;
}
public override string ToString()
{
return $"{this.Number}";
}
}

32
classlib/vrf.cs Normal file
View File

@@ -0,0 +1,32 @@
namespace PS.IPAM;
using System;
[Serializable]
public class Vrf {
public int Id { get; }
public string Name { get; }
public string RouteDistinguisher { get; }
public string Description { get; }
public string Sections { get; }
public DateTime? EditDate { get; }
public Vrf(
int id,
string name,
string rd,
string description,
string sections,
DateTime? editDate
) {
this.Id = id;
this.Name = name;
this.RouteDistinguisher = rd;
this.Description = description;
this.Sections = sections;
this.EditDate = editDate;
}
public override string ToString()
{
return this.Name;
}
}