• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.google.android.iwlan.epdg;
18 
19 import android.net.LinkAddress;
20 import android.telephony.data.NetworkSliceInfo;
21 
22 import java.net.InetAddress;
23 import java.util.LinkedList;
24 import java.util.List;
25 
26 public class TunnelLinkPropertiesTest {
27 
28     private static final String IP_ADDRESS = "192.0.2.1";
29     private static final String DNS_ADDRESS = "8.8.8.8";
30     private static final String PSCF_ADDRESS = "10.159.204.230";
31     private static final String INTERFACE_NAME = "ipsec6";
32     private static final NetworkSliceInfo SLICE_INFO =
33             NetworkSliceSelectionAssistanceInformation.getSliceInfo(new byte[] {1});
34 
createTestTunnelLinkProperties()35     public static TunnelLinkProperties createTestTunnelLinkProperties() throws Exception {
36         List<LinkAddress> mInternalAddressList = new LinkedList<>();
37         List<InetAddress> mDNSAddressList = new LinkedList<>();
38         List<InetAddress> mPCSFAddressList = new LinkedList<>();
39 
40         InetAddress mDNSAddress = InetAddress.getByName(DNS_ADDRESS);
41         InetAddress mPCSFAddress = InetAddress.getByName(PSCF_ADDRESS);
42 
43         mInternalAddressList.add(new LinkAddress(InetAddress.getByName(IP_ADDRESS), 3));
44         mDNSAddressList.add(mDNSAddress);
45         mPCSFAddressList.add(mPCSFAddress);
46 
47         return TunnelLinkProperties.builder()
48                 .setInternalAddresses(mInternalAddressList)
49                 .setDnsAddresses(mDNSAddressList)
50                 .setPcscfAddresses(mPCSFAddressList)
51                 .setIfaceName(INTERFACE_NAME)
52                 .setSliceInfo(SLICE_INFO)
53                 .build();
54     }
55 }
56