WIP
parent
9a4f448a47
commit
32e4ace694
|
@ -8,14 +8,16 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using ln.json;
|
using ln.json;
|
||||||
using ln.types.odb.ng.storage.session;
|
using ln.types.odb.ng.storage.session;
|
||||||
|
using ln.types.net;
|
||||||
namespace ln.provider
|
namespace ln.provider
|
||||||
{
|
{
|
||||||
public class IPPoolService : ApplicationServiceBase
|
public class IPPoolService : ApplicationServiceBase
|
||||||
{
|
{
|
||||||
CoreService CoreService { get; set; }
|
CoreService CoreService { get; set; }
|
||||||
ProviderApplication Application => (ProviderApplication)base.CurrentApplicationInterface;
|
ProviderApplication Application => base.CurrentApplication as ProviderApplication;
|
||||||
|
|
||||||
RPC rpc;
|
|
||||||
|
RPC rpc;
|
||||||
|
|
||||||
SessionStorageContainer mapperSession;
|
SessionStorageContainer mapperSession;
|
||||||
Mapper mapper;
|
Mapper mapper;
|
||||||
|
@ -31,7 +33,7 @@ namespace ln.provider
|
||||||
rpc = new RPC(this);
|
rpc = new RPC(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ServiceMain(IApplicationInterface applicationInterface)
|
public override void ServiceMain(Application applicationInterface)
|
||||||
{
|
{
|
||||||
CoreService = Dependency<CoreService>();
|
CoreService = Dependency<CoreService>();
|
||||||
|
|
||||||
|
@ -110,21 +112,30 @@ namespace ln.provider
|
||||||
IPAllocation allocation = pool;
|
IPAllocation allocation = pool;
|
||||||
while (!allocation.CIDR.Equals(cidr))
|
while (!allocation.CIDR.Equals(cidr))
|
||||||
{
|
{
|
||||||
foreach (IPv6 splitCIDR in allocation.CIDR.Split(1))
|
IPAllocation split = null;
|
||||||
|
|
||||||
|
foreach (IPv6 splitCIDR in allocation.CIDR.Split(1))
|
||||||
{
|
{
|
||||||
if (splitCIDR.Contains(cidr))
|
if (splitCIDR.Contains(cidr))
|
||||||
{
|
{
|
||||||
IPAllocation split = GetAllocation(splitCIDR);
|
split = GetAllocation(splitCIDR);
|
||||||
if (split == null)
|
if (split == null)
|
||||||
{
|
{
|
||||||
split = new IPAllocation(splitCIDR,allocation.CIDR);
|
split = new IPAllocation(splitCIDR,allocation.CIDR);
|
||||||
mapper.Save(split);
|
mapper.Save(split);
|
||||||
allocation = split;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
else if (Equals(String.Empty,split.AllocatedTo))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
throw new ArgumentOutOfRangeException(String.Format("No subnet available below {0}",allocation.CIDR.ToCIDR()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
allocation = split;
|
||||||
}
|
}
|
||||||
|
allocation.AllocatedTo = usage;
|
||||||
|
mapper.Save(allocation);
|
||||||
return allocation;
|
return allocation;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -140,7 +151,6 @@ namespace ln.provider
|
||||||
|
|
||||||
return allocation;
|
return allocation;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
35
Program.cs
35
Program.cs
|
@ -3,6 +3,11 @@ using ln.types.odb.ng;
|
||||||
using ln.provider.data.phone;
|
using ln.provider.data.phone;
|
||||||
using ln.provider.data;
|
using ln.provider.data;
|
||||||
using ln.logging;
|
using ln.logging;
|
||||||
|
using ln.provider.netwatch.entities;
|
||||||
|
using ln.manage;
|
||||||
|
using System.Threading;
|
||||||
|
using ln.types.threads;
|
||||||
|
using ln.types.net;
|
||||||
|
|
||||||
namespace ln.provider
|
namespace ln.provider
|
||||||
{
|
{
|
||||||
|
@ -10,8 +15,34 @@ namespace ln.provider
|
||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
ProviderApplication providerApplication = new ProviderApplication();
|
//new ProviderApplication().Start(args);
|
||||||
providerApplication.Start(args);
|
|
||||||
|
ManagedRoot managedRoot = new ManagedRoot();
|
||||||
|
ManagedConsole managedConsole = new ManagedConsole(managedRoot);
|
||||||
|
|
||||||
|
ManagedNativeContainer<Layer2Segment> layer2segments = new ManagedNativeContainer<Layer2Segment>(managedRoot);
|
||||||
|
ManagedNativeContainer<NetworkDevice> networkDevices = new ManagedNativeContainer<NetworkDevice>(managedRoot);
|
||||||
|
|
||||||
|
IManagedObject nd0 = networkDevices.CreateManagedObject();
|
||||||
|
nd0.Enabled = true;
|
||||||
|
IManagedObject nd1 = networkDevices.CreateManagedObject();
|
||||||
|
nd1.SetValue("IPAddresses", new IPv6[] { IPv6.Parse("10.118.254.1"), IPv6.Parse("10.118.2.1") });
|
||||||
|
nd1.Enabled = true;
|
||||||
|
IManagedObject nd2 = networkDevices.CreateManagedObject();
|
||||||
|
nd2.Enabled = true;
|
||||||
|
|
||||||
|
Thread.Sleep(5000);
|
||||||
|
nd1.Enabled = false;
|
||||||
|
Thread.Sleep(5000);
|
||||||
|
|
||||||
|
Console.WriteLine(managedConsole.Export());
|
||||||
|
|
||||||
|
Thread.Sleep(5000);
|
||||||
|
|
||||||
|
nd0.Enabled = false;
|
||||||
|
nd1.Enabled = false;
|
||||||
|
nd2.Enabled = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,8 @@ using ln.application;
|
||||||
using ln.application.service;
|
using ln.application.service;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using ln.http.resources;
|
using ln.http.resources;
|
||||||
using System.IO;
|
|
||||||
using ln.types.rpc;
|
|
||||||
using ln.types.odb.ng;
|
using ln.types.odb.ng;
|
||||||
using ln.types.odb.ng.storage;
|
using ln.types.odb.ng.storage;
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Linq;
|
|
||||||
using ln.types;
|
|
||||||
using ln.types.odb.ng.storage.session;
|
using ln.types.odb.ng.storage.session;
|
||||||
using ln.types.odb.ng.storage.fs;
|
using ln.types.odb.ng.storage.fs;
|
||||||
namespace ln.provider
|
namespace ln.provider
|
||||||
|
@ -17,53 +12,30 @@ namespace ln.provider
|
||||||
public class ProviderApplication : Application
|
public class ProviderApplication : Application
|
||||||
{
|
{
|
||||||
public String ServerString { get; private set; }
|
public String ServerString { get; private set; }
|
||||||
public String WWWPath { get; private set; } = "www";
|
|
||||||
|
|
||||||
public ResourceApplication WWWApplication { get; private set; }
|
|
||||||
public RPCContainer RPCContainer { get; private set; }
|
|
||||||
|
|
||||||
public ProviderApplication()
|
public ProviderApplication()
|
||||||
{
|
{
|
||||||
ServerString = "ln.provider(0.1)";
|
ServerString = "ln.provider(0.1)";
|
||||||
RPCContainer = new RPCContainer();
|
|
||||||
|
|
||||||
if (Directory.Exists("../../www"))
|
DirectoryResource www = new DirectoryResource(new string[] { "../../www", "www" });
|
||||||
WWWPath = "../../www";
|
www.DefaultResource = www.GetResource("index.html");
|
||||||
|
www.FallBackResource = www.DefaultResource;
|
||||||
ServiceDefinition coreRPCService = ServiceDefinition.From<CoreService>(true);
|
|
||||||
ServiceContainer.Add(coreRPCService);
|
|
||||||
|
|
||||||
|
RootResource = www;
|
||||||
|
|
||||||
|
ServiceContainer.Add(ServiceDefinition.From<CoreService>(true));
|
||||||
ServiceContainer.Add(ServiceDefinition.From<IPPoolService>(true));
|
ServiceContainer.Add(ServiceDefinition.From<IPPoolService>(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PrepareStart()
|
public override void PrepareStart()
|
||||||
{
|
{
|
||||||
DirectoryResource www = new DirectoryResource(new string[] { "../../www", "www" });
|
|
||||||
www.DefaultResource = www.GetResource("index.html");
|
|
||||||
|
|
||||||
ApplicationWebSocket applicationWebSocket = new ApplicationWebSocket(null, "socket", RPCContainer);
|
|
||||||
www.InjectResource(applicationWebSocket);
|
|
||||||
|
|
||||||
WWWApplication = new ResourceApplication();
|
|
||||||
WWWApplication.RootResource = www;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override AuthenticatedUser AuthenticateUser(string username, object prove)
|
|
||||||
{
|
|
||||||
CoreService coreService = ServiceContainer[typeof(CoreService)].ServiceBase as CoreService;
|
|
||||||
|
|
||||||
String[] tokens = prove.ToString().Split(':');
|
|
||||||
int token = int.Parse(tokens[0]);
|
|
||||||
|
|
||||||
AuthenticatedUser authenticatedUser = coreService.Authenticate(username, token, tokens[1]);
|
|
||||||
|
|
||||||
return authenticatedUser;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CoreService : ApplicationServiceBase
|
public class CoreService : ApplicationServiceBase
|
||||||
{
|
{
|
||||||
public ProviderApplication Application => (ProviderApplication)base.CurrentApplicationInterface;
|
public ProviderApplication Application => (ProviderApplication)base.CurrentApplication;
|
||||||
|
|
||||||
public IStorageContainer CoreStorageContainer { get; private set; }
|
public IStorageContainer CoreStorageContainer { get; private set; }
|
||||||
public SessionStorageContainer CoreStorageSession { get; private set; }
|
public SessionStorageContainer CoreStorageSession { get; private set; }
|
||||||
|
@ -74,7 +46,7 @@ namespace ln.provider
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ServiceMain(IApplicationInterface applicationInterface)
|
public override void ServiceMain(Application application)
|
||||||
{
|
{
|
||||||
CoreStorageContainer = new FSStorageContainer("/var/cache/ln.provider");
|
CoreStorageContainer = new FSStorageContainer("/var/cache/ln.provider");
|
||||||
CoreStorageContainer.Open();
|
CoreStorageContainer.Open();
|
||||||
|
@ -82,12 +54,6 @@ namespace ln.provider
|
||||||
CoreStorageSession = new SessionStorageContainer(CoreStorageContainer);
|
CoreStorageSession = new SessionStorageContainer(CoreStorageContainer);
|
||||||
CoreStorageMapper = new Mapper(CoreStorageSession);
|
CoreStorageMapper = new Mapper(CoreStorageSession);
|
||||||
|
|
||||||
CoreStorageMapper.EnsureIndex<AuthenticatedUser>("ID");
|
|
||||||
CoreStorageMapper.EnsureIndex<AuthenticatedUser>("Name");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Application.HttpServer.DefaultApplication = Application.WWWApplication;
|
|
||||||
Application.RPCContainer.Add("core",new RPC(Application));
|
Application.RPCContainer.Add("core",new RPC(Application));
|
||||||
|
|
||||||
Ready();
|
Ready();
|
||||||
|
@ -107,32 +73,6 @@ namespace ln.provider
|
||||||
CoreStorageContainer = null;
|
CoreStorageContainer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuthenticatedUser Authenticate(string username,int token,string secretHash)
|
|
||||||
{
|
|
||||||
AuthenticatedUser authenticatedUser = CoreStorageMapper.Load<AuthenticatedUser>(Query.Equals<AuthenticatedUser>("Name", username)).FirstOrDefault();
|
|
||||||
|
|
||||||
if (authenticatedUser != null)
|
|
||||||
{
|
|
||||||
if (token <= authenticatedUser.Token)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
authenticatedUser.Token = token;
|
|
||||||
|
|
||||||
CoreStorageMapper.Save<AuthenticatedUser>(authenticatedUser);
|
|
||||||
|
|
||||||
byte[] secretHashBytes = Extensions.BytesFromHexString(secretHash);
|
|
||||||
|
|
||||||
SHA256 sha256 = SHA256.Create();
|
|
||||||
sha256.TransformBlock(token.GetBytes(), 0, 4, null, 0);
|
|
||||||
sha256.TransformFinalBlock(authenticatedUser.SecretHash, 0, authenticatedUser.SecretHash.Length);
|
|
||||||
|
|
||||||
if (sha256.Hash.AreEqual(secretHashBytes))
|
|
||||||
return authenticatedUser;
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
class RPC
|
class RPC
|
||||||
{
|
{
|
||||||
|
@ -153,25 +93,6 @@ namespace ln.provider
|
||||||
ThreadPool.QueueUserWorkItem((state) => providerApplication.Stop());
|
ThreadPool.QueueUserWorkItem((state) => providerApplication.Stop());
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Authenticate(string username,string secretHash)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Guid GetApplicationContext(string contextID)
|
|
||||||
{
|
|
||||||
Guid id;
|
|
||||||
if (string.Empty.Equals(contextID))
|
|
||||||
id = Guid.Empty;
|
|
||||||
else
|
|
||||||
id = Guid.Parse(contextID);
|
|
||||||
|
|
||||||
ApplicationContext applicationContext = providerApplication.GetApplicationContext(id);
|
|
||||||
ApplicationContext.SetCurrentContext(applicationContext);
|
|
||||||
|
|
||||||
return applicationContext.ContextID;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": "www"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "/home/haraldwolff/src/mono/ln.application/www"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -70,6 +70,14 @@
|
||||||
<Project>{D9342117-3249-4D8B-87C9-51A50676B158}</Project>
|
<Project>{D9342117-3249-4D8B-87C9-51A50676B158}</Project>
|
||||||
<Name>ln.json</Name>
|
<Name>ln.json</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\ln.provider.netwatch\ln.provider.netwatch.csproj">
|
||||||
|
<Project>{A5BB8163-FA35-44D6-BAB8-B7A921D83462}</Project>
|
||||||
|
<Name>ln.provider.netwatch</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\ln.manage\ln.manage.csproj">
|
||||||
|
<Project>{D4E4FD39-6C21-4FCC-8DE0-6494FBE82CEA}</Project>
|
||||||
|
<Name>ln.manage</Name>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="www\" />
|
<Folder Include="www\" />
|
||||||
|
|
|
@ -21,6 +21,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.application", "..\ln.app
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.templates", "..\ln.templates\ln.templates.csproj", "{AD0267BB-F08C-4BE1-A88D-010D49041761}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.templates", "..\ln.templates\ln.templates.csproj", "{AD0267BB-F08C-4BE1-A88D-010D49041761}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.provider.netwatch", "..\ln.provider.netwatch\ln.provider.netwatch.csproj", "{A5BB8163-FA35-44D6-BAB8-B7A921D83462}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.manage", "..\ln.manage\ln.manage.csproj", "{D4E4FD39-6C21-4FCC-8DE0-6494FBE82CEA}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|x86 = Debug|x86
|
Debug|x86 = Debug|x86
|
||||||
|
@ -67,5 +71,13 @@ Global
|
||||||
{AD0267BB-F08C-4BE1-A88D-010D49041761}.Debug|x86.Build.0 = Debug|Any CPU
|
{AD0267BB-F08C-4BE1-A88D-010D49041761}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
{AD0267BB-F08C-4BE1-A88D-010D49041761}.Release|x86.ActiveCfg = Release|Any CPU
|
{AD0267BB-F08C-4BE1-A88D-010D49041761}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{AD0267BB-F08C-4BE1-A88D-010D49041761}.Release|x86.Build.0 = Release|Any CPU
|
{AD0267BB-F08C-4BE1-A88D-010D49041761}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{A5BB8163-FA35-44D6-BAB8-B7A921D83462}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{A5BB8163-FA35-44D6-BAB8-B7A921D83462}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{A5BB8163-FA35-44D6-BAB8-B7A921D83462}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{A5BB8163-FA35-44D6-BAB8-B7A921D83462}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{D4E4FD39-6C21-4FCC-8DE0-6494FBE82CEA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{D4E4FD39-6C21-4FCC-8DE0-6494FBE82CEA}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{D4E4FD39-6C21-4FCC-8DE0-6494FBE82CEA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{D4E4FD39-6C21-4FCC-8DE0-6494FBE82CEA}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -4,66 +4,44 @@
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>ln.provider Web Interface</title>
|
<title>ln.provider Web Interface</title>
|
||||||
|
|
||||||
|
<link href="/css/ln.vue.css"/>
|
||||||
<link href="/style.css" rel="stylesheet" />
|
<link href="/style.css" rel="stylesheet" />
|
||||||
<link href="/page.layout.css" rel="stylesheet" />
|
<link href="/page.layout.css" rel="stylesheet" />
|
||||||
<link href="/tables.layout.css" rel="stylesheet" />
|
<link href="/tables.layout.css" rel="stylesheet" />
|
||||||
|
|
||||||
<script type="text/javascript" src="/vue.js"></script>
|
<script type="text/javascript" src="/js/vue.js"></script>
|
||||||
<script type="text/javascript" src="/vue-router.js"></script>
|
<script type="text/javascript" src="/js/vue-router.js"></script>
|
||||||
<script type="text/javascript" src="/ln.tools.js"></script>
|
<script type="text/javascript" src="/js/ln.vue.js"></script>
|
||||||
<script type="text/javascript" src="/ln.application.js"></script>
|
<script type="text/javascript" src="/js/ln.vue.components.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="ln.provider.components.js"></script>
|
<script type="text/javascript" src="/ln.provider.components.js"></script>
|
||||||
<script type="text/javascript" src="ln.provider.js"></script>
|
<script type="text/javascript" src="/ln.provider.js"></script>
|
||||||
<script type="text/javascript" src="ln.provider.pool.js"></script>
|
<script type="text/javascript" src="/ln.provider.pool.js"></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="body">
|
<div id="body">
|
||||||
<div id="header">
|
<section id="header">
|
||||||
<div class="logo">
|
<div class="logo">
|
||||||
<div style="background-color: #2a7fff; color: white;">ln.</div><div style="background-color: white;">provider</div>
|
<div style="background-color: #2a7fff; color: white;">ln.</div><div style="background-color: white;">provider</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<ln-identity></ln-identity>
|
||||||
|
</section>
|
||||||
|
|
||||||
<div id="navbar">
|
<ln-navbar></ln-navbar>
|
||||||
<router-link
|
|
||||||
v-for="route in LNProvider.routes"
|
|
||||||
v-if="route.label"
|
|
||||||
v-bind:to="route.path"
|
|
||||||
>{{ route.label }}</router-link>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="page">
|
<section id="page">
|
||||||
<router-view
|
<router-view
|
||||||
v-bind="{ LNP: LNP }"
|
v-bind="{ LNP: LNP }"
|
||||||
></router-view>
|
></router-view>
|
||||||
</div>
|
</section>
|
||||||
|
|
||||||
<div id="footer" class="flex row">
|
<section id="footer" class="flex row">
|
||||||
<div id="ServerString" class="silver">{{ LNP.serverString }}</div>
|
</section>
|
||||||
<div class="grow"></div>
|
|
||||||
<div id="ServerTime" class="" style="margin-right: 12px;">{{ LNP.serverTime }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var LNP = new LNProvider();
|
var LNP = new LNVue();
|
||||||
|
LNP.Start();
|
||||||
LNP
|
|
||||||
.initialize()
|
|
||||||
.then(function(){
|
|
||||||
const router = new VueRouter({
|
|
||||||
routes: LNProvider.routes,
|
|
||||||
});
|
|
||||||
new Vue({
|
|
||||||
el: "#body",
|
|
||||||
data: {
|
|
||||||
LNP,
|
|
||||||
},
|
|
||||||
router,
|
|
||||||
}).$mount("#body");
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -11,12 +11,6 @@
|
||||||
this.lagDetector = null;
|
this.lagDetector = null;
|
||||||
|
|
||||||
this.IPAllocations = [];
|
this.IPAllocations = [];
|
||||||
|
|
||||||
LN().option("wsError",(e)=>self.wsError(e));
|
|
||||||
LN().option("wsClose",(e)=>self.wsClose(e));
|
|
||||||
LN().option("wsUpdate",(e)=>self.wsUpdate(e));
|
|
||||||
|
|
||||||
LN().connect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
initialize(){
|
initialize(){
|
||||||
|
|
|
@ -1,45 +1,33 @@
|
||||||
LNProvider.initializers.push(
|
LNVue.$_.addModule({
|
||||||
new Promise((resolve,reject)=>{
|
routes: {
|
||||||
LN()
|
'/ippool': {
|
||||||
.load("/ln.provider.pool.html")
|
url: '/ln.provider.pool.html',
|
||||||
.then((template)=>{
|
data: function(){
|
||||||
LNProvider.routes.push(
|
return {
|
||||||
{
|
allocationWidth: 64,
|
||||||
path: "/ippool",
|
targetCIDR: "",
|
||||||
label: "IP Pool",
|
independentAllocation: false,
|
||||||
component: {
|
allocationType: 0,
|
||||||
props: {
|
allocationUsage: "",
|
||||||
LNP: Object,
|
};
|
||||||
},
|
},
|
||||||
template: template,
|
computed: {
|
||||||
data: function(){
|
IPAllocations: ()=>LNP.IPAllocations,
|
||||||
return {
|
subnetWidth: {
|
||||||
allocationWidth: 64,
|
get: function(){
|
||||||
targetCIDR: "",
|
return 128 - this.allocationWidth;
|
||||||
independentAllocation: false,
|
|
||||||
allocationType: 0,
|
|
||||||
allocationUsage: "",
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
IPAllocations: ()=>LNP.IPAllocations,
|
|
||||||
subnetWidth: {
|
|
||||||
get: function(){
|
|
||||||
return 128 - this.allocationWidth;
|
|
||||||
},
|
|
||||||
set: function(v){
|
|
||||||
this.allocationWidth = 128 - v;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
beforeRouteEnter: function(to,from,next){
|
|
||||||
LNP.loadIPAllocations();
|
|
||||||
next();
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
set: function(v){
|
||||||
);
|
this.allocationWidth = 128 - v;
|
||||||
resolve();
|
},
|
||||||
});
|
},
|
||||||
})
|
},
|
||||||
);
|
},
|
||||||
|
},
|
||||||
|
navigation: {
|
||||||
|
ippool: {
|
||||||
|
label: "IP Pool",
|
||||||
|
path: '/ippool',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue