Calix Community  
 
Reply
Contributor
Posts: 26
Registered: ‎02-25-2015
0

Can't add endpoint map when uploading custom files (or dhcp.leases)

[ Edited ]

I am attempting to create custom endpoint mapping records to pull from the web version of flow analyze. According to the guide found at: https://www.calix.com/bin/calix/servlets/docdownload?fileId=/content/dam/calix/doc-library/software/... on page 65, either a dhcp lease or custom, comma delimited record can be used to map an endpoint. I have tried to use both of these, and both passed, returned a success message, but failed to be searchable in CC+. Below is the code I used

 

$str = "Unique-TEST,173.241.164.52,ec:4f:82:1e:d8:9b,CXNK00188338,,MAPPED-NAME-TEST,,,,,,,,,,,,,FMS,,,,,,,,";

print_r(query_post($str, $config));


	/**
	 *  Function will query FA+ using the given parameters
	 *  Params: URI without host, json_encoded string of arguments
	 *  Returns: Array, "errors", "result" 
	 */
	function query_post($arguments, $config){
		$data = (object) array();
		$ch = curl_init();
		$options = array(
			CURLOPT_URL => $config['cc-fa-host-uri']."/api/upload?type=".urldecode("custom"),
			CURLOPT_CUSTOMREQUEST=> "POST",
			CURLOPT_SSL_VERIFYHOST => 0,
			CURLOPT_SSL_VERIFYPEER => 0,
			CURLOPT_TIMEOUT => 5,
			CURLOPT_RETURNTRANSFER => 1,
			CURLOPT_POSTFIELDS => $arguments,
			CURLOPT_HTTPHEADER => array(
									"Authorization: Basic ".base64_encode($config['cc-fa-username'].":".$config['cc-fa-password']), 
									"Content-Type: text/html"
								),
			//CURLOPT_VERBOSE => 1,				//debugging
		);
		
		// Set options against curl object
		curl_setopt_array($ch, $options);
		$file = curl_exec($ch);
		if(curl_error($ch)){
			$err = curl_error($ch);
		} else {
			$err = null;
		}
		
		$data->error = $err;
		$data->info = curl_getinfo($ch);
		
		$result_obj = json_decode($file);
		if($result_obj){
			if(count($result_obj) > 1){
				$data->result = $result_obj;
			} else {
				$data->result = array($result_obj);
			}
		} else {
			$data->result = array((object) array("response"=>$file));
		}

		
		// close curl object after you check for errors!
		curl_close($ch);
		
		return $data;
	}

In addition, this is the result 

stdClass Object
(
    [error] =>
    [info] => Array
        (
            [url] => https://compass.calix.com:9444/api/upload?type=custom
            [content_type] => text/html; charset=utf-8
            [http_code] => 200
            [header_size] => 161
            [request_size] => 295
            [filetime] => -1
            [ssl_verify_result] => 0
            [redirect_count] => 0
            [total_time] => 0.402764
            [namelookup_time] => 0.004285
            [connect_time] => 0.070597
            [pretransfer_time] => 0.229074
            [size_upload] => 99
            [size_download] => 47
            [speed_download] => 116
            [speed_upload] => 245
            [download_content_length] => 47
            [upload_content_length] => 99
            [starttransfer_time] => 0.402726
            [redirect_time] => 0
            [redirect_url] =>
            [primary_ip] => 199.71.142.249
            [certinfo] => Array
                (
                )

            [primary_port] => 9444
            [local_ip] => 173.241.160.52
            [local_port] => 42374
        )

    [result] => Array
        (
            [0] => stdClass Object
                (
                    [response] =>
Done.  Found: 1 records, 0 warnings, 0 errors

                )

        )

)

I figured I would post here and see if it gets anywhere before contacting TAC.

 

 

It is returning that is was successful, but I cannot find the record or has failed to map in the java FA applet or web. The documentation is very lacking on this area.