Provides a static mapping for all nodes, just so that they can have a unique Dns name as required by classical applications such as Condor. They will be of the format C111222333.ipop, where the ip address is 000.111.222.333.
An IP Address of 11.22.33.44 would translate into C022033044.ipop, the extra "0"s are necessary and keep all names at a constant length of 15 (including the domain name .ipop).
Inheritance: Dns
示例#1
0
        public void Test()
        {
            StaticDns dns = new StaticDns(
                MemBlock.Reference(Utils.StringToBytes("10.250.0.0", '.')),
                MemBlock.Reference(Utils.StringToBytes("255.255.0.0", '.')),
                string.Empty, false);

            Assert.AreEqual(dns.NameLookUp("10.250.1.1"), "C250001001.ipop", "NameLookUp Dns set in range.");

            try {
                Assert.AreEqual(dns.NameLookUp("10.251.1.1"), null, "NameLookUp Dns set out of range.");
            } catch { }

            Assert.AreEqual(dns.AddressLookUp("C250001001.ipop"), "10.250.1.1", "AddressLookUp Dns set.");

            try {
                Assert.AreEqual(dns.AddressLookUp("C250001001.blaha"), null, "AddressLookUp Dns set bad dns name: blaha.");
            } catch { }

            try {
                Assert.AreEqual(dns.AddressLookUp("C250001001.blah"), null, "AddressLookUp Dns set bad dns name: blah.");
            } catch { }

            dns = new StaticDns(
                MemBlock.Reference(Utils.StringToBytes("10.251.0.0", '.')),
                MemBlock.Reference(Utils.StringToBytes("255.255.0.0", '.')),
                string.Empty, false);

            try {
                Assert.AreEqual(dns.NameLookUp("10.250.1.1"), null, "NameLookUp Dns changed out of range.");
            } catch { }

            Assert.AreEqual(dns.NameLookUp("10.251.1.1"), "C251001001.ipop", "NameLookUp Dns changed in range.");
        }
示例#2
0
        public void SmallMaskTest()
        {
            StaticDns dns = new StaticDns(
                MemBlock.Reference(Utils.StringToBytes("10.1.2.0", '.')),
                MemBlock.Reference(Utils.StringToBytes("255.255.255.0", '.')),
                string.Empty, false);

            Assert.AreEqual(dns.NameLookUp("10.1.2.94"), "C001002094.ipop", "test1");
            Assert.AreEqual(dns.AddressLookUp("C001002094.ipop"), "10.1.2.94", "test2");
        }
示例#3
0
    public void Test() {
      StaticDns dns = new StaticDns(
          MemBlock.Reference(Utils.StringToBytes("10.250.0.0", '.')),
          MemBlock.Reference(Utils.StringToBytes("255.255.0.0", '.')),
          string.Empty, false);

      Assert.AreEqual(dns.NameLookUp("10.250.1.1"), "C250001001.ipop", "NameLookUp Dns set in range.");

      try {
        Assert.AreEqual(dns.NameLookUp("10.251.1.1"), null, "NameLookUp Dns set out of range.");
      } catch { }

      Assert.AreEqual(dns.AddressLookUp("C250001001.ipop"), "10.250.1.1", "AddressLookUp Dns set.");

      try {
        Assert.AreEqual(dns.AddressLookUp("C250001001.blaha"), null, "AddressLookUp Dns set bad dns name: blaha.");
      } catch { }

      try {
        Assert.AreEqual(dns.AddressLookUp("C250001001.blah"), null, "AddressLookUp Dns set bad dns name: blah.");
      } catch { }

      dns = new StaticDns(
          MemBlock.Reference(Utils.StringToBytes("10.251.0.0", '.')),
          MemBlock.Reference(Utils.StringToBytes("255.255.0.0", '.')),
          string.Empty, false);

      try {
        Assert.AreEqual(dns.NameLookUp("10.250.1.1"), null, "NameLookUp Dns changed out of range.");
      } catch { }

      Assert.AreEqual(dns.NameLookUp("10.251.1.1"), "C251001001.ipop", "NameLookUp Dns changed in range.");
    }
示例#4
0
    public void SmallMaskTest() {
      StaticDns dns = new StaticDns(
          MemBlock.Reference(Utils.StringToBytes("10.1.2.0", '.')),
          MemBlock.Reference(Utils.StringToBytes("255.255.255.0", '.')),
          string.Empty, false);

      Assert.AreEqual(dns.NameLookUp("10.1.2.94"), "C001002094.ipop", "test1");
      Assert.AreEqual(dns.AddressLookUp("C001002094.ipop"), "10.1.2.94", "test2");
    }