From d455f3b56c866b0e61394a01f0a07e05831f3044 Mon Sep 17 00:00:00 2001 From: Ross Brattain Date: Mon, 31 Jul 2017 20:10:20 -0700 Subject: DRAFT: remove apexlake apexlake is unmaintained, so remove it From some reason orchestrator/heat.py started failing so fixup those unittests Change-Id: Ie06508b5ab7c9dcf9fdfca83e173a188a894d564 Signed-off-by: Ross Brattain --- .../libraries/packet_checker/test_sniff.c | 146 --------------------- 1 file changed, 146 deletions(-) delete mode 100644 yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/test_sniff.c (limited to 'yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/test_sniff.c') diff --git a/yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/test_sniff.c b/yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/test_sniff.c deleted file mode 100644 index a4eda3cff..000000000 --- a/yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/test_sniff.c +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) 2015 Intel Research and Development Ireland Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static int expected_tos = -1; -static int cmatch = 0; - - -/* 4 bytes IP address */ -typedef struct ip_address -{ - u_char byte1; - u_char byte2; - u_char byte3; - u_char byte4; -} ip_address; - - -/* IPv4 header */ -typedef struct ip_header -{ - u_char ver_ihl; - u_char tos; - u_short tlen; - u_short identification; - u_short flags_fo; - u_char ttl; - u_char proto; - u_short crc; - ip_address saddr; - ip_address daddr; - u_int op_pad; -} ip_header; - - -/* UDP header*/ -typedef struct udp_header -{ - u_short sport; // Source port - u_short dport; // Destination port - u_short len; // Datagram length - u_short crc; // Checksum -} udp_header; - - -/* Save results on file */ -void save_and_exit(int sig) -{ - write_file(); - exit(0); -} - - -/* - * This callback function is called for each received packet - */ -void stats_collection(u_char *useless, - const struct pcap_pkthdr* pkthdr, - const u_char* packet) -{ - ip_header *ih; - udp_header *uh; - u_int ip_len; - ih = (ip_header *) (packet + 14); - ip_len = (ih->ver_ihl & 0xf) * 4; - u_char tos = ih->tos; - // Counter update - if(tos==expected_tos) - cmatch ++; -} - - -int main(int argc,char **argv) -{ - int i; - char *dev; - char errbuf[PCAP_ERRBUF_SIZE]; - pcap_t* descr; - const u_char *packet; - struct pcap_pkthdr hdr; - struct ether_header *eptr; - - if(argc != 3) - { - fprintf(stdout,"Usage: %s interface_name expected_tos\n", argv[0]); - exit(1); - } - - expected_tos = atoi(argv[2]); - - /* Setup signal to stop the sniffer */ - signal(SIGTERM, save_and_exit); - - /* Take a device to read from */ - dev = argv[1]; - if(dev == NULL) - { - printf("%s\n",errbuf); - exit(1); - } - - /* Open device for reading */ - descr = pcap_open_live(dev, BUFSIZ, 0, -1, errbuf); - if(descr == NULL) - { - printf("pcap_open_live(): %s\n", errbuf); - exit(1); - } - - /* Start the loop to be run for each packet */ - pcap_loop(descr, -1, stats_collection, NULL); - return 0; -} - - -int write_file() -{ - FILE *f = fopen("/tmp/apexlake/results/packet_checker.res", "w"); - if (f == NULL) - { - printf("Error opening file!\n"); - exit(1); - } - fprintf(f, "%d\n", cmatch); - fclose(f); -} -- cgit 1.2.3-korg